Class CSD

java.lang.Object
  extended by CSD

 class CSD
extends java.lang.Object

Class used to convert a binary representation into a CSD representation

Author:
Craig A. Lindley

Field Summary
private  int bitIndex
           
private  Representation decimalRepresentation
           
private  Representation fractionRepresentation
           
private  int[] fullRep
           
private  int numberBits
           
 
Constructor Summary
CSD(Holder holder)
          CSD class constructor
 
Method Summary
 void convertToCSD()
          Convert a normal representation into a CSD representation.
private  int[] createReplacementRun(int count)
          Create an array of integers destined to replace the run in the representation.
private  boolean peekForOne()
          Peek to see if there is another one in the representation
private  boolean replaceRun()
          Scans the representation replacing any runs of ones found
private  int scanForOne()
          Scan representation for the next one bit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

decimalRepresentation

private Representation decimalRepresentation

fractionRepresentation

private Representation fractionRepresentation

numberBits

private int numberBits

fullRep

private int[] fullRep

bitIndex

private int bitIndex
Constructor Detail

CSD

public CSD(Holder holder)
CSD class constructor

Parameters:
holder - Holder object that will be manipulated
Method Detail

scanForOne

private int scanForOne()
Scan representation for the next one bit

Returns:
bit number if a one is found or -1 if not.

peekForOne

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

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

createReplacementRun

private int[] createReplacementRun(int count)
Create an array of integers destined to replace the run in the representation.

Parameters:
count - is the number of ones in the run
Returns:
an array of ints containing the run replacement.

replaceRun

private boolean replaceRun()
Scans the representation replacing any runs of ones found

Returns:
true if a replacement was made; false if not

convertToCSD

public void convertToCSD()
Convert a normal representation into a CSD representation. A conversion is performed on both the decimal and fraction portions of the representation (as long as they are not zero).