Class Holder

java.lang.Object
  extended by Holder

 class Holder
extends java.lang.Object

Class used to convert a floating point number into a fixed point representation of a specified number of bits and to provide methods for accessing the representation.

Author:
Craig A. Lindley

Field Summary
private  Representation decimalRepresentation
           
private  Representation fractionRepresentation
           
private  boolean negative
           
private  int numberBits
           
 
Constructor Summary
Holder(int numberBits, double number)
          Class constructor converts a double number into a binary representation with the specified number of bits.
 
Method Summary
 Representation getDecimalRepresentation()
          Return a representation of the decimal portion of the floating point number.
 Representation getFractionRepresentation()
          Return a representation of the fraction portion of the floating point number.
 int getNumberBits()
          Get the number of bits in the representation
 void setDecimalRepresentation(Representation representation)
          Set the decimal internal representation
 void setFractionRepresentation(Representation representation)
          Set the fraction internal representation
 java.lang.String toString()
          Convert internal representations into a String for display.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

numberBits

private int numberBits

negative

private boolean negative

decimalRepresentation

private Representation decimalRepresentation

fractionRepresentation

private Representation fractionRepresentation
Constructor Detail

Holder

public Holder(int numberBits,
              double number)
Class constructor converts a double number into a binary representation with the specified number of bits.

Parameters:
numberBits - number of bits to use in the binary representation
number - double number to convert into binary
Method Detail

toString

public java.lang.String toString()
Convert internal representations into a String for display. Take into consideration the tristate nature of the representation. That is each bit of the representation is in the set {0, 1, -1}. The -1 comes into play when using CSD.

Overrides:
toString in class java.lang.Object
Returns:
String containing the representation.

getNumberBits

public int getNumberBits()
Get the number of bits in the representation

Returns:
number of bits in the representation

getDecimalRepresentation

public Representation getDecimalRepresentation()
Return a representation of the decimal portion of the floating point number.

Returns:
a Representation object containing the representation

setDecimalRepresentation

public void setDecimalRepresentation(Representation representation)
Set the decimal internal representation

Parameters:
representation - object containing the representation

getFractionRepresentation

public Representation getFractionRepresentation()
Return a representation of the fraction portion of the floating point number.

Returns:
a Representation object containing the representation

setFractionRepresentation

public void setFractionRepresentation(Representation representation)
Set the fraction internal representation

Parameters:
representation - object containing the representation