Package games.stendhal.common.parser
Class ExpressionMatcher
java.lang.Object
games.stendhal.common.parser.ExpressionMatcher
- Direct Known Subclasses:
CaseInsensitiveExprMatcher
,ExactExprMatcher
,JokerExprMatcher
,SimilarExprMatcher
ExpressionMatcher is used to compare Expression in various matching modes.
- Author:
- Martin Fuchs
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
Flag to enable case insensitive matching.protected boolean
Flag to enforce exact expression matching.protected boolean
Flag to enable joker matching.static String
protected boolean
Flag to use similarity matching.protected boolean
Flag to enable type string matching. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Reset all matching flags.boolean
Check for equality of two ExpressionMatcher objects.boolean
boolean
protected boolean
int
hashCode()
Returns a hash code for this ExpressionMatcher object.boolean
boolean
boolean
isEmpty()
boolean
boolean
match(Expression expr1, Expression expr2)
Match two Expressions using the mode in matchingFlags.readMatchingFlags(String text)
Read leading matching flags from the given text string and return the remaining text.void
setCaseInsensitive(boolean caseInsensitive)
void
setExactMatching(boolean exactMatching)
void
setJokerMatching(boolean jokerMatching)
void
setSimilarMatching(boolean similarMatching)
protected void
setTypeMatching(boolean typeMatching)
toString()
Return a simple string representation.
-
Field Details
-
PM_SEPARATOR
- See Also:
- Constant Field Values
-
typeMatching
protected boolean typeMatchingFlag to enable type string matching. -
exactMatching
protected boolean exactMatchingFlag to enforce exact expression matching. -
similarMatching
protected boolean similarMatchingFlag to use similarity matching. -
caseInsensitive
protected boolean caseInsensitiveFlag to enable case insensitive matching. -
jokerMatching
protected boolean jokerMatchingFlag to enable joker matching.
-
-
Constructor Details
-
ExpressionMatcher
public ExpressionMatcher()
-
-
Method Details
-
clear
public void clear()Reset all matching flags. -
setTypeMatching
protected void setTypeMatching(boolean typeMatching)- Parameters:
typeMatching
- the typeMatching flag to set
-
getTypeMatching
protected boolean getTypeMatching()- Returns:
- the typeMatching flag
-
setExactMatching
public void setExactMatching(boolean exactMatching)- Parameters:
exactMatching
- the exactMatching flag to set
-
getExactMatching
public boolean getExactMatching()- Returns:
- the exactMatching flag
-
setSimilarMatching
public void setSimilarMatching(boolean similarMatching)- Parameters:
similarMatching
- the similarMatching flag to set
-
getSimilarMatching
public boolean getSimilarMatching()- Returns:
- the similarMatching flag
-
setCaseInsensitive
public void setCaseInsensitive(boolean caseInsensitive)- Parameters:
caseInsensitive
- the caseInsensitive flag to set
-
isCaseInsensitive
public boolean isCaseInsensitive()- Returns:
- the caseInsensitive flag
-
isJokerMatching
public boolean isJokerMatching()- Returns:
- the jokerMatching flag
-
setJokerMatching
public void setJokerMatching(boolean jokerMatching)- Parameters:
jokerMatching
- the jokerMatching flag to set
-
isAnyFlagSet
public boolean isAnyFlagSet()- Returns:
- true if any of the available matching flags is set.
-
isEmpty
public boolean isEmpty()- Returns:
- true if none of the available matching flags is set.
-
readMatchingFlags
Read leading matching flags from the given text string and return the remaining text.- Parameters:
text
-- Returns:
- text without leading flags
-
match
Match two Expressions using the mode in matchingFlags.- Parameters:
expr1
-expr2
-- Returns:
- true if two expression match
-
equals
Check for equality of two ExpressionMatcher objects. -
hashCode
public int hashCode()Returns a hash code for this ExpressionMatcher object. -
toString
Return a simple string representation.
-