org.geotools.filter
Class AttributeExpressionImpl

java.lang.Object
  extended byorg.geotools.filter.DefaultExpression
      extended byorg.geotools.filter.AttributeExpressionImpl
All Implemented Interfaces:
AttributeExpression, Expression, ExpressionType

public class AttributeExpressionImpl
extends DefaultExpression
implements AttributeExpression

Defines a complex filter (could also be called logical filter). This filter holds one or more filters together and relates them logically in an internally defined manner.

Version:
$Id: AttributeExpressionImpl.java,v 1.11 2003/07/23 15:50:27 cholmesny Exp $
Author:
Rob Hranac, TOPP

Field Summary
protected  java.lang.String attPath
          Holds all sub filters of this filter.
protected  FeatureType schema
          Holds all sub filters of this filter.
 
Fields inherited from class org.geotools.filter.DefaultExpression
expressionType, permissiveConstruction
 
Fields inherited from interface org.geotools.filter.ExpressionType
ATTRIBUTE, ATTRIBUTE_DOUBLE, ATTRIBUTE_GEOMETRY, ATTRIBUTE_INTEGER, ATTRIBUTE_STRING, ATTRIBUTE_UNDECLARED, FUNCTION, LITERAL_DOUBLE, LITERAL_GEOMETRY, LITERAL_INTEGER, LITERAL_STRING, MATH_ADD, MATH_DIVIDE, MATH_MULTIPLY, MATH_SUBTRACT
 
Constructor Summary
protected AttributeExpressionImpl(FeatureType schema)
          Constructor with the schema for this attribute.
protected AttributeExpressionImpl(FeatureType schema, java.lang.String attPath)
          Constructor with schema and path to the attribute.
 
Method Summary
 void accept(FilterVisitor visitor)
          Used by FilterVisitors to perform some action on this filter instance.
 boolean equals(java.lang.Object obj)
          Compares this filter to the specified object.
 java.lang.String getAttributePath()
          Gets the path to the attribute to be evaluated by this expression.
 java.lang.Object getValue(Feature feature)
          Gets the value of this attribute from the passed feature.
 int hashCode()
          Override of hashCode method.
 void setAttributePath(java.lang.String attPath)
          Constructor with minimum dataset for a valid expression.
 java.lang.String toString()
          Return this expression as a string.
 
Methods inherited from class org.geotools.filter.DefaultExpression
getType, isAttributeExpression, isExpression, isFunctionExpression, isGeometryExpression, isLiteralExpression, isMathExpression
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.geotools.filter.Expression
getType
 

Field Detail

attPath

protected java.lang.String attPath
Holds all sub filters of this filter.


schema

protected FeatureType schema
Holds all sub filters of this filter.

Constructor Detail

AttributeExpressionImpl

protected AttributeExpressionImpl(FeatureType schema)
Constructor with the schema for this attribute.

Parameters:
schema - The schema for this attribute.

AttributeExpressionImpl

protected AttributeExpressionImpl(FeatureType schema,
                                  java.lang.String attPath)
                           throws IllegalFilterException
Constructor with schema and path to the attribute.

Parameters:
schema - The initial (required) sub filter.
attPath - the xpath to the attribute.
Throws:
IllegalFilterException - If the attribute path is not in the schema.
Method Detail

setAttributePath

public void setAttributePath(java.lang.String attPath)
                      throws IllegalFilterException
Constructor with minimum dataset for a valid expression.

Specified by:
setAttributePath in interface AttributeExpression
Parameters:
attPath - The initial (required) sub filter.
Throws:
IllegalFilterException - If the attribute path is not in the schema.

getAttributePath

public java.lang.String getAttributePath()
Gets the path to the attribute to be evaluated by this expression.

Specified by:
getAttributePath in interface AttributeExpression
Returns:
the path.

getValue

public java.lang.Object getValue(Feature feature)
Gets the value of this attribute from the passed feature.

Specified by:
getValue in interface AttributeExpression
Overrides:
getValue in class DefaultExpression
Parameters:
feature - Feature from which to extract attribute value.
Returns:
DOCUMENT ME!

toString

public java.lang.String toString()
Return this expression as a string.

Returns:
String representation of this attribute expression.

equals

public boolean equals(java.lang.Object obj)
Compares this filter to the specified object. Returns true if the passed in object is the same as this expression. Checks to make sure the expression types are the same as well as the attribute paths and schemas.

Parameters:
obj - - the object to compare this ExpressionAttribute against.
Returns:
true if specified object is equal to this filter; else false

hashCode

public int hashCode()
Override of hashCode method.

Returns:
a code to hash this object by.

accept

public void accept(FilterVisitor visitor)
Used by FilterVisitors to perform some action on this filter instance. Typicaly used by Filter decoders, but may also be used by any thing which needs infomration from filter structure. Implementations should always call: visitor.visit(this); It is importatant that this is not left to a parent class unless the parents API is identical.

Specified by:
accept in interface Expression
Parameters:
visitor - The visitor which requires access to this filter, the method must call visitor.visit(this);


Copyright © GeoTools. All Rights Reserved.