Package org.apache.sis.filter
Class LikeFilter<R>
java.lang.Object
org.apache.sis.internal.filter.Node
org.apache.sis.filter.FilterNode<R>
org.apache.sis.filter.LikeFilter<R>
- Type Parameters:
R- the type of resources (e.g.Feature) used as inputs.
- All Implemented Interfaces:
Serializable,Predicate<R>,Filter<R>,Optimization.OnFilter<R>
A character string comparison operator with pattern matching.
- Since:
- 1.1
- Version:
- 1.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final charThe pattern character for indicating that the next character should be matched literally.private final Expression<? super R,?> The source of values to compare against the pattern.private final booleanSpecifies how a filter expression processor should perform string comparisons.private final StringThe pattern to match against expression values.private final PatternThe regular expression.private static final longFor cross-version compatibility.private final charThe pattern character for matching exactly one character.private final charThe pattern character for matching any sequence of characters. -
Constructor Summary
ConstructorsModifierConstructorDescription(package private)LikeFilter(Expression<? super R, ?> expression, String pattern, char wildcard, char singleChar, char escape, boolean isMatchingCase) Creates a new operator.privateLikeFilter(LikeFilter<R> original, Expression<? super R, ?> expression) Creates a new filter of the same type but different parameters. -
Method Summary
Modifier and TypeMethodDescriptionprotected Collection<?>Returns the children of this node for displaying purposes.charReturns the pattern character for indicating that the next character should be matched literally.List<Expression<? super R,?>> Returns the expression whose values will be compared by this operator, together with the pattern.Returns the nature of the operator.charReturns the pattern character for matching exactly one character.charReturns the pattern character for matching any sequence of characters.booleanSpecifies how a filter expression processor should perform string comparisons.(package private) static booleanisMetaCharacter(char c) Returnstrueif given character is a regular expression meta-character.recreate(Expression<? super R, ?>[] effective) Creates a new filter of the same type but different parameters.booleanReturnstrueif the expression value computed from the given object matches the pattern.Methods inherited from class org.apache.sis.filter.FilterNode
and, negate, orMethods inherited from class org.apache.sis.internal.filter.Node
createName, createType, equals, getGeometryLibrary, hashCode, symbol, toGeometryWrapper, toString, unwrap, warningMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.sis.filter.Optimization.OnFilter
and, negate, optimize, or
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
expression
The source of values to compare against the pattern. -
pattern
The pattern to match against expression values. Thewildcard,singleCharandescapecharacters have special meanings. -
wildcard
private final char wildcardThe pattern character for matching any sequence of characters.- See Also:
-
singleChar
private final char singleCharThe pattern character for matching exactly one character.- See Also:
-
escape
private final char escapeThe pattern character for indicating that the next character should be matched literally.- See Also:
-
isMatchingCase
private final boolean isMatchingCaseSpecifies how a filter expression processor should perform string comparisons.- See Also:
-
regex
The regular expression.
-
-
Constructor Details
-
LikeFilter
LikeFilter(Expression<? super R, ?> expression, String pattern, char wildcard, char singleChar, char escape, boolean isMatchingCase) Creates a new operator.- Parameters:
expression- source of values to compare against the pattern.pattern- pattern to match against expression values.wildcard- pattern character for matching any sequence of characters.singleChar- pattern character for matching exactly one character.escape- pattern character for indicating that the next character should be matched literally.isMatchingCase- specifies how a filter expression processor should perform string comparisons.
-
LikeFilter
Creates a new filter of the same type but different parameters.
-
-
Method Details
-
getOperatorType
Description copied from interface:FilterReturns the nature of the operator.- Specified by:
getOperatorTypein interfaceFilter<R>- Returns:
- the nature of this operator.
-
recreate
Creates a new filter of the same type but different parameters.- Specified by:
recreatein interfaceOptimization.OnFilter<R>- Parameters:
effective- the expressions to use as a replacement of this filter expressions.- Returns:
- the new filter, or
thisif unsupported.
-
getChildren
Returns the children of this node for displaying purposes. This is used byNode.toString(),Node.hashCode()andNode.equals(Object)implementations.- Specified by:
getChildrenin classNode- Returns:
- the children of this node, or an empty collection if none.
-
getExpressions
Returns the expression whose values will be compared by this operator, together with the pattern.- Specified by:
getExpressionsin interfaceFilter<R>- Returns:
- the expressions used as inputs, or an empty list if none.
-
getWildCard
public char getWildCard()Returns the pattern character for matching any sequence of characters. For the SQL "LIKE" operator, this property is the%character. -
getSingleChar
public char getSingleChar()Returns the pattern character for matching exactly one character. For the SQL "LIKE" operator, this property is the_character. -
getEscapeChar
public char getEscapeChar()Returns the pattern character for indicating that the next character should be matched literally. For the SQL "LIKE" operator, this property is the'character. -
isMatchingCase
public boolean isMatchingCase()Specifies how a filter expression processor should perform string comparisons. -
test
Returnstrueif the expression value computed from the given object matches the pattern. -
isMetaCharacter
static boolean isMetaCharacter(char c) Returnstrueif given character is a regular expression meta-character.
-