|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
T
- The type being discriminated.public interface Discriminator<T>
A Discriminator
is able to distinguish elements of a given
List
of objects of a certain type. It partitions the given
list into a List
of equivalence classes. An
equivalence class is represented by a List
of objects
that compare equal, according to this Discriminator
.
For example, in an unsorted list, one may have different values scattered randomly throughout the list:
{100, 23, 5, 23, 10, 10, 5, 23, 6}
The discrimination process returns a new List
of
Lists
, each list containing an equivalence class. Each
equivalence class list contains all values that compare equal to each other.
They are not necessarily in sorted order. For example, integer
discrimination of the above list yields the following result:
{{100}, {6}, {23, 23, 23}, {5, 5}, {10, 10}}
This algorithm is stable, meaning that values that do compare equal to each other remain in the same order as before, i.e. the first 5 remains before the second 5 in the equivalence class list.
Method Summary | ||
---|---|---|
|
discriminate(java.util.List<E> elements,
Extractor<E,T> extractor,
MsdWorkspace workspace)
Partitions the given List of elements into another
List , in which all of the elements from the given list exist
in the new list, and all elements that compare equal are adjacent to each
other, according to the given Extractor . |
|
java.util.List<java.util.List<T>> |
discriminate(java.util.List<T> elements,
MsdWorkspace workspace)
Partitions the given List of elements into another
List , in which all of the elements from the given list exist
in the new list, and all elements that compare equal are adjacent to each
other. |
Method Detail |
---|
java.util.List<java.util.List<T>> discriminate(java.util.List<T> elements, MsdWorkspace workspace)
List
of elements into another
List
, in which all of the elements from the given list exist
in the new list, and all elements that compare equal are adjacent to each
other.
elements
- A List
of elements.workspace
- The MsdWorkspace
used in the discrimination process.
List
of Lists
containing all
equivalence classes. Each equivalence class list contains all values
that compare equal to each other.<E> java.util.List<java.util.List<E>> discriminate(java.util.List<E> elements, Extractor<E,T> extractor, MsdWorkspace workspace)
List
of elements into another
List
, in which all of the elements from the given list exist
in the new list, and all elements that compare equal are adjacent to each
other, according to the given Extractor
.
E
- The type of element that is being discriminated by the type
<E>elements
- A List
of elements.extractor
- An Extractor
that gives labels for
each element.workspace
- The MsdWorkspace
used in the discrimination process.
List
of Lists
containing all
equivalence classes. Each equivalence class list contains all
elements that compare equal to each other.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |