public abstract class TypedSuite
extends java.lang.Object
The match result is cached for better performance.
Modifier | Constructor and Description |
---|---|
protected |
TypedSuite() |
Modifier and Type | Method and Description |
---|---|
protected abstract java.lang.Object |
ambiguity(java.lang.Object arg,
java.lang.Object candidate1,
java.lang.Object candidate2)
This method is called when ambiguity is detected.
|
protected java.lang.Object |
getCandidate(java.lang.Object arg)
The main entry of TypedSuite.
|
protected abstract java.util.List |
getCandidates()
Provides the candidate elements in the suite.
|
protected abstract java.lang.Class |
getType(java.lang.Object candidate)
Get the type of a candidate object.
|
protected abstract java.lang.Object |
not_found(java.lang.Object arg)
This method is called when no matching element is found.
|
protected abstract java.util.List getCandidates()
protected abstract java.lang.Class getType(java.lang.Object candidate)
candidate
- the candidate object.protected abstract java.lang.Object not_found(java.lang.Object arg)
arg
- the object to match.protected abstract java.lang.Object ambiguity(java.lang.Object arg, java.lang.Object candidate1, java.lang.Object candidate2)
arg
- the object to match.candidate1
- the first candidate that matches.candidate2
- the second condidate that matches.protected java.lang.Object getCandidate(java.lang.Object arg)
The internal cache is consulted first, if an matching entry is found, it is returned.
When no entry is found in cache, the candidates are investigated one by one.
not_found(Object)
is called if no matching element is found;
ambiguity(Object, Object, Object)
is called if ambiguity is detected.
The result is finally cached in the internal cache.
arg
- the object to be matched.