C - the type of the constraint associated with the pattern.T - the type of the value constrained by the pattern.public abstract class LeafPattern<T,C extends Constraint<? super T>> extends AbstractPattern
| Modifier and Type | Field and Description |
|---|---|
protected C |
constraint |
| Constructor and Description |
|---|
LeafPattern(C c)
Creates and instance with a given constraint.
|
| Modifier and Type | Method and Description |
|---|---|
C |
constraint() |
boolean |
equals(Object obj) |
int |
hashCode() |
boolean |
matches(Node n)
Indicates whether a node matches a pattern.
|
abstract String |
name()
Returns the name of the pattern.
|
void |
prune(Node n)
Prunes a node of all the descendants that are not required to match the pattern.
|
String |
toString() |
protected abstract T |
valueOf(String s)
Returns the typed equivalent of a leaf's value.
|
idPattern, setIdPatternprotected C extends Constraint<? super T> constraint
public LeafPattern(C c)
c - the constraintpublic final void prune(Node n) throws Exception
prune in interface Patternprune in class AbstractPatternn - the node.Exception - if the node does not match the pattern.public C constraint()
public boolean matches(Node n)
matches in interface Patternmatches in class AbstractPatternn - the node.true if it does, false otherwise.protected abstract T valueOf(String s) throws Exception
s - the valueExceptionpublic abstract String name()
public int hashCode()
hashCode in class AbstractPatternpublic boolean equals(Object obj)
equals in class AbstractPatternCopyright © 2017. All Rights Reserved.