| java.lang.Object org.geotools.filter.FilterAbstract org.geotools.filter.AbstractFilter org.geotools.filter.AbstractFilterImpl org.geotools.filter.LikeFilterImpl
LikeFilterImpl | public class LikeFilterImpl extends AbstractFilterImpl implements LikeFilter(Code) | | Defines a like filter, which checks to see if an attribute matches a REGEXP.
author: Rob Hranac, Vision for New York version: $Id: LikeFilterImpl.java 24805 2007-03-19 15:15:35Z aaime $ |
Constructor Summary | |
protected | LikeFilterImpl() Constructor which flags the operator as like. |
Method Summary | |
public Object | accept(FilterVisitor visitor, 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. | public static String | convertToSQL92(char escape, char multi, char single, String pattern) Given OGC PropertyIsLike Filter information, construct
an SQL-compatible 'like' pattern.
SQL % --> match any number of characters
_ --> match a single character
NOTE; the SQL command is 'string LIKE pattern [ESCAPE escape-character]'
We could re-define the escape character, but I'm not doing to do that in this code
since some databases will not handle this case.
Method:
1. | public boolean | equals(Object obj) Compares this filter to the specified object. | public boolean | evaluate(Object feature) Determines whether or not a given feature matches this pattern.
Parameters: feature - Specified feature to examine. | public java.lang.String | getEscape() Getter for property escape. | public org.opengis.filter.expression.Expression | getExpression() Gets the expression for hte filter. | public String | getLiteral() Returns the pattern. | final public String | getPattern() Accessor method to retrieve the pattern. | public String | getSQL92LikePattern() | public String | getSingleChar()
THis method calls
#getWildcardSingle()() for subclass backwards
compatability. | final public Expression | getValue() Gets the Value (left hand side) of this filter. | public String | getWildCard()
THis method calls
LikeFilterImpl.getWildcardMulti() for subclass backwards
compatability. | final public String | getWildcardMulti() Getter for property wildcardMulti. | final public String | getWildcardSingle() Getter for property wildcardSingle. | public int | hashCode() Override of hashCode method. | public void | setEscape(String escape) | public void | setExpression(org.opengis.filter.expression.Expression e) | public void | setLiteral(String literal) Sets the pattern. | final public void | setPattern(Expression p, String wildcardMulti, String wildcardSingle, String escape) Sets the match pattern for this FilterLike. | final public void | setPattern(String pattern, String wildcardMulti, String wildcardSingle, String escape) Sets the match pattern for this FilterLike. | public void | setSingleChar(String singleChar) | final public void | setValue(Expression attribute) | public void | setWildCard(String wildCard) | public String | toString() Return this filter as a string. |
LikeFilterImpl | protected LikeFilterImpl()(Code) | | Constructor which flags the operator as like.
|
accept | public Object accept(FilterVisitor visitor, Object extraData)(Code) | | 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.
Parameters: visitor - The visitor which requires access to this filter, themethod must call visitor.visit(this); |
convertToSQL92 | public static String convertToSQL92(char escape, char multi, char single, String pattern) throws IllegalArgumentException(Code) | | Given OGC PropertyIsLike Filter information, construct
an SQL-compatible 'like' pattern.
SQL % --> match any number of characters
_ --> match a single character
NOTE; the SQL command is 'string LIKE pattern [ESCAPE escape-character]'
We could re-define the escape character, but I'm not doing to do that in this code
since some databases will not handle this case.
Method:
1.
Examples: ( escape ='!', multi='*', single='.' )
broadway* -> 'broadway%'
broad_ay -> 'broad_ay'
broadway -> 'broadway'
broadway!* -> 'broadway*' (* has no significance and is escaped)
can't -> 'can''t' ( ' escaped for SQL compliance)
NOTE: we also handle "'" characters as special because they are
end-of-string characters. SQL will convert ' to '' (double single quote).
NOTE: we dont handle "'" as a 'special' character because it would be
too confusing to have a special char as another special char.
Using this will throw an error (IllegalArgumentException).
Parameters: escape - Parameters: multi - Parameters: single - Parameters: pattern - |
equals | public boolean equals(Object obj)(Code) | | 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. &
Parameters: obj - - the object to compare this LikeFilter against. true if specified object is equal to this filter; falseotherwise. |
evaluate | public boolean evaluate(Object feature)(Code) | | Determines whether or not a given feature matches this pattern.
Parameters: feature - Specified feature to examine. Flag confirming whether or not this feature is inside thefilter. |
getExpression | public org.opengis.filter.expression.Expression getExpression()(Code) | | Gets the expression for hte filter.
This method calls th deprecated
LikeFilterImpl.getValue() for backwards
compatability with subclasses.
|
getLiteral | public String getLiteral()(Code) | | Returns the pattern.
|
getSingleChar | public String getSingleChar()(Code) | |
THis method calls
#getWildcardSingle()() for subclass backwards
compatability.
See Also: org.opengis.filter.PropertyIsLike#getSingleChar()(). |
hashCode | public int hashCode()(Code) | | Override of hashCode method.
the hash code for this like filter implementation. |
setExpression | public void setExpression(org.opengis.filter.expression.Expression e)(Code) | | |
setLiteral | public void setLiteral(String literal)(Code) | | Sets the pattern.
|
setPattern | final public void setPattern(Expression p, String wildcardMulti, String wildcardSingle, String escape)(Code) | | Sets the match pattern for this FilterLike.
Parameters: p - the expression which evaluates to the match pattern for thisfilter Parameters: wildcardMulti - the string that represents a mulitple character(1->n) wildcard Parameters: wildcardSingle - the string that represents a single character (1)wildcard Parameters: escape - the string that represents an escape characterPropertyIsLike.setExpression(Expression)PropertyIsLike.setWildCard(String)PropertyIsLike.setSingleChar(String)PropertyIsLike.setEscape(String) |
setPattern | final public void setPattern(String pattern, String wildcardMulti, String wildcardSingle, String escape)(Code) | | Sets the match pattern for this FilterLike.
Parameters: pattern - the string which contains the match pattern for thisfilter Parameters: wildcardMulti - the string that represents a mulitple character(1->n) wildcard Parameters: wildcardSingle - the string that represents a single character (1)wildcard Parameters: escape - the string that represents an escape characterPropertyIsLike.setLiteral(String)PropertyIsLike.setWildCard(String)PropertyIsLike.setSingleChar(String)PropertyIsLike.setEscape(String) |
setSingleChar | public void setSingleChar(String singleChar)(Code) | | |
toString | public String toString()(Code) | | Return this filter as a string.
String representation of this like filter. |
Fields inherited from org.geotools.filter.FilterAbstract | protected org.opengis.filter.FilterFactory factory(Code)(Java Doc)
|
|
|