Class RawSubStringPattern


  • public class RawSubStringPattern
    extends java.lang.Object
    Searches text using only substring search.

    Instances are thread-safe. Multiple concurrent threads may perform matches on different character sequences at the same time.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private byte[] needle  
      private java.lang.String needleString  
    • Constructor Summary

      Constructors 
      Constructor Description
      RawSubStringPattern​(java.lang.String patternText)
      Construct a new substring pattern.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static byte lc​(byte q)  
      int match​(RawCharSequence rcs)
      Match a character sequence against this pattern.
      private static boolean neq​(byte a, byte b)  
      java.lang.String pattern()
      Get the literal pattern string this instance searches for.
      java.lang.String toString()
      • Methods inherited from class java.lang.Object

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

      • needleString

        private final java.lang.String needleString
      • needle

        private final byte[] needle
    • Constructor Detail

      • RawSubStringPattern

        public RawSubStringPattern​(java.lang.String patternText)
        Construct a new substring pattern.
        Parameters:
        patternText - text to locate. This should be a literal string, as no meta-characters are supported by this implementation. The string may not be the empty string.
    • Method Detail

      • match

        public int match​(RawCharSequence rcs)
        Match a character sequence against this pattern.
        Parameters:
        rcs - the sequence to match. Must not be null but the length of the sequence is permitted to be 0.
        Returns:
        offset within rcs of the first occurrence of this pattern; -1 if this pattern does not appear at any position of rcs.
      • neq

        private static final boolean neq​(byte a,
                                         byte b)
      • lc

        private static final byte lc​(byte q)
      • pattern

        public java.lang.String pattern()
        Get the literal pattern string this instance searches for.
        Returns:
        the pattern string given to our constructor.
      • toString

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