SFE.Compiler
Class LvalExpression

java.lang.Object
  extended by SFE.Compiler.Expression
      extended by SFE.Compiler.LvalExpression

public class LvalExpression
extends Expression

The LvalExpression class represents an Expression that can appear as LHS in the program.


Field Summary
static java.util.Vector inputFormat
           
 
Constructor Summary
LvalExpression(Lvalue lvalue)
          LvalExpression constractor
 
Method Summary
 Expression bitAt(int i)
          Returns Expression that represents the bit at place i of this Expression
 Statement getAssigningStatement()
          Returns the assigning statement of this lvalexpression.
 Lvalue getLvalue()
          Returns this Lavlue.
 Expression getMiddleOfUnaryInput()
          Returns the input of the unary gate that this expression is its result.
 java.lang.String getName()
          Returns the name of this LvalExpression's lvalue.
 Type getType()
          Returns the Type of this LvalExpression's lvalue.
 boolean hasSharedInput(Expression exp)
          Returns true if this expression has input pins that share an input.
 boolean hasUnaryInput()
          Returns true if this LvalExpression is a result of an unary operator.
 boolean isOutput()
          Returns true if the this expression is a part out the circuit's output.
 LvalExpression lvalBitAt(int i)
          Returns LvalExpression that represents the bit at place i of this Expression
 void notOutput()
          sets this LvalExpression as a pin that is not an output of this circuit.
 void setAssigningStatement(Statement as)
          Set the reference to this expressionn assigning statement, Which can be either AssignmentStatement or InputStatement.
 int size()
          Returns the number of bits needed to represent this expression.
 void toCircuit(java.io.PrintWriter circuit)
          Prints this AssignmentStatement into the circuit.
 java.lang.String toString()
          Returns a string representation of the object.
 boolean unaryInputIsNotResult()
          Returns true if this expression is a result of unary not expression.
 
Methods inherited from class SFE.Compiler.Expression
duplicate, evaluateExpression
 
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

LvalExpression

public LvalExpression(Lvalue lvalue)
LvalExpression constractor

Parameters:
lvalue -
Method Detail

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.

getLvalue

public Lvalue getLvalue()
Returns this Lavlue.

Returns:
this Lavlue.

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

lvalBitAt

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

Returns:
LvalExpression that represents the bit at place i of this Expression

getName

public java.lang.String getName()
Returns the name of this LvalExpression's lvalue.

Returns:
a string representing this LvalExpression's lvalue.

getType

public Type getType()
Returns the Type of this LvalExpression's lvalue.

Returns:
the Type of this LvalExpression's lvalue.

isOutput

public boolean isOutput()
Returns true if the this expression is a part out the circuit's output.

Returns:
true if the this expression is a part out the circuit's output.

setAssigningStatement

public void setAssigningStatement(Statement as)
Set the reference to this expressionn assigning statement, Which can be either AssignmentStatement or InputStatement.

Parameters:
as - the assigning statement.

getAssigningStatement

public Statement getAssigningStatement()
Returns the assigning statement of this lvalexpression.

Returns:
the assigning statement of this lvalexpression.

toCircuit

public void toCircuit(java.io.PrintWriter circuit)
Prints this AssignmentStatement into the circuit.

Parameters:
circuit - the circuit output file.

notOutput

public void notOutput()
sets this LvalExpression as a pin that is not an output of this circuit.


hasUnaryInput

public boolean hasUnaryInput()
Returns true if this LvalExpression is a result of an unary operator.

Returns:
true if this LvalExpression is a result of an unary operator.

unaryInputIsNotResult

public boolean unaryInputIsNotResult()
Returns true if this expression is a result of unary not expression. Note: this method should be called only if hasUnaryInput() is true.


getMiddleOfUnaryInput

public Expression getMiddleOfUnaryInput()
Returns the input of the unary gate that this expression is its result. Note: this method should be called only if hasUnaryInput() is true.


hasSharedInput

public boolean hasSharedInput(Expression exp)
Returns true if this expression has input pins that share an input.

Overrides:
hasSharedInput in class Expression
Parameters:
exp -
Returns:
true if this expression has input pins that share an input.