int filterType = Filters.getFilterType(this); if (filterType == NULL) { return "[ " + expression1 + " IS NULL ]";
/** * Override of hashCode method. * * @return a code to hash this object by. */ public int hashCode() { if (cachedHash == 0) { int result = 17; int filterType = Filters.getFilterType(this); result = (37 * result) + filterType; result = (37 * result) + children.hashCode(); cachedHash = result; } return cachedHash; }
/** * Override of hashCode method. * * @return a code to hash this object by. */ public int hashCode() { int result = 17; int filterType = Filters.getFilterType(this); result = (37 * result) + filterType; result = (37 * result) + ((expression1 == null) ? 0 : expression1.hashCode()); result = (37 * result) + ((expression2 == null) ? 0 : expression2.hashCode()); return result; }
/** * Compares this filter to the specified object. Returns true if the passed in object is the * same as this filter. Checks to make sure the filter types, and the NullCheckValue are the * same. * * @param obj - the object to compare this LikeFilter against. * @return true if specified object is equal to this filter; false otherwise. */ public boolean equals(Object obj) { if (obj != null && obj.getClass() == this.getClass()) { NullFilterImpl nullFilter = (NullFilterImpl) obj; return ((Filters.getFilterType(nullFilter) == Filters.getFilterType(this)) && nullFilter.getExpression().equals(this.nullCheck)); } else { return false; } }
/** * Returns a flag indicating object equality. * * @param filter the filter to test equality on. * @return String representation of the compare filter. */ public boolean equals(Object filter) { LOGGER.finest("condition: " + filter); if ((filter != null) && (filter.getClass() == this.getClass())) { FidFilterImpl other = (FidFilterImpl) filter; int filterType = Filters.getFilterType(other); if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.finest("condition: " + filterType); } if (filterType == AbstractFilter.FID) { return fids.equals(other.fids); } else { return false; } } else { return false; } }
/** * Determines if the filter passed in is supported. * * @param filter The Filter to be tested. * @return true if supported, false otherwise. */ public boolean supports(org.opengis.filter.Filter filter) { for (Iterator ifunc = functions.iterator(); ifunc.hasNext(); ) { if (((Class) ifunc.next()).isAssignableFrom(filter.getClass())) return true; } if (functions.contains(filter.getClass())) return true; short filterType = Filters.getFilterType(filter); if (filterType == 0) { // unknown type return false; } return supports(filterType); }
/** * Compares this filter to the specified object. Returns true if the passed in object is the * same as this filter. Checks to make sure the filter types, the value, and the pattern are the * same. & * * @param obj - the object to compare this LikeFilter against. * @return true if specified object is equal to this filter; false otherwise. */ public boolean equals(Object obj) { if (obj instanceof LikeFilterImpl) { LikeFilterImpl lFilter = (LikeFilterImpl) obj; // REVISIT: check for nulls. return ((Filters.getFilterType(lFilter) == Filters.getFilterType(this)) && lFilter.getExpression().equals(this.attribute) && lFilter.getPattern().equals(this.pattern)); } return false; }
/** * Adds a sub filter to this filter. * * @param filter Specified filter to add to the sub filter list. * @throws IllegalFilterException Does not conform to logic filter structure * @task REVISIT: make all filters immutable. This should return a new filter. */ public final void addFilter(org.opengis.filter.Filter filter) throws IllegalFilterException { // reset cachedHash = 0; int filterType = Filters.getFilterType(this); if ((filterType != LOGIC_NOT) || (children.size() == 0)) { children.add(filter); } else { throw new IllegalFilterException( "Attempted to add an more than one filter to a NOT filter."); } }
/** * Returns a string representation of this filter. * * @return String representation of the logic filter. */ public String toString() { String returnString = "["; String operator = ""; Iterator iterator = children.iterator(); int filterType = Filters.getFilterType(this); if (filterType == LOGIC_OR) { operator = " OR "; } else if (filterType == LOGIC_AND) { operator = " AND "; } else if (filterType == LOGIC_NOT) { return "[ NOT " + iterator.next().toString() + " ]"; } while (iterator.hasNext()) { returnString = returnString + iterator.next().toString(); if (iterator.hasNext()) { returnString = returnString + operator; } } return returnString + "]"; }
boolean isEqual = true; isEqual = Filters.getFilterType(geomFilter) == Filters.getFilterType(this); if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.finest( + isEqual + "; in:" + Filters.getFilterType(geomFilter) + "; out:" + Filters.getFilterType(this));
/** * Override of hashCode method. * * @return a hash code value for this geometry filter. */ public int hashCode() { org.opengis.filter.expression.Expression leftGeometry = getExpression1(); org.opengis.filter.expression.Expression rightGeometry = getExpression2(); int result = 17; int filterType = Filters.getFilterType(this); result = (37 * result) + filterType; result = (37 * result) + ((leftGeometry == null) ? 0 : leftGeometry.hashCode()); result = (37 * result) + ((rightGeometry == null) ? 0 : rightGeometry.hashCode()); return result; }
LOGGER.finest( "filter type match:" + (Filters.getFilterType(logFilter) == Filters.getFilterType(this))); LOGGER.finest( "same size:" return ((Filters.getFilterType(logFilter) == Filters.getFilterType(this)) && (logFilter.getSubFilters().size() == this.children.size()) && logFilter.getSubFilters().containsAll(this.children));
int filterType = Filters.getFilterType(this); if (filterType == GEOMETRY_EQUALS) { operator = " equals ";
public void visitLogicFilter(Not filter) { int startSize = current.size(); try { switch (this.complianceInt) { case LOW: current.push(new Data(filter)); break; case MEDIUM: filter.getFilter().accept(this, null); current.push( createMediumLevelLogicFilter(Filters.getFilterType(filter), startSize)); break; case HIGH: filter.getFilter().accept(this, null); current.push( createHighLevelLogicFilter(Filters.getFilterType(filter), startSize)); break; default: break; } } catch (Exception e) { if (e instanceof UnsupportedFilterException) { throw (UnsupportedFilterException) e; } throw new UnsupportedFilterException("Exception creating filter", e); } }
createMediumLevelLogicFilter(Filters.getFilterType(filter), startSize)); createHighLevelLogicFilter(Filters.getFilterType(filter), startSize));
/** * @see org.geotools.xml.schema.Type#canEncode(org.geotools.xml.schema.Element, * java.lang.Object, java.util.Map) */ public boolean canEncode(Element element, Object value, Map hints) { if ((hints != null) && hints.containsKey(FilterSchema.FILTER_CAP_KEY)) { FilterCapabilities fc = (FilterCapabilities) hints.get(FilterSchema.FILTER_CAP_KEY); if ((fc.getScalarOps() == 0) && (fc.getSpatialOps() == 0)) { return false; } } boolean r = ((element != null) && (element.getType() != null) && getName().equals(element.getType().getName())); r = (r && (value != null) && value instanceof Filter && Filters.getFilterType((Filter) value) != 0); return r; }
@Test public void testGetFilterType() { assertEquals(FilterType.COMPARE_GREATER_THAN, Filters.getFilterType(a)); }
BinaryLogicOperator lf = (BinaryLogicOperator) value; switch (Filters.getFilterType(lf)) { case LOGIC_AND: BinaryLogicOpType.getInstance()
switch (Filters.getFilterType(lf)) { case COMPARE_EQUALS: BinaryComparisonOpType.getInstance()
switch (Filters.getFilterType(lf)) { case GEOMETRY_BBOX: BBOXType.getInstance()