Class PatternExtractor


  • public class PatternExtractor
    extends java.lang.Object
    Extract a pattern from a line of symbols. A pattern consists of a sequence of friendly and unoccupied positions.
    • Constructor Summary

      Constructors 
      Constructor Description
      PatternExtractor​(java.lang.CharSequence line)
      Constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected int getEndPosition​(java.lang.CharSequence line, char opponentSymb, int pos, int extremePos, int direction)
      March in the direction specified until we hit 2 blanks, an opponent piece, or the end of the line.
      protected java.lang.CharSequence getPattern​(char opponentSymb, int pos, int minpos, int maxpos)
      Given the opponent symbol, find the pattern in the specified potion of the line.
      • Methods inherited from class java.lang.Object

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

      • PatternExtractor

        public PatternExtractor​(java.lang.CharSequence line)
        Constructor
        Parameters:
        line - the line to extract patterns from.
    • Method Detail

      • getPattern

        protected java.lang.CharSequence getPattern​(char opponentSymb,
                                                    int pos,
                                                    int minpos,
                                                    int maxpos)
        Given the opponent symbol, find the pattern in the specified potion of the line.
      • getEndPosition

        protected int getEndPosition​(java.lang.CharSequence line,
                                     char opponentSymb,
                                     int pos,
                                     int extremePos,
                                     int direction)
        March in the direction specified until we hit 2 blanks, an opponent piece, or the end of the line.
        Returns:
        end position