com.saelist.stx
Class Validator
java.lang.Object
com.saelist.stx.Validator
- public class Validator
- extends java.lang.Object
|
Field Summary |
static Logger |
logger
|
|
Method Summary |
boolean |
matches(java.util.List s,
int is,
java.util.List c,
int ic)
A list of patterns s is matched against a list of
candidates c. |
boolean |
matches(Pair sn,
Pair cn)
Mathces a pattern pair to a candidate pair. |
void |
setSchemaFileName(java.lang.String schemaFileName)
|
void |
setTextFileName(java.lang.String textFileName)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
public static Logger logger
Validator
public Validator()
setTextFileName
public void setTextFileName(java.lang.String textFileName)
setSchemaFileName
public void setSchemaFileName(java.lang.String schemaFileName)
matches
public boolean matches(Pair sn,
Pair cn)
- Mathces a pattern pair to a candidate pair.
Alternate ("|") matches a pair if any of its children matches it.
Another pattern matches a candidate pair if the text of the pattern
pair matches the text of the candidate pair and the children of the
pattern pair match the children of the candidate pair.
BUG: '*' and '?' alternatives do not matched empty lists correctly.
a[ |[ b c* ] ] does not match a[ ] correctly, though it matches a[ b ],
a[ c ], a[ c c ] etc.
a[ b |[ c d* ] ] should match a[ b ] but doesn't.
- Throws:
java.lang.NullPointerException - if either pair is null.
matches
public boolean matches(java.util.List s,
int is,
java.util.List c,
int ic)
- A list of patterns s is matched against a list of
candidates c. For each pattern, min and max specify how often
it must match successive elements of c.
The match succeeds if both lists are empty.
The match fails if the patterns are empty but candidates remain.
The match succeeds if the first pattern matches between min and max
number of successibve nodes in c and the remaining patterns
match the remaining candidates.
Otherwise the match fails.