net.sf.jagg.msd
Class AbstractExtractor<E,T>

java.lang.Object
  extended by net.sf.jagg.msd.AbstractExtractor<E,T>
Type Parameters:
E - The type of element.
T - The type of label generated by the chained extractor.
Direct Known Subclasses:
ChainedExtractor, PortionExtractor

public abstract class AbstractExtractor<E,T>
extends java.lang.Object

An AbstractExtractor encapsulates functionality needed by all Extractors, specifically, determining whether an Extractor is complete, and a chained Extractor.

Since:
0.5.0
Author:
Randy Gettman

Field Summary
protected  boolean amIAllComplete
          Controlled by a discriminator, this notes down whether an equivalence class is "complete", such that all elements in an equivalence class have been examined completely.
protected  Extractor<E,T> myExtractor
          The chained Extractor.
protected  int myIndex
          The index that influences label generation.
 
Constructor Summary
AbstractExtractor(Extractor<E,T> extractor)
          Creates an AbstractExtractor that uses the given Extractor in a chain for its labels.
 
Method Summary
 boolean isAllComplete()
          The specific Discriminator calls this method to determine whether all elements in the current equivalence class were complete.
abstract  boolean isComplete(E element)
          Determines whether discrimination is complete for the given element, at the given index.
 void setAllComplete(boolean allComplete)
          The Discriminator calls this method to indicate whether all elements in its current equivalence class were complete.
 void setIndex(int index)
          Sets which portion is retrieved as the label.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myIndex

protected int myIndex
The index that influences label generation. This could be an array index, a List position, or any index that represents part of an element.


myExtractor

protected Extractor<E,T> myExtractor
The chained Extractor.


amIAllComplete

protected boolean amIAllComplete
Controlled by a discriminator, this notes down whether an equivalence class is "complete", such that all elements in an equivalence class have been examined completely.

Constructor Detail

AbstractExtractor

public AbstractExtractor(Extractor<E,T> extractor)
Creates an AbstractExtractor that uses the given Extractor in a chain for its labels.

Parameters:
extractor - The chained Extractor.
Method Detail

setIndex

public void setIndex(int index)
Sets which portion is retrieved as the label.

Parameters:
index - The index.

isComplete

public abstract boolean isComplete(E element)
Determines whether discrimination is complete for the given element, at the given index. All elements that would throw, for example, an IndexOutOfBoundsException, would return true here so the algorithm doesn't call getLabel. All AbstractExtractors should check their chained Extractor, to see if it's complete first.

Parameters:
element - The element.
Returns:
true if discrimination is complete or cannot continue, usually because the discrimination has run off the end of the label, false otherwise.

setAllComplete

public void setAllComplete(boolean allComplete)
The Discriminator calls this method to indicate whether all elements in its current equivalence class were complete.

Parameters:
allComplete - Whether all elements were complete.

isAllComplete

public boolean isAllComplete()
The specific Discriminator calls this method to determine whether all elements in the current equivalence class were complete.

Returns:
Whether all elements were complete.


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