goldman.collection
Interface Digitizer<T>

All Known Subinterfaces:
PrefixFreeDigitizer<T>
All Known Implementing Classes:
BitDigitizer, IndexedNumber.NumberDigitizer, StringDigitizer, TaggedElementDigitizer

public interface Digitizer<T>

The Digitizer interface provides a mechanism for any algorithm or data structure to treat each element in a collection as a sequence of digits where each digit is mapped to an integer from 0 to b-1 where b is the base of the digit.


Method Summary
 String formatDigit(T x, int place)
           
 int getBase()
          Returns the base.
 int getDigit(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(T x)
          Returns the number of digits in the element x.
 

Method Detail

getBase

int getBase()
Returns the base. Observe that a base b digit takes on values from 0 to b-1.


isPrefixFree

boolean isPrefixFree()
Returns true if and only if the digitizer guarantees that no element is a prefix of another.


numDigits

int numDigits(T x)
Returns the number of digits in the element x.


getDigit

int getDigit(T x,
             int place)
Returns the value of digit place for element x.


formatDigit

String formatDigit(T x,
                   int place)