Class Parser

java.lang.Object
  extended by Parser

 class Parser
extends java.lang.Object

Class which provides methods for extracting information from the representations contained within a holder.

Author:
Craig A. Lindley

Field Summary
private  int bitIndex
           
private  boolean doDecimal
           
private  Holder holder
           
private  int numberBits
           
 
Constructor Summary
Parser(Holder holder, boolean doDecimal)
          Class constructor for Parser class
 
Method Summary
 int getBit(int bitNumber)
          Given a bit number return the value of the bit from the appropriate representation
 boolean peekForOne()
          Peek to see if there is another one in the representation
 void reset()
          Calling reset sets bitIndex to start scanning over from the beginning.
 int scanForOne()
          Scan representation in the appropriate direction to find the next one bit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

holder

private Holder holder

doDecimal

private boolean doDecimal

numberBits

private int numberBits

bitIndex

private int bitIndex
Constructor Detail

Parser

public Parser(Holder holder,
              boolean doDecimal)
Class constructor for Parser class

Parameters:
holder - Holder object containing a representation
doDecimal - true if the decimal portion of the representation should be processed. false if the fraction portion should be processed.
Method Detail

getBit

public int getBit(int bitNumber)
Given a bit number return the value of the bit from the appropriate representation

Returns:
bit value at bitNumber from set {0, 1, -1}

scanForOne

public int scanForOne()
Scan representation in the appropriate direction to find the next one bit. This method retains state (bitIndex) between calls. Call reset to start scan over from the beginning.

Returns:
bitIndex if another one is found or -1 if end of scan.

peekForOne

public boolean peekForOne()
Peek to see if there is another one in the representation

Returns:
true if there is another one bit; false otherwise

reset

public void reset()
Calling reset sets bitIndex to start scanning over from the beginning.