org.geotools.filter
Class AttributeExpressionImpl

java.lang.Object
  extended byorg.geotools.filter.expression.ExpressionAbstract
      extended byorg.geotools.filter.DefaultExpression
          extended byorg.geotools.filter.AttributeExpressionImpl
All Implemented Interfaces:
AttributeExpression, org.opengis.filter.expression.Expression, Expression, ExpressionType, org.opengis.filter.expression.PropertyName

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 18021 2006-02-14 20:36:18Z jdeolive $
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.expression.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.
protected AttributeExpressionImpl(java.lang.String xpath)
          Constructor with schema and path to the attribute.
 
Method Summary
 java.lang.Object accept(org.opengis.filter.expression.ExpressionVisitor visitor, java.lang.Object extraData)
          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.Object evaluate(Feature feature)
          Gets the value of this attribute from the passed feature.
 java.lang.String getAttributePath()
          Deprecated. use getPropertyName()
 java.lang.String getPropertyName()
          Gets the path to the attribute to be evaluated by this expression.
 int hashCode()
          Override of hashCode method.
 void setAttributePath(java.lang.String attPath)
          Deprecated. use setPropertyName(String)
 void setPropertyName(java.lang.String attPath)
           
 java.lang.String toString()
          Return this expression as a string.
 
Methods inherited from class org.geotools.filter.DefaultExpression
accept, evaluate, getType, getValue, isAttributeExpression, isExpression, isGeometryExpression, isLiteralExpression, isMathExpression, isMathExpression
 
Methods inherited from class org.geotools.filter.expression.ExpressionAbstract
eval
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.geotools.filter.expression.AttributeExpression
getValue
 
Methods inherited from interface org.geotools.filter.expression.Expression
accept, getType
 
Methods inherited from interface org.opengis.filter.expression.Expression
evaluate
 

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(java.lang.String xpath)
Constructor with schema and path to the 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 final void setAttributePath(java.lang.String attPath)
                            throws IllegalFilterException
Deprecated. use setPropertyName(String)

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 final java.lang.String getAttributePath()
Deprecated. use getPropertyName()

This method calls getPropertyName().

Specified by:
getAttributePath in interface AttributeExpression
Returns:
the attribute to be queried.

getPropertyName

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

Specified by:
getPropertyName in interface org.opengis.filter.expression.PropertyName
See Also:
{@link org.opengis.filter.expression.PropertyName#getPropertyName()}.

setPropertyName

public void setPropertyName(java.lang.String attPath)
Specified by:
setPropertyName in interface org.opengis.filter.expression.PropertyName

evaluate

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

Specified by:
evaluate in interface Expression
Overrides:
evaluate in class DefaultExpression
Parameters:
feature - Feature from which to extract attribute value.
Returns:
The value of this expression based on the feature.

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 java.lang.Object accept(org.opengis.filter.expression.ExpressionVisitor visitor,
                               java.lang.Object extraData)
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 org.opengis.filter.expression.Expression
Overrides:
accept in class ExpressionAbstract
Parameters:
visitor - The visitor which requires access to this filter, the method must call visitor.visit(this);


Copyright © GeoTools. All Rights Reserved.