Class MinLengthCharSequenceMatcher


  • public class MinLengthCharSequenceMatcher
    extends java.lang.Object
    Instances of this class will find sequences of characters that are in the given char set and of a minimum length. Characters a fed one at a time into this object. Adding a char may trigger the discovery of a sequence if the char is a 0 or not in the char set and we already have seen a sequence of included chars at least as long as the minimum length.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean addChar​(int c)
      Adds a character to this sequence matcher.
      boolean endSequence()
      Indicates there are no more contiguous chars to add to this matcher.
      Sequence getSequence()  
      void reset()  
      • Methods inherited from class java.lang.Object

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

      • MinLengthCharSequenceMatcher

        public MinLengthCharSequenceMatcher​(int minimumSequenceLength,
                                            CharSetRecognizer charSet,
                                            int alignment)
    • Method Detail

      • addChar

        public boolean addChar​(int c)
        Adds a character to this sequence matcher.
        Parameters:
        c - the character to add.
        Returns:
        a Sequence if the added char triggered an end of a valid sequence, otherwise null.
      • endSequence

        public boolean endSequence()
        Indicates there are no more contiguous chars to add to this matcher. If a minimum or more number of included chars have been seen before this call, then a sequence is returned.
        Returns:
        a Sequence if there was a sequence of chars >= the min length just before this call.
      • reset

        public void reset()
      • getSequence

        public Sequence getSequence()