|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.planx.msd.util.AbstractDiscriminator<T>
org.planx.msd.lang.RecursionDiscriminator<T>
public class RecursionDiscriminator<T>
A Discriminator that enables discrimination of recursive
datatypes.
To do this, first create an instance of RecursionDiscriminator.
Then, define the discriminator for the datatype by using this instance as a
discriminator symbolizing the point where recursion is desired, i.e.
where the whole discriminator expression is to be repeated. Finally,
when the discriminator has been defined, use setRecursion(org.planx.msd.Discriminator
with the discriminator as argument to complete the
RecursionDiscriminator.
In practice, for the recursion to be finite the most common case is
to use a PolymorphicDiscriminator that chooses between
the RecursionDiscriminator and some non-recursive
discriminator based on the input.
| Constructor Summary | |
|---|---|
RecursionDiscriminator()
Creates a new uninitialized RecursionDiscriminator. |
|
| Method Summary | ||
|---|---|---|
|
discriminate(List<? extends U> values,
Extractor<U,? extends T,S> e)
Discriminates a List of values using an Extractor,
and returns a Collection of Lists, each
representing an equivalence class containing elements from
values that are equivalent. |
|
void |
setRecursion(Discriminator<T> d)
Initialize the recursive discriminator. |
|
| Methods inherited from class org.planx.msd.util.AbstractDiscriminator |
|---|
discriminate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RecursionDiscriminator()
RecursionDiscriminator.
The discriminator can be used as a recursion token and must be
initialized by setRecursion(org.planx.msd.Discriminator) before use.
| Method Detail |
|---|
public void setRecursion(Discriminator<T> d)
RecursionDiscriminator.
public <U,S> Collection<List<S>> discriminate(List<? extends U> values,
Extractor<U,? extends T,S> e)
DiscriminatorList of values using an Extractor,
and returns a Collection of Lists, each
representing an equivalence class containing elements from
values that are equivalent.
The Extractor performs the task of extracting two kinds
of objects from the input values: The label which
is the object equivalence is defined upon, and the value which
is the object that will be returned. That is, the label
determines which equivalence class the value goes into.
The Collection of Lists returned should be
considered unmodifiable (though, in some cases they might actually be
modifiable, but this behaviour should not be relied upon).
discriminate in interface Discriminator<T>discriminate in class AbstractDiscriminator<T>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||