ix.util.match
Class SimpleMatcher
java.lang.Object
ix.util.match.SimpleMatcher
public final class SimpleMatcher
- extends java.lang.Object
A simple pattern-matcher.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
emptyEnv
public static final MatchEnv emptyEnv
- emptyEnv is used to return non-null without allocating an env.
REST
public static final Symbol REST
OPTIONAL
public static final Symbol OPTIONAL
SimpleMatcher
public SimpleMatcher()
mustMatch
public static final MatchEnv mustMatch(java.lang.Object pat,
java.lang.Object dat)
mustMatch
public static final MatchEnv mustMatch(java.lang.Object pat,
java.lang.Object dat,
MatchEnv env)
matchAnyPattern
public static final MatchEnv matchAnyPattern(java.util.List patterns,
java.lang.Object data)
matchAnyValue
public static final MatchEnv matchAnyValue(java.lang.Object pat,
java.util.List dataValues)
match
public static final MatchEnv match(java.lang.Object pat,
java.lang.Object dat)
- Match tries to match a pattern against an object.
Only ItemVars are treated as variables, and even then only if
they appear in the pattern. Otherwise, they are treated as data.
If a variable appears more than once in a pattern, the objects
it matches must be equal.
Numbers are compared using equal.
- Returns:
- a MatchEnv or null.
- See Also:
MatchEnv
,
ItemVar
match
public static final MatchEnv match(java.lang.Object pat,
java.lang.Object dat,
MatchEnv env)
main
public static void main(java.lang.String[] argv)