public class LikeFilterImpl extends AbstractFilter implements PropertyIsLike
MultiValuedFilter.MatchAction
Modifier and Type | Field and Description |
---|---|
protected MultiValuedFilter.MatchAction |
matchAction
Used to indicate action with multiple values *
|
LOGGER
NAME
ALL, BETWEEN, COMPARE_EQUALS, COMPARE_GREATER_THAN, COMPARE_GREATER_THAN_EQUAL, COMPARE_LESS_THAN, COMPARE_LESS_THAN_EQUAL, COMPARE_NOT_EQUALS, FID, GEOMETRY_BBOX, GEOMETRY_BEYOND, GEOMETRY_CONTAINS, GEOMETRY_CROSSES, GEOMETRY_DISJOINT, GEOMETRY_DWITHIN, GEOMETRY_EQUALS, GEOMETRY_INTERSECTS, GEOMETRY_OVERLAPS, GEOMETRY_TOUCHES, GEOMETRY_WITHIN, LIKE, LOGIC_AND, LOGIC_NOT, LOGIC_OR, NONE, NULL
Modifier | Constructor and Description |
---|---|
protected |
LikeFilterImpl()
Constructor which flags the operator as like.
|
|
LikeFilterImpl(Expression expr,
String pattern,
String wildcardMulti,
String wildcardSingle,
String escape) |
|
LikeFilterImpl(Expression expr,
String pattern,
String wildcardMulti,
String wildcardSingle,
String escape,
MultiValuedFilter.MatchAction matchAction) |
protected |
LikeFilterImpl(MultiValuedFilter.MatchAction matchAction) |
Modifier and Type | Method and Description |
---|---|
Object |
accept(FilterVisitor visitor,
Object extraData)
Used by FilterVisitors to perform some action on this filter instance.
|
static String |
convertToSQL92(char escape,
char multi,
char single,
boolean matchCase,
String pattern)
Given OGC PropertyIsLike Filter information, construct an SQL-compatible 'like' pattern.
|
boolean |
equals(Object obj)
Compares this filter to the specified object.
|
boolean |
evaluate(Object feature)
Determines whether or not a given feature matches this pattern.
|
String |
getEscape()
Getter for property escape.
|
Expression |
getExpression()
Gets the expression for hte filter.
|
String |
getLiteral()
Returns the pattern.
|
MultiValuedFilter.MatchAction |
getMatchAction()
* Flag Controlling MatchAction property When one or more of the operands evaluates to
multiple values rather than a single value, which action should be taken?
|
String |
getPattern()
Deprecated.
use
getLiteral() |
String |
getSingleChar()
THis method calls
getWildcardSingle()() for subclass backwards compatability. |
String |
getSQL92LikePattern()
see convertToSQL92
|
String |
getWildCard()
THis method calls
getWildcardMulti() for subclass backwards compatability. |
String |
getWildcardMulti()
Deprecated.
use
getWildCard() . |
String |
getWildcardSingle()
Deprecated.
use
getSingleChar() |
int |
hashCode()
Override of hashCode method.
|
boolean |
isMatchingCase()
Flag controlling wither comparisons are case sensitive.
|
void |
setEscape(String escape) |
void |
setExpression(Expression e) |
void |
setLiteral(String literal)
Sets the pattern.
|
void |
setMatchCase(boolean matchingCase) |
void |
setMatchingCase(boolean matchingCase) |
void |
setPattern(Expression p,
String wildcardMulti,
String wildcardSingle,
String escape)
Deprecated.
use one of
PropertyIsLike#setExpression(Expression) PropertyIsLike#setWildCard(String) PropertyIsLike#setSingleChar(String) PropertyIsLike#setEscape(String) |
void |
setPattern(String pattern,
String wildcardMulti,
String wildcardSingle,
String escape)
Deprecated.
use one of
PropertyIsLike#setLiteral(String) PropertyIsLike#setWildCard(String) PropertyIsLike#setSingleChar(String) PropertyIsLike#setEscape(String) |
void |
setSingleChar(String singleChar) |
void |
setValue(Expression attribute)
Deprecated.
|
void |
setWildCard(String wildCard) |
String |
toString()
Return this filter as a string.
|
isCompareFilter, isGeometryDistanceFilter, isGeometryFilter, isLogicFilter, isMathFilter, isSimpleFilter
accepts, eval, eval
protected MultiValuedFilter.MatchAction matchAction
protected LikeFilterImpl()
public LikeFilterImpl(Expression expr, String pattern, String wildcardMulti, String wildcardSingle, String escape)
protected LikeFilterImpl(MultiValuedFilter.MatchAction matchAction)
public LikeFilterImpl(Expression expr, String pattern, String wildcardMulti, String wildcardSingle, String escape, MultiValuedFilter.MatchAction matchAction)
public static String convertToSQL92(char escape, char multi, char single, boolean matchCase, String pattern) throws IllegalArgumentException
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).
escape
- multi
- single
- pattern
- IllegalArgumentException
public String getSQL92LikePattern() throws IllegalArgumentException
IllegalArgumentException
public void setWildCard(String wildCard)
public void setSingleChar(String singleChar)
public void setEscape(String escape)
public void setMatchCase(boolean matchingCase)
public boolean isMatchingCase()
PropertyIsLike
The ability to match case is pending the Filter 2.0 specification.
isMatchingCase
in interface PropertyIsLike
true
if the comparison is case sensetive, otherwise false
.public MultiValuedFilter.MatchAction getMatchAction()
MultiValuedFilter
ANY - if any of the possible combinations match, the result is true (aggregated OR) ALL - only if all of the possible combinations match, the result is true (aggregated AND) ONE - only if exactly one of the possible combinations match, the result is true (aggregated XOR)
getMatchAction
in interface MultiValuedFilter
public void setMatchingCase(boolean matchingCase)
public final void setValue(Expression attribute) throws IllegalFilterException
setExpression(org.opengis.filter.expression.Expression)
attribute
- The value of the attribute for comparison.IllegalFilterException
- Filter is illegal.public Expression getExpression()
This method calls th deprecated #getValue()
for backwards compatability with
subclasses.
getExpression
in interface PropertyIsLike
public void setExpression(Expression e)
public final void setPattern(Expression p, String wildcardMulti, String wildcardSingle, String escape)
PropertyIsLike#setExpression(Expression)
PropertyIsLike#setWildCard(String)
PropertyIsLike#setSingleChar(String)
PropertyIsLike#setEscape(String)
p
- the expression which evaluates to the match pattern for this filterwildcardMulti
- the string that represents a mulitple character (1->n) wildcardwildcardSingle
- the string that represents a single character (1) wildcardescape
- the string that represents an escape characterpublic final void setPattern(String pattern, String wildcardMulti, String wildcardSingle, String escape)
PropertyIsLike#setLiteral(String)
PropertyIsLike#setWildCard(String)
PropertyIsLike#setSingleChar(String)
PropertyIsLike#setEscape(String)
pattern
- the string which contains the match pattern for this filterwildcardMulti
- the string that represents a mulitple character (1->n) wildcardwildcardSingle
- the string that represents a single character (1) wildcardescape
- the string that represents an escape characterpublic final String getPattern()
getLiteral()
public String getLiteral()
getLiteral
in interface PropertyIsLike
public void setLiteral(String literal)
public boolean evaluate(Object feature)
public String toString()
public String getEscape()
getEscape
in interface PropertyIsLike
public final String getWildcardMulti()
getWildCard()
.public String getWildCard()
getWildcardMulti()
for subclass backwards compatability.getWildCard
in interface PropertyIsLike
PropertyIsLike.getWildCard().
public final String getWildcardSingle()
getSingleChar()
public String getSingleChar()
getWildcardSingle()()
for subclass backwards compatability.getSingleChar
in interface PropertyIsLike
PropertyIsLike.getSingleChar()().
public boolean equals(Object obj)
public int hashCode()
public Object accept(FilterVisitor visitor, Object extraData)
Copyright © 1996–2019 Geotools. All rights reserved.