org.geotools.filter.text.commons
Class AbstractFilterBuilder

java.lang.Object
  extended by org.geotools.filter.text.commons.AbstractFilterBuilder

public abstract class AbstractFilterBuilder
extends java.lang.Object

This abstract class provides the common behavior to build the filters for the related semantic actions of parsing language process.

Builds Filter or Expression and their components (literal, functions, etc). It maintains the results of semantic actions in the stack used to build complex filters and expressions.

Warning: This component is not published. It is part of module implementation. Client module should not use this feature.

Since:
2.6
Author:
Mauricio Pazos (Axios Engineering)

Field Summary
protected  java.lang.String cqlSource
           
 
Constructor Summary
AbstractFilterBuilder(java.lang.String cqlSource, org.opengis.filter.FilterFactory filterFactory)
          New instance of FilterBuilder
 
Method Summary
 org.opengis.filter.expression.BinaryExpression buildAddExpression()
           
 org.opengis.filter.Filter buildAndFilter()
           
 org.opengis.filter.spatial.BBOX buildBBox()
           
 org.opengis.filter.spatial.BBOX buildBBoxWithCRS()
           
 org.opengis.filter.PropertyIsBetween buildBetween()
          builds PropertyIsBetween filter
 org.opengis.filter.expression.PropertyName buildCompoundAttribute(int nodeSimpleAttr, java.lang.String nodeAttrSeparator)
           
 org.opengis.filter.expression.Literal buildDateTimeExpression(IToken token)
          Creates a literal with date time
 org.opengis.filter.expression.Literal buildDistanceUnit(IToken token)
           
 org.opengis.filter.expression.BinaryExpression buildDivideExpression()
           
 org.opengis.filter.expression.Literal buildDurationExpression(IToken token)
          Create an integer literal with duration value.
 org.opengis.filter.expression.Literal buildEnvelop(IToken token)
          Return the Envelop
 org.opengis.filter.PropertyIsEqualTo buildEquals()
           
 org.opengis.filter.expression.Literal buildFalseLiteral()
           
 org.opengis.filter.expression.Function buildFunction(int functionNode)
          Builds a function expression
 org.opengis.filter.expression.Literal buildGeometry(IToken geometry)
          Builds geometry
 org.opengis.filter.PropertyIsGreaterThan buildGreater()
           
 org.opengis.filter.PropertyIsGreaterThanOrEqualTo buildGreaterOrEqual()
           
 java.lang.String buildIdentifier(int nodeIdentifier)
           
 java.lang.String buildIdentifierPart(IToken token)
          Creates the identifier part.
 org.opengis.filter.PropertyIsLessThan buildLess()
           
 org.opengis.filter.PropertyIsLessThanOrEqualTo buildLessOrEqual()
           
 org.opengis.filter.PropertyIsLike buildLikeFilter()
          Bulds a like filter
 org.opengis.filter.expression.Literal buildLiteralDouble(java.lang.String tokenImage)
           
 org.opengis.filter.expression.Literal buildLiteralInteger(java.lang.String image)
           
 org.opengis.filter.expression.Literal buildLiteralString(java.lang.String tokenImage)
           
 org.opengis.filter.expression.BinaryExpression buildMultiplyExpression()
           
 org.opengis.filter.Not buildNotBetween()
           
 org.opengis.filter.Filter buildNotFilter()
           
 org.opengis.filter.Not buildNotFilter(org.opengis.filter.Filter eq)
           
 org.opengis.filter.Not buildNotLikeFilter()
           
 org.opengis.filter.Filter buildOrFilter()
           
 PeriodNode buildPeriodBetweenDates()
          builds a PeriodNode (date1,date2)
 PeriodNode buildPeriodDateAndDuration()
          builds a Period with (date,duration)
 PeriodNode buildPeriodDurationAndDate()
          builds a Period Node with (duration,date).
 org.opengis.filter.Not buildPorpertyNotIsNull()
           
 org.opengis.filter.And buildPropertyBetweenDates()
          Create an AND filter with property between dates of period.
 org.opengis.filter.PropertyIsEqualTo buildPropertyExists()
          Creates PropertyIsEqualTo with PropertyExists predicate
 org.opengis.filter.PropertyIsGreaterThanOrEqualTo buildPropertyIsGTEFirstDate()
          Builds PropertyIsGreaterThanOrEqualTo begin of period
 org.opengis.filter.PropertyIsGreaterThan buildPropertyIsGTLastDate()
          creates PropertyIsGreaterThan end date of period
 org.opengis.filter.PropertyIsLessThanOrEqualTo buildPropertyIsLTELastDate()
           
 org.opengis.filter.PropertyIsLessThan buildPropertyIsLTFirsDate()
           
 org.opengis.filter.PropertyIsNull buildPropertyIsNull()
          Builds property is null filter
 org.opengis.filter.expression.PropertyName buildSimpleAttribute()
           
 org.opengis.filter.spatial.DistanceBufferOperator buildSpatialBeyondFilter()
           
 org.opengis.filter.spatial.BinarySpatialOperator buildSpatialContainsFilter()
           
 org.opengis.filter.spatial.BinarySpatialOperator buildSpatialCrossesFilter()
           
 org.opengis.filter.spatial.BinarySpatialOperator buildSpatialDisjointFilter()
           
 org.opengis.filter.spatial.DistanceBufferOperator buildSpatialDWithinFilter()
           
 org.opengis.filter.spatial.BinarySpatialOperator buildSpatialEqualFilter()
           
 org.opengis.filter.spatial.BinarySpatialOperator buildSpatialIntersectsFilter()
           
 org.opengis.filter.spatial.BinarySpatialOperator buildSpatialOverlapsFilter()
           
 org.opengis.filter.spatial.BinarySpatialOperator buildSpatialTouchesFilter()
           
 org.opengis.filter.spatial.BinarySpatialOperator buildSpatialWithinFilter()
           
 org.opengis.filter.expression.BinaryExpression buildSubtractExression()
           
 org.opengis.filter.expression.Literal buildTolerance()
           
 org.opengis.filter.expression.Literal buildTrueLiteral()
           
 org.opengis.filter.expression.Expression getExpression()
           
 org.opengis.filter.Filter getFilter()
           
protected  org.opengis.filter.FilterFactory getFilterFactory()
           
 java.util.List<org.opengis.filter.Filter> getFilterList()
           
protected  BuildResultStack getResultStack()
           
protected  java.lang.String getStatement()
           
 Result peekResult()
           
 void pushResult(Result result)
          Adds in the result stack the partial result associated to node.
protected  java.lang.String removeQuotes(java.lang.String source)
          Removes initial and final "'" from string.
protected  java.lang.String scanExpression(IToken initialToken)
          Extracts expression between initial token and last token in buffer.
protected  java.lang.String transformWKTGeometry(java.lang.String wktGeom)
          This transformation is required because some geometries like Multipoint has different definition in vividsolucion library.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cqlSource

protected final java.lang.String cqlSource
Constructor Detail

AbstractFilterBuilder

public AbstractFilterBuilder(java.lang.String cqlSource,
                             org.opengis.filter.FilterFactory filterFactory)
New instance of FilterBuilder

Parameters:
cqlSource -
filterFactory -
Method Detail

getFilterFactory

protected org.opengis.filter.FilterFactory getFilterFactory()

getResultStack

protected final BuildResultStack getResultStack()

getStatement

protected final java.lang.String getStatement()

getFilter

public org.opengis.filter.Filter getFilter()
                                    throws CQLException
Throws:
CQLException

getExpression

public org.opengis.filter.expression.Expression getExpression()
                                                       throws CQLException
Throws:
CQLException

getFilterList

public java.util.List<org.opengis.filter.Filter> getFilterList()
                                                        throws CQLException
Throws:
CQLException

buildAddExpression

public org.opengis.filter.expression.BinaryExpression buildAddExpression()
                                                                  throws CQLException
Throws:
CQLException

buildSubtractExression

public org.opengis.filter.expression.BinaryExpression buildSubtractExression()
                                                                      throws CQLException
Throws:
CQLException

buildMultiplyExpression

public org.opengis.filter.expression.BinaryExpression buildMultiplyExpression()
                                                                       throws CQLException
Throws:
CQLException

buildDivideExpression

public org.opengis.filter.expression.BinaryExpression buildDivideExpression()
                                                                     throws CQLException
Throws:
CQLException

buildAndFilter

public org.opengis.filter.Filter buildAndFilter()
                                         throws CQLException
Throws:
CQLException

buildOrFilter

public org.opengis.filter.Filter buildOrFilter()
                                        throws CQLException
Throws:
CQLException

buildNotFilter

public org.opengis.filter.Filter buildNotFilter()
                                         throws CQLException
Throws:
CQLException

buildLikeFilter

public org.opengis.filter.PropertyIsLike buildLikeFilter()
                                                  throws CQLException
Bulds a like filter

Returns:
a PropertyIsLike
Throws:
CQLException

buildPropertyIsNull

public org.opengis.filter.PropertyIsNull buildPropertyIsNull()
                                                      throws CQLException
Builds property is null filter

Returns:
PropertyIsNull
Throws:
CQLException

buildPorpertyNotIsNull

public org.opengis.filter.Not buildPorpertyNotIsNull()
                                              throws CQLException
Throws:
CQLException

buildBetween

public org.opengis.filter.PropertyIsBetween buildBetween()
                                                  throws CQLException
builds PropertyIsBetween filter

Returns:
PropertyIsBetween
Throws:
CQLException

buildNotBetween

public org.opengis.filter.Not buildNotBetween()
                                       throws CQLException
Throws:
CQLException

buildNotLikeFilter

public org.opengis.filter.Not buildNotLikeFilter()
                                          throws CQLException
Throws:
CQLException

buildPropertyExists

public org.opengis.filter.PropertyIsEqualTo buildPropertyExists()
                                                         throws CQLException
Creates PropertyIsEqualTo with PropertyExists predicate

Returns:
PropertyIsEqualTo
Throws:
CQLException

buildDateTimeExpression

public org.opengis.filter.expression.Literal buildDateTimeExpression(IToken token)
                                                              throws CQLException
Creates a literal with date time

Parameters:
n - with date time
Returns:
Literal
Throws:
CQLException

buildNotFilter

public org.opengis.filter.Not buildNotFilter(org.opengis.filter.Filter eq)

buildTrueLiteral

public org.opengis.filter.expression.Literal buildTrueLiteral()

buildFalseLiteral

public org.opengis.filter.expression.Literal buildFalseLiteral()

buildLiteralInteger

public org.opengis.filter.expression.Literal buildLiteralInteger(java.lang.String image)

buildLiteralDouble

public org.opengis.filter.expression.Literal buildLiteralDouble(java.lang.String tokenImage)

buildLiteralString

public org.opengis.filter.expression.Literal buildLiteralString(java.lang.String tokenImage)

removeQuotes

protected java.lang.String removeQuotes(java.lang.String source)
Removes initial and final "'" from string. If some "''" is found it will be changed by a single quote "'".

Parameters:
source -
Returns:
string without initial and final quote, and "''" replaced by "'".

buildIdentifier

public java.lang.String buildIdentifier(int nodeIdentifier)
                                 throws CQLException
Throws:
CQLException

buildIdentifierPart

public java.lang.String buildIdentifierPart(IToken token)
Creates the identifier part. An identifier like "idpart1:idpart2:idpart3: ... idpartN" has N part.

Returns:
identifier part

buildSimpleAttribute

public org.opengis.filter.expression.PropertyName buildSimpleAttribute()
                                                                throws CQLException
Throws:
CQLException

buildCompoundAttribute

public org.opengis.filter.expression.PropertyName buildCompoundAttribute(int nodeSimpleAttr,
                                                                         java.lang.String nodeAttrSeparator)
                                                                  throws CQLException
Parameters:
nodeSimpleAttr -
nodeAttrSeparator -
Returns:
PropertyName
Throws:
CQLException

buildDistanceUnit

public org.opengis.filter.expression.Literal buildDistanceUnit(IToken token)
                                                        throws CQLException
Throws:
CQLException

buildTolerance

public org.opengis.filter.expression.Literal buildTolerance()
                                                     throws CQLException
Throws:
CQLException

buildSpatialEqualFilter

public org.opengis.filter.spatial.BinarySpatialOperator buildSpatialEqualFilter()
                                                                         throws CQLException
Throws:
CQLException

buildSpatialDisjointFilter

public org.opengis.filter.spatial.BinarySpatialOperator buildSpatialDisjointFilter()
                                                                            throws CQLException
Throws:
CQLException

buildSpatialIntersectsFilter

public org.opengis.filter.spatial.BinarySpatialOperator buildSpatialIntersectsFilter()
                                                                              throws CQLException
Throws:
CQLException

buildSpatialTouchesFilter

public org.opengis.filter.spatial.BinarySpatialOperator buildSpatialTouchesFilter()
                                                                           throws CQLException
Throws:
CQLException

buildSpatialCrossesFilter

public org.opengis.filter.spatial.BinarySpatialOperator buildSpatialCrossesFilter()
                                                                           throws CQLException
Throws:
CQLException

buildSpatialWithinFilter

public org.opengis.filter.spatial.BinarySpatialOperator buildSpatialWithinFilter()
                                                                          throws CQLException
Throws:
CQLException

buildSpatialContainsFilter

public org.opengis.filter.spatial.BinarySpatialOperator buildSpatialContainsFilter()
                                                                            throws CQLException
Throws:
CQLException

buildSpatialOverlapsFilter

public org.opengis.filter.spatial.BinarySpatialOperator buildSpatialOverlapsFilter()
                                                                            throws CQLException
Throws:
CQLException

buildBBox

public org.opengis.filter.spatial.BBOX buildBBox()
                                          throws CQLException
Throws:
CQLException

buildBBoxWithCRS

public org.opengis.filter.spatial.BBOX buildBBoxWithCRS()
                                                 throws CQLException
Throws:
CQLException

buildSpatialDWithinFilter

public org.opengis.filter.spatial.DistanceBufferOperator buildSpatialDWithinFilter()
                                                                            throws CQLException
Throws:
CQLException

buildSpatialBeyondFilter

public org.opengis.filter.spatial.DistanceBufferOperator buildSpatialBeyondFilter()
                                                                           throws CQLException
Throws:
CQLException

buildPeriodBetweenDates

public PeriodNode buildPeriodBetweenDates()
                                   throws CQLException
builds a PeriodNode (date1,date2)

Returns:
PeriodNode
Throws:
CQLException

buildPeriodDurationAndDate

public PeriodNode buildPeriodDurationAndDate()
                                      throws CQLException
builds a Period Node with (duration,date).

Returns:
PeriodNode
Throws:
CQLException

buildPeriodDateAndDuration

public PeriodNode buildPeriodDateAndDuration()
                                      throws CQLException
builds a Period with (date,duration)

Returns:
PeriodNode
Throws:
CQLException

buildDurationExpression

public org.opengis.filter.expression.Literal buildDurationExpression(IToken token)
Create an integer literal with duration value.

Returns:
Literal

buildPropertyBetweenDates

public org.opengis.filter.And buildPropertyBetweenDates()
                                                 throws CQLException
Create an AND filter with property between dates of period. (firstDate<= property <= lastDate)

Returns:
And filter
Throws:
CQLException

buildPropertyIsGTEFirstDate

public org.opengis.filter.PropertyIsGreaterThanOrEqualTo buildPropertyIsGTEFirstDate()
                                                                              throws CQLException
Builds PropertyIsGreaterThanOrEqualTo begin of period

Returns:
PropertyIsGreaterThanOrEqualTo
Throws:
CQLException

buildPropertyIsGTLastDate

public org.opengis.filter.PropertyIsGreaterThan buildPropertyIsGTLastDate()
                                                                   throws CQLException
creates PropertyIsGreaterThan end date of period

Returns:
PropertyIsGreaterThan
Throws:
CQLException

buildPropertyIsLTFirsDate

public org.opengis.filter.PropertyIsLessThan buildPropertyIsLTFirsDate()
                                                                throws CQLException
Returns:
PropertyIsLessThan
Throws:
CQLException

buildPropertyIsLTELastDate

public org.opengis.filter.PropertyIsLessThanOrEqualTo buildPropertyIsLTELastDate()
                                                                          throws CQLException
Returns:
PropertyIsLessThanOrEqualTo
Throws:
CQLException

buildEquals

public org.opengis.filter.PropertyIsEqualTo buildEquals()
                                                 throws CQLException
Returns:
PropertyIsEqualTo
Throws:
CQLException

buildGreater

public org.opengis.filter.PropertyIsGreaterThan buildGreater()
                                                      throws CQLException
Returns:
PropertyIsGreaterThan
Throws:
CQLException

buildLess

public org.opengis.filter.PropertyIsLessThan buildLess()
                                                throws CQLException
Returns:
PropertyIsLessThan
Throws:
CQLException

buildGreaterOrEqual

public org.opengis.filter.PropertyIsGreaterThanOrEqualTo buildGreaterOrEqual()
                                                                      throws CQLException
Returns:
PropertyIsGreaterThanOrEqualTo
Throws:
CQLException

buildLessOrEqual

public org.opengis.filter.PropertyIsLessThanOrEqualTo buildLessOrEqual()
                                                                throws CQLException
Returns:
PropertyIsLessThanOrEqualTo
Throws:
CQLException

buildGeometry

public org.opengis.filter.expression.Literal buildGeometry(IToken geometry)
                                                    throws CQLException
Builds geometry

Parameters:
geometry -
Returns:
a geometry
Throws:
CQLException

scanExpression

protected java.lang.String scanExpression(IToken initialToken)
Extracts expression between initial token and last token in buffer.

Parameters:
initialToken -
Returns:
String the expression

transformWKTGeometry

protected java.lang.String transformWKTGeometry(java.lang.String wktGeom)
This transformation is required because some geometries like Multipoint has different definition in vividsolucion library.

 Then OGC require MULTIPOINT((1 2), (3 4))
 but vividsolunion works without point "(" ans ")"
 MULTIPOINT(1 2, 3 4)
 

Parameters:
wktGeom - ogc wkt geometry
Returns:
String vividsolution geometry

buildEnvelop

public org.opengis.filter.expression.Literal buildEnvelop(IToken token)
Return the Envelop

Parameters:
token -
Returns:
Literal

buildFunction

public org.opengis.filter.expression.Function buildFunction(int functionNode)
                                                     throws CQLException
Builds a function expression

Parameters:
functionNode - symbol used to identify the function node in parser tree
Returns:
Function
Throws:
CQLException

pushResult

public void pushResult(Result result)
Adds in the result stack the partial result associated to node.

Parameters:
built - partial result
token -
type - node associated to partial result

peekResult

public Result peekResult()


Copyright © 1996-2010 Geotools. All Rights Reserved.