SFE.Compiler
Class IntConstant

java.lang.Object
  extended by SFE.Compiler.Expression
      extended by SFE.Compiler.ConstExpression
          extended by SFE.Compiler.IntConstant

public class IntConstant
extends ConstExpression

The IntConstant class represents integer consts expressions that can appear in the program.


Constructor Summary
IntConstant(int intConst)
          Constructs a new IntConstant from a given integer const
 
Method Summary
 Expression bitAt(int i)
          Returns Expression that represents the bit at place i of this Expression
static double log2(double a)
           
 int size()
          Returns the number of bits needed to represent this expression.
 java.lang.String toString()
          Returns a string representation of the object.
 int value()
          Returns the value stored in this IntConstant
 
Methods inherited from class SFE.Compiler.Expression
duplicate, evaluateExpression, hasSharedInput
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntConstant

public IntConstant(int intConst)
Constructs a new IntConstant from a given integer const

Parameters:
intConst - the given integer constant
Method Detail

log2

public static double log2(double a)

size

public int size()
Returns the number of bits needed to represent this expression.

Specified by:
size in class Expression
Returns:
the number of bits needed to represent this expression.

toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the object.

value

public int value()
Returns the value stored in this IntConstant

Specified by:
value in class ConstExpression
Returns:
the value stored in this IntConstant

bitAt

public Expression bitAt(int i)
Returns Expression that represents the bit at place i of this Expression

Overrides:
bitAt in class Expression
Returns:
Expression that represents the bit at place i of this Expression