Class TokenReplacedStream.Pattern

  • Enclosing class:
    TokenReplacedStream

    public static class TokenReplacedStream.Pattern
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Pattern​(java.lang.String s, java.lang.String replace)
      Construct a pattern and its replacement.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isMatched()
      Is this pattern matched fully?
      int match​(char c)
      Match the given character with the current cursor and advance the matching length.
      java.lang.String replace()
      Gets the string to be replaced.
      void reset()
      Reset the cursor.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • Pattern

        public Pattern​(java.lang.String s,
                       java.lang.String replace)
        Construct a pattern and its replacement.
    • Method Detail

      • match

        public int match​(char c)
        Match the given character with the current cursor and advance the matching length.
        Parameters:
        c -
        Returns:
        the matching length. -1 denotes the pattern did not match the character.
      • reset

        public void reset()
        Reset the cursor. Subsequent matching will begin at start.
      • isMatched

        public boolean isMatched()
        Is this pattern matched fully? A pattern is fully matched when the matching length is equal to the length of the pattern string.
      • replace

        public java.lang.String replace()
        Gets the string to be replaced.
      • toString

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