com.stevesoft.pat
Class Pattern

java.lang.Object
  |
  +--com.stevesoft.pat.Pattern
Direct Known Subclasses:
NoPattern, com.stevesoft.pat.Or


public abstract class Pattern
extends java.lang.Object

Class Pattern is the base class on which all the other pattern elements are built.


Field Summary
static char ESC
          The ESC character, the user can provide his own value for the escape character through regex.esc

 
Constructor Summary
Pattern()
           
 
Method Summary
 Pattern add(Pattern p)
          add a Pattern to the singly-linked Pattern chain.
 patInt countMaxChars()
          return maximum number of characters in pattern
 patInt countMinChars()
          return minimum number of characters in pattern
 boolean equals(java.lang.Object o)
           
 Pattern getNext()
          This gets the next element of a Pattern that we wish to match.
 int match(StringLike s, Pthings pt)
          This can be used to perform a match test from within class Pattern.
 int matchAt(StringLike s, int i, Pthings pt)
          This can be used to perform a match test from within class Pattern.
abstract  int matchInternal(int i, Pthings p)
          The interal match function, it must be provided by any class which wishes to extend Pattern.
 patInt maxChars()
          The maximum number of characters which this pattern element can match.
 patInt minChars()
          The minimum number of characters which this pattern element can match.
 int nextMatch(int i, Pthings pt)
          This determines if the remainder of a Pattern matches.
 java.lang.String nextString()
          This is a toString() for the remainder of the Pattern elements after this one.
 void setParent(Pattern p)
          Call this method if you have a pattern element that takes a sub pattern (such as Or), and after you have added a sub pattern to the current pattern element.
abstract  java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

 

Field Detail

ESC

public static final char ESC
The ESC character, the user can provide his own value for the escape character through regex.esc
Constructor Detail

Pattern

public Pattern()
Method Detail

matchInternal

public abstract int matchInternal(int i,
                                  Pthings p)
The interal match function, it must be provided by any class which wishes to extend Pattern.

toString

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

getNext

public Pattern getNext()
This gets the next element of a Pattern that we wish to match. If we are at the end of a subchain of patterns, it will return us to the parent chain.

setParent

public void setParent(Pattern p)
Call this method if you have a pattern element that takes a sub pattern (such as Or), and after you have added a sub pattern to the current pattern element.

nextMatch

public int nextMatch(int i,
                     Pthings pt)
This determines if the remainder of a Pattern matches. Type "return nextMatch" from within matchInternal if the current Pattern matches. Otherwise, return a -1.

nextString

public java.lang.String nextString()
This is a toString() for the remainder of the Pattern elements after this one. use this when overriding toString(). Called from within toString().

match

public int match(StringLike s,
                 Pthings pt)
This can be used to perform a match test from within class Pattern.

matchAt

public int matchAt(StringLike s,
                   int i,
                   Pthings pt)
This can be used to perform a match test from within class Pattern.

add

public Pattern add(Pattern p)
add a Pattern to the singly-linked Pattern chain.

minChars

public patInt minChars()
The minimum number of characters which this pattern element can match.

maxChars

public patInt maxChars()
The maximum number of characters which this pattern element can match.

countMinChars

public final patInt countMinChars()
return minimum number of characters in pattern

countMaxChars

public final patInt countMaxChars()
return maximum number of characters in pattern

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object