SFE.Compiler
Class BooleanConstant

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

public class BooleanConstant
extends ConstExpression

The BooleanConstant class represents boolean consts expressions that can appear in the program.


Field Summary
static java.util.Vector inputFormat
           
 
Constructor Summary
BooleanConstant(boolean booleanConst)
          Constructs a new BooleanConstant from a given boolean const
 
Method Summary
 Expression bitAt(int i)
          Returns Expression that represents the bit at place i of this Expression.
 boolean getConst()
          Returns the boolean stored in this BooleanConstant
 int size()
          Returns 1, as the number of bits needed to represent this BooleanConstant expression.
 void toCircuit(java.io.PrintWriter circuit)
          Writes this constant into the circuit file.
 java.lang.String toString()
          Returns a string representation of the object.
 int value()
          Returns the value stored in this BooleanConstant (0 or 1)
 
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
 

Field Detail

inputFormat

public static final java.util.Vector inputFormat
Constructor Detail

BooleanConstant

public BooleanConstant(boolean booleanConst)
Constructs a new BooleanConstant from a given boolean const

Parameters:
booleanConst - the given boolean constant
Method Detail

size

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

Specified by:
size in class Expression
Returns:
1, as the number of bits needed to represent this BooleanConstant 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 BooleanConstant (0 or 1)

Specified by:
value in class ConstExpression
Returns:
the value stored in this BooleanConstant (0 or 1)

getConst

public boolean getConst()
Returns the boolean stored in this BooleanConstant

Returns:
the boolean stored in this BooleanConstant

bitAt

public Expression bitAt(int i)
Returns Expression that represents the bit at place i of this Expression. Note: i can only be 0.

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

toCircuit

public void toCircuit(java.io.PrintWriter circuit)
Writes this constant into the circuit file.

Parameters:
circuit - the output circuit.