goldman.collection.tagged.ordered.digitized
Class TaggedElementDigitizer<T>

java.lang.Object
  extended by goldman.collection.tagged.ordered.digitized.TaggedElementDigitizer<T>
All Implemented Interfaces:
Digitizer<TaggedElement<T,?>>

public class TaggedElementDigitizer<T>
extends Object
implements Digitizer<TaggedElement<T,?>>

The tagged digitized ordered collection data structures require digitizers for tagged elements that depend only on the tags. This class wraps a digitizer defined for a tag type to create a digitizer defined for a corresponding tagged element type.


Constructor Summary
TaggedElementDigitizer(Digitizer<? super T> digitizer)
           
 
Method Summary
 String formatDigit(TaggedElement<T,?> x, int place)
           
 int getBase()
          Returns the base.
 int getDigit(TaggedElement<T,?> x, int place)
          Returns the value of digit place for element x.
 boolean isPrefixFree()
          Returns true if and only if the digitizer guarantees that no element is a prefix of another.
 int numDigits(TaggedElement<T,?> x)
          Returns the number of digits in the element x.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaggedElementDigitizer

public TaggedElementDigitizer(Digitizer<? super T> digitizer)
Method Detail

getBase

public int getBase()
Description copied from interface: Digitizer
Returns the base. Observe that a base b digit takes on values from 0 to b-1.

Specified by:
getBase in interface Digitizer<TaggedElement<T,?>>

getDigit

public int getDigit(TaggedElement<T,?> x,
                    int place)
Description copied from interface: Digitizer
Returns the value of digit place for element x.

Specified by:
getDigit in interface Digitizer<TaggedElement<T,?>>

isPrefixFree

public boolean isPrefixFree()
Description copied from interface: Digitizer
Returns true if and only if the digitizer guarantees that no element is a prefix of another.

Specified by:
isPrefixFree in interface Digitizer<TaggedElement<T,?>>

numDigits

public int numDigits(TaggedElement<T,?> x)
Description copied from interface: Digitizer
Returns the number of digits in the element x.

Specified by:
numDigits in interface Digitizer<TaggedElement<T,?>>

formatDigit

public String formatDigit(TaggedElement<T,?> x,
                          int place)
Specified by:
formatDigit in interface Digitizer<TaggedElement<T,?>>