|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectSFE.Compiler.Expression
SFE.Compiler.OperationExpression
SFE.Compiler.TrinaryOpExpression
public class TrinaryOpExpression
A class for representing trinary operator expressions that can be defined in the program.
Field Summary | |
---|---|
static java.util.Vector |
inputFormat
|
Constructor Summary | |
---|---|
TrinaryOpExpression(Operator op,
Expression left,
Expression middle,
Expression right)
Constructs a new TrinaryOpExpression from a given oparator and inputs. |
Method Summary | |
---|---|
void |
changeReference(UniqueVariables unique)
Changes references of variables to the last place they were changed |
OperationExpression |
combineConstInput()
Combines an input expression that is constant and return the result expression. |
OperationExpression |
combineEqualInputs()
Combines identical input expression an returns the result expression. |
OperationExpression |
combineSharedInput()
if hasSharedInput() is true, combine the gates into one simple gate. |
void |
combineUnaryInput()
Combined an input expression the is the output of an unary operator into this Operation expression. |
Expression |
duplicate()
returns a replica of this expression |
java.util.Vector |
getLvalExpressionInputs()
Returns an array of the input LvalExpressions of this gate. |
boolean |
hasConstantInput()
Return true iff this OperationExpression has a constant input. |
boolean |
hasEqualInputs()
Returns true iff this operator expression has at lease two identical input expression. |
boolean |
hasSharedInput()
Returns if two legs of the trinary gate shares the same input. |
boolean |
hasUnaryInput()
Returns true iff one of the operand of this operator expression is a result of an unary operator. |
boolean |
isComplexIDOrNeg()
returns true if this gate is a id gate or neg gate of one of the inputs |
BlockStatement |
multi2SingleBit(java.lang.Object obj)
Transforms this multibit expression into singlebit statements and returns the result |
OperationExpression |
negate()
returns the negate gate (OperatorExpression) of this OperatorExpression. |
OperationExpression |
simplify()
if isComplexIDOrNeg() is true, replaces the compex gate with the appropriate simple primitive gate. |
OperationExpression |
sortInputs()
Sorts the input gates according to their names and returns the result OperationExpression. |
void |
toCircuit(java.io.PrintWriter circuit)
Prints this AssignmentStatement into the circuit. |
java.lang.String |
toString()
Returns a string representation of the object. |
Methods inherited from class SFE.Compiler.OperationExpression |
---|
evaluateExpression, getConstantOutput, getOperator, isConstant, size |
Methods inherited from class SFE.Compiler.Expression |
---|
bitAt, hasSharedInput |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.util.Vector inputFormat
Constructor Detail |
---|
public TrinaryOpExpression(Operator op, Expression left, Expression middle, Expression right)
op
- the trinary operator.left
- the left input.middle
- the left input.right
- the right input.Method Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public BlockStatement multi2SingleBit(java.lang.Object obj)
obj
- the AssignmentStatement that holds this TrinaryOpExpression.
public void toCircuit(java.io.PrintWriter circuit)
circuit
- the circuit output file.public boolean hasUnaryInput()
hasUnaryInput
in class OperationExpression
public void combineUnaryInput()
combineUnaryInput
in class OperationExpression
public boolean hasConstantInput()
hasConstantInput
in class OperationExpression
public OperationExpression combineConstInput()
combineConstInput
in class OperationExpression
public boolean hasEqualInputs()
hasEqualInputs
in class OperationExpression
public OperationExpression combineEqualInputs()
combineEqualInputs
in class OperationExpression
public OperationExpression sortInputs()
sortInputs
in class OperationExpression
public OperationExpression negate()
negate
in class OperationExpression
public java.util.Vector getLvalExpressionInputs()
getLvalExpressionInputs
in class OperationExpression
public void changeReference(UniqueVariables unique)
changeReference
in class OperationExpression
unique
- holds all the variables and their referencespublic boolean isComplexIDOrNeg()
isComplexIDOrNeg
in class OperationExpression
public OperationExpression simplify()
simplify
in class OperationExpression
public Expression duplicate()
duplicate
in class OperationExpression
public boolean hasSharedInput()
hasSharedInput
in class OperationExpression
public OperationExpression combineSharedInput()
combineSharedInput
in class OperationExpression
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |