net.sf.jagg.msd
Interface Discriminator<T>

Type Parameters:
T - The type being discriminated.
All Known Implementing Classes:
AbstractDiscriminator, ArrayDiscriminator, BigDecimalDiscriminator, BigIntegerDiscriminator, BooleanDiscriminator, ByteDiscriminator, CalendarDiscriminator, ChainedDiscriminator, CharacterDiscriminator, CharSequenceDiscriminator, ClassDiscriminator, CollectionDiscriminator, DateDiscriminator, DiscriminableDiscriminator, DoubleDiscriminator, EnumDiscriminator, FloatDiscriminator, IntegerDiscriminator, LongDiscriminator, NullDiscriminator, NumberDiscriminator, PortionDiscriminator, PropertiesDiscriminator, RandomAccessListDiscriminator, ShortDiscriminator

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.

Since:
0.5.0
Author:
Randy Gettman

Method Summary
<E> java.util.List<java.util.List<E>>
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

discriminate

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.

Parameters:
elements - A List of elements.
workspace - The MsdWorkspace used in the discrimination process.
Returns:
A List of Lists containing all equivalence classes. Each equivalence class list contains all values that compare equal to each other.

discriminate

<E> java.util.List<java.util.List<E>> 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.

Type Parameters:
E - The type of element that is being discriminated by the type <E>
Parameters:
elements - A List of elements.
extractor - An Extractor that gives labels for each element.
workspace - The MsdWorkspace used in the discrimination process.
Returns:
A List of Lists containing all equivalence classes. Each equivalence class list contains all elements that compare equal to each other.


Copyright © 2010-2013 jAgg Team. All Rights Reserved.