|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ix.util.match.MatchCase
public abstract class MatchCase
The root class for entries in MatchTables.
If you think of a MatchTable as analogous to a case statement, a MatchCase is analogous to a single case clause, with the MatchCase's ifSelected method containing the code that is executed in the body of that clause.
A MatchCase normally contains a pattern that can be examined by the MatchTable that contains the MatchCase. The MatchCase's tryMatch method normally implements a match against that pattern.
If the MatchCase is used as a MatchTable default, the pattern and the tryMatch method are ignored.
MatchTable
,
MatchEnv
Field Summary | |
---|---|
protected java.lang.Object |
pattern
An object to match against. |
Constructor Summary | |
---|---|
MatchCase()
|
Method Summary | |
---|---|
java.lang.Object |
getPattern()
getPattern returns this MatchCase's pattern. |
java.lang.Object |
ifSelected(java.lang.Object data,
java.lang.Object matchResult)
ifSelected is called by the MatchTable when tryMatch returns a non-null result. |
abstract java.lang.Object |
tryMatch(java.lang.Object data)
tryMatch attempts to match against the pattern, returning null if the match fails and some non-null object (such as a MatchEnv) if the match succeeds. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.Object pattern
Constructor Detail |
---|
public MatchCase()
Method Detail |
---|
public java.lang.Object getPattern()
public abstract java.lang.Object tryMatch(java.lang.Object data)
public java.lang.Object ifSelected(java.lang.Object data, java.lang.Object matchResult)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |