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 char
The 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 boolean
Specifies how a filter expression processor should perform string comparisons.private final String
The pattern to match against expression values.private final Pattern
The regular expression.private static final long
For cross-version compatibility.private final char
The pattern character for matching exactly one character.private final char
The 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.private
LikeFilter
(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.char
Returns 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.char
Returns the pattern character for matching exactly one character.char
Returns the pattern character for matching any sequence of characters.boolean
Specifies how a filter expression processor should perform string comparisons.(package private) static boolean
isMetaCharacter
(char c) Returnstrue
if given character is a regular expression meta-character.recreate
(Expression<? super R, ?>[] effective) Creates a new filter of the same type but different parameters.boolean
Returnstrue
if the expression value computed from the given object matches the pattern.Methods inherited from class org.apache.sis.filter.FilterNode
and, negate, or
Methods inherited from class org.apache.sis.internal.filter.Node
createName, createType, equals, getGeometryLibrary, hashCode, symbol, toGeometryWrapper, toString, unwrap, warning
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods 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
,singleChar
andescape
characters 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:Filter
Returns the nature of the operator.- Specified by:
getOperatorType
in interfaceFilter<R>
- Returns:
- the nature of this operator.
-
recreate
Creates a new filter of the same type but different parameters.- Specified by:
recreate
in interfaceOptimization.OnFilter<R>
- Parameters:
effective
- the expressions to use as a replacement of this filter expressions.- Returns:
- the new filter, or
this
if unsupported.
-
getChildren
Returns the children of this node for displaying purposes. This is used byNode.toString()
,Node.hashCode()
andNode.equals(Object)
implementations.- Specified by:
getChildren
in 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:
getExpressions
in 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
Returnstrue
if the expression value computed from the given object matches the pattern. -
isMetaCharacter
static boolean isMetaCharacter(char c) Returnstrue
if given character is a regular expression meta-character.
-