psdi.common.parse

Class Matches

  • java.lang.Object
    • psdi.common.parse.Matches
  • Direct Known Subclasses:
    AnyMatch, MatchEnd, SingleMatch


    public class Matches
    extends java.lang.Object
    Class used by the LikeNode to compare the pattern to the operand. A data structure similar to a state machine is created to compare the operand to the pattern. This seems like a clunky and brute-force way to do this, but it works and is easily understandable.
    • Constructor Summary

      Constructors 
      Constructor and Description
      Matches(char matchChar, Matches nextNode) 
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      static boolean doesMatch(java.lang.String pattern, java.lang.String operand)
      Main method determines whether the operand matches the pattern given.
      protected boolean matches(char[] operand, int cursorPos)
      Evaluates the operand at the position given for this node.
      java.lang.String toString() 
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Matches

        public Matches(char matchChar,
                       Matches nextNode)
    • Method Detail

      • doesMatch

        public static final boolean doesMatch(java.lang.String pattern,
                                              java.lang.String operand)
        Main method determines whether the operand matches the pattern given.
        Parameters:
        pattern - The pattern may have wildcards "%" and "_".
        operand - The operand is compared to the pattern.
        Returns:
        true if the operand satisfies the pattern.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object