net.sf.jagg.msd
Class PortionDiscriminator<T>
java.lang.Object
net.sf.jagg.msd.AbstractDiscriminator<T>
net.sf.jagg.msd.PortionDiscriminator<T>
- All Implemented Interfaces:
- Discriminator<T>
- Direct Known Subclasses:
- CharacterDiscriminator, CharSequenceDiscriminator, NumberDiscriminator
public abstract class PortionDiscriminator<T>
- extends AbstractDiscriminator<T>
A PortionDiscriminator
is an abstract class that represents
all Discriminators
that need to discriminate in steps, whether
it be characters in a string, elements of an array, or bit portions of a
number.
- 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 . |
protected
<E> java.util.List<java.util.List<E>> |
|
discriminatePortion(java.util.List<E> elements,
PortionExtractor<E,T> extractor,
MsdWorkspace workspace)
Perform multiset discrimination for a portion of the elements. |
protected abstract
|
getPortionExtractor(Extractor<E,T> extractor)
Returns an appropriate PortionExtractor . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PortionDiscriminator
public PortionDiscriminator()
discriminate
public <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.
discriminatePortion
protected <E> java.util.List<java.util.List<E>> discriminatePortion(java.util.List<E> elements,
PortionExtractor<E,T> extractor,
MsdWorkspace workspace)
- Perform multiset discrimination for a portion of the elements. This is
meant as a step in the full discrimination. For this reason, we must
return the elements, so subsequent steps may be performed.
- Type Parameters:
E
- The type of elements to discriminate.- Parameters:
elements
- A List
of Lists
of elements.extractor
- A PortionExtractor
. It is capable of
creating labels out of portions of an element. It also specifies when
certain elements are "complete", e.g. no more characters in a string.
Such elements are separated into their own equivalence class apart
from the rest of the process.workspace
- A MsdWorkspace
.
- Returns:
- A
List
of Lists
containing all
(portion-defined) equivalence classes. Each equivalence class list
contains all values that compare equal to each other, as far as the
portion is concerned.
getPortionExtractor
protected abstract <E> PortionExtractor<E,T> getPortionExtractor(Extractor<E,T> extractor)
- Returns an appropriate
PortionExtractor
.
- Type Parameters:
E
- The type of the element.- Parameters:
extractor
- A PortionExtractor
that returns appropriate
labels.
- Returns:
- An appropriate
PortionExtractor
.
Copyright © 2010-2013 jAgg Team. All Rights Reserved.