/*
* Geotoolkit - An Open Source Java GIS Toolkit
* http://www.geotoolkit.org
*
* (C) 2012, Geomatys
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
package org.geotoolkit.filter.temporal;
import org.geotoolkit.util.StringUtilities;
import org.apache.sis.util.Classes;
import org.opengis.filter.expression.Expression;
/**
*
* @author Johann Sorel (Geomatys)
*/
public class AbstractTemporalFilter {
protected final Expression left;
protected final Expression right;
public AbstractTemporalFilter(final Expression left, final Expression right) {
this.left = left;
this.right = right;
}
public Expression getExpression1() {
return left;
}
public Expression getExpression2() {
return right;
}
/**
* {@inheritDoc }
*/
@Override
public String toString() {
final StringBuilder sb = new StringBuilder(Classes.getShortClassName(this));
sb.append(StringUtilities.toStringTree(left,right));
return sb.toString();
}
/**
* {@inheritDoc }
*/
@Override
public boolean equals(final Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final AbstractTemporalFilter other = (AbstractTemporalFilter) obj;
if (this.left != other.left && !this.left.equals(other.left)) {
return false;
}
if (this.right != other.right && !this.right.equals(other.right)) {
return false;
}
return true;
}
/**
* {@inheritDoc }
*/
@Override
public int hashCode() {
int hash = 10;
hash = 23 * hash + this.left.hashCode();
hash = 23 * hash + this.right.hashCode() ;
return hash;
}
}