Class ExpressionMatcher

java.lang.Object
games.stendhal.common.parser.ExpressionMatcher
Direct Known Subclasses:
CaseInsensitiveExprMatcher, ExactExprMatcher, JokerExprMatcher, SimilarExprMatcher

public class ExpressionMatcher extends Object
ExpressionMatcher is used to compare Expression in various matching modes.
Author:
Martin Fuchs
  • Field Details

    • PM_SEPARATOR

      public static final String PM_SEPARATOR
      See Also:
      Constant Field Values
    • typeMatching

      protected boolean typeMatching
      Flag to enable type string matching.
    • exactMatching

      protected boolean exactMatching
      Flag to enforce exact expression matching.
    • similarMatching

      protected boolean similarMatching
      Flag to use similarity matching.
    • caseInsensitive

      protected boolean caseInsensitive
      Flag to enable case insensitive matching.
    • jokerMatching

      protected boolean jokerMatching
      Flag 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

      public String readMatchingFlags(String text)
      Read leading matching flags from the given text string and return the remaining text.
      Parameters:
      text -
      Returns:
      text without leading flags
    • match

      public boolean match(Expression expr1, Expression expr2)
      Match two Expressions using the mode in matchingFlags.
      Parameters:
      expr1 -
      expr2 -
      Returns:
      true if two expression match
    • equals

      public boolean equals(Object other)
      Check for equality of two ExpressionMatcher objects.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Returns a hash code for this ExpressionMatcher object.
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Return a simple string representation.
      Overrides:
      toString in class Object