goldman.collection
Class IndexedNumber.NumberDigitizer

java.lang.Object
  extended by goldman.collection.IndexedNumber.NumberDigitizer
All Implemented Interfaces:
Digitizer<IndexedNumber>
Enclosing class:
IndexedNumber

public static class IndexedNumber.NumberDigitizer
extends Object
implements Digitizer<IndexedNumber>

This class provides a sample implementation for the Digitizer interface for base 10 numbers that uses standard place value to report the value for each digit.


Constructor Summary
IndexedNumber.NumberDigitizer()
           
 
Method Summary
 String formatDigit(IndexedNumber x, int place)
           
 int getBase()
          Returns the base.
 int getDigit(IndexedNumber 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(IndexedNumber 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

IndexedNumber.NumberDigitizer

public IndexedNumber.NumberDigitizer()
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<IndexedNumber>

numDigits

public int numDigits(IndexedNumber x)
Description copied from interface: Digitizer
Returns the number of digits in the element x.

Specified by:
numDigits in interface Digitizer<IndexedNumber>

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<IndexedNumber>

getDigit

public int getDigit(IndexedNumber x,
                    int place)
Description copied from interface: Digitizer
Returns the value of digit place for element x.

Specified by:
getDigit in interface Digitizer<IndexedNumber>

formatDigit

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