SFE.Compiler
Class PrimitiveOperator

java.lang.Object
  extended by SFE.Compiler.Operator
      extended by SFE.Compiler.PrimitiveOperator

public class PrimitiveOperator
extends Operator

The PrimitiveOperator class represents a primitive operator in the program. A PrimitiveOperator contains from one up to three input bits and one output bit.


Field Summary
static int AND_OP
          An integer to send with the constructor to construct an and operator.
static int ANDN_OP
          An integer to send with the constructor to construct an andn operator.
static int EQ_OP
          An integer to send with the constructor to construct an eq operator.
static int ID_OP
          An integer to send with the constructor to construct a nmajn operator.
static java.util.Vector inputFormat
           
static int MAJ_OP
          An integer to send with the constructor to construct a maj operator.
static int MAJN_OP
          An integer to send with the constructor to construct a majn operator.
static int MUX_OP
          An integer to send with the constructor to construct a mux operator.
static int MUXN_OP
          An integer to send with the constructor to construct a muxn operator.
static int NAND_OP
          An integer to send with the constructor to construct an nand operator.
static int NMAJ_OP
          An integer to send with the constructor to construct a nmaj operator.
static int NMAJN_OP
          An integer to send with the constructor to construct a nmajn operator.
static int NMUX_OP
          An integer to send with the constructor to construct a nmux operator.
static int NMUXN_OP
          An integer to send with the constructor to construct a nmuxn operator.
static int NOR_OP
          An integer to send with the constructor to construct an nor operator.
static int NOT_OP
          An integer to send with the constructor to construct a not operator.
 int operator
           
static int OR_OP
          An integer to send with the constructor to construct an or operator.
static int ORN_OP
          An integer to send with the constructor to construct an orn operator.
static int XOR_OP
          An integer to send with the constructor to construct a xor operator.
 
Constructor Summary
PrimitiveOperator(boolean[] truthTable)
          Construct a new PrimitiveOperator from a given truth table.
PrimitiveOperator(int truthTable)
          Construct a new PrimitiveOperator from a given int that represents the operator.
 
Method Summary
 int arity()
          Returns the arity of the operator 1 for unary ops; 2 for binary ops; 3 for terinary ops;
 PrimitiveOperator combineLeftNLeft(PrimitiveOperator other)
          same as combineRightNRight but on the this left and other left pins
 PrimitiveOperator combineLeftNLeftOnMid(PrimitiveOperator other)
          same as combineRightNRightOnLeft but on appropraite pins
 PrimitiveOperator combineLeftNLeftOnRight(PrimitiveOperator other)
          same as combineRightNRightOnLeft but on appropraite pins
 PrimitiveOperator combineLeftNRight(PrimitiveOperator other)
          same as combineRightNRight but on the this left and other right pins
 PrimitiveOperator combineLeftNRightOnMid(PrimitiveOperator other)
          same as combineRightNRightOnLeft but on appropraite pins
 PrimitiveOperator combineLeftNRightOnRight(PrimitiveOperator other)
          same as combineRightNRightOnLeft but on appropraite pins
 PrimitiveOperator combineMidNLeftOnLeft(PrimitiveOperator other)
          same as combineRightNRightOnLeft but on appropraite pins
 PrimitiveOperator combineMidNLeftOnRight(PrimitiveOperator other)
          same as combineRightNRightOnLeft but on appropraite pins
 PrimitiveOperator combineMidNRightOnLeft(PrimitiveOperator other)
          same as combineRightNRightOnLeft but on appropraite pins
 PrimitiveOperator combineMidNRightOnRight(PrimitiveOperator other)
          same as combineRightNRightOnLeft but on appropraite pins
 PrimitiveOperator combineRightNLeft(PrimitiveOperator other)
          same as combineRightNRight but on the this right and other left pin
 PrimitiveOperator combineRightNLeftOnLeft(PrimitiveOperator other)
          same as combineRightNRightOnLeft but on appropraite pins
 PrimitiveOperator combineRightNLeftOnMin(PrimitiveOperator other)
          same as combineRightNRightOnLeft but on appropraite pins
 PrimitiveOperator combineRightNRight(PrimitiveOperator other)
          combines this op and other op on the right pin and returns the result.
 PrimitiveOperator combineRightNRightOnLeft(PrimitiveOperator other)
          same as combineRightNRight but on the this right and other right pins
 PrimitiveOperator combineRightNRightOnMid(PrimitiveOperator other)
          same as combineRightNRightOnLeft but on appropraite pins
 PrimitiveOperator equalLeftMid()
          Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table where the left and the middle inputs are assumed to be equal.
 PrimitiveOperator equalLeftRight()
          Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table where the left and the right inputs are assumed to be equal.
 PrimitiveOperator equalRightMid()
          Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table where the right and the middle inputs are assumed to be equal.
 boolean isComplexIDOfLeft()
          returns true if gate is Trinary or Binary and ID on the left pin.
 boolean isComplexIDOfMiddle()
          same as isComplexIDOfLeft but on right pin
 boolean isComplexIDOfRight()
          same as isComplexIDOfLeft but on right pin
 boolean isComplexNotOfLeft()
          returns true if gate is Trinary or Binary and ID on the left pin.
 boolean isComplexNotOfMiddle()
          same as isComplexNotOfLeft but on middle pin
 boolean isComplexNotOfRight()
          same as isComplexNotOfLeft but on right pin
 boolean isID()
          Returns true if this operator is unary operator and is the identity function.
 boolean isNot()
          Returns true if this operator is unary operator and is the booelan function NOT.
 boolean isOne()
          Returns true if this operator is unary operator and is the booelan function output is constant one.
 boolean isZero()
          Returns true if this operator is unary operator and is the booelan function output is constant one.
 PrimitiveOperator negLeft()
          Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table when the left input bit is negated.
 PrimitiveOperator negMid()
          Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table when the middle input bit is negated.
 PrimitiveOperator negOut()
          Creates a new PrimitiveOperator, from this PrimitiveOpertor, that represents the complete boolean function of this PrimitiveOpertor.
 PrimitiveOperator negRight()
          Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table when the right input bit is negated.
 PrimitiveOperator oneLeft()
          Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table where the left input bit is the constant one (true).
 PrimitiveOperator oneMid()
          Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table where the middle input bit is the constant one (true).
 PrimitiveOperator oneRight()
          Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table where the right input bit is the constant one (true).
 int priority()
          Returns an int theat represents the priority of the operator
 PrimitiveOperator switchLeftMid()
          Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table where the left and middle inputs are switched.
 PrimitiveOperator switchRightLeft()
          Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table where the left anright inputs are switched.
 PrimitiveOperator switchRightMid()
          Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table where the right and middle inputs are switched.
 void toCircuit(java.io.PrintWriter circuit)
          Returns a string representing this object as it appear at the output circuit.
 java.lang.String toString()
          Returns a string representation of the object.
 PrimitiveOperator zeroLeft()
          Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table where the left input bit is the constant zero (false).
 PrimitiveOperator zeroMid()
           
 PrimitiveOperator zeroRight()
          Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table where the right input bit is the constant zero (false).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

operator

public int operator

NOT_OP

public static final int NOT_OP
An integer to send with the constructor to construct a not operator.

See Also:
Constant Field Values

AND_OP

public static final int AND_OP
An integer to send with the constructor to construct an and operator.

See Also:
Constant Field Values

OR_OP

public static final int OR_OP
An integer to send with the constructor to construct an or operator.

See Also:
Constant Field Values

NAND_OP

public static final int NAND_OP
An integer to send with the constructor to construct an nand operator.

See Also:
Constant Field Values

NOR_OP

public static final int NOR_OP
An integer to send with the constructor to construct an nor operator.

See Also:
Constant Field Values

ANDN_OP

public static final int ANDN_OP
An integer to send with the constructor to construct an andn operator.

See Also:
Constant Field Values

ORN_OP

public static final int ORN_OP
An integer to send with the constructor to construct an orn operator.

See Also:
Constant Field Values

XOR_OP

public static final int XOR_OP
An integer to send with the constructor to construct a xor operator.

See Also:
Constant Field Values

EQ_OP

public static final int EQ_OP
An integer to send with the constructor to construct an eq operator.

See Also:
Constant Field Values

MUX_OP

public static final int MUX_OP
An integer to send with the constructor to construct a mux operator.

See Also:
Constant Field Values

NMUX_OP

public static final int NMUX_OP
An integer to send with the constructor to construct a nmux operator.

See Also:
Constant Field Values

MUXN_OP

public static final int MUXN_OP
An integer to send with the constructor to construct a muxn operator.

See Also:
Constant Field Values

NMUXN_OP

public static final int NMUXN_OP
An integer to send with the constructor to construct a nmuxn operator.

See Also:
Constant Field Values

MAJ_OP

public static final int MAJ_OP
An integer to send with the constructor to construct a maj operator.

See Also:
Constant Field Values

NMAJ_OP

public static final int NMAJ_OP
An integer to send with the constructor to construct a nmaj operator.

See Also:
Constant Field Values

MAJN_OP

public static final int MAJN_OP
An integer to send with the constructor to construct a majn operator.

See Also:
Constant Field Values

NMAJN_OP

public static final int NMAJN_OP
An integer to send with the constructor to construct a nmajn operator.

See Also:
Constant Field Values

ID_OP

public static final int ID_OP
An integer to send with the constructor to construct a nmajn operator.

See Also:
Constant Field Values

inputFormat

public static final java.util.Vector inputFormat
Constructor Detail

PrimitiveOperator

public PrimitiveOperator(int truthTable)
                  throws java.lang.IllegalArgumentException
Construct a new PrimitiveOperator from a given int that represents the operator.

Parameters:
truthTable - the int that represents the truth table.
Throws:
java.lang.IllegalArgumentException

PrimitiveOperator

public PrimitiveOperator(boolean[] truthTable)
                  throws java.lang.IllegalArgumentException
Construct a new PrimitiveOperator from a given truth table.

Parameters:
truthTable - the truth table that repesents the operator.
Throws:
java.lang.IllegalArgumentException
Method Detail

negOut

public PrimitiveOperator negOut()
Creates a new PrimitiveOperator, from this PrimitiveOpertor, that represents the complete boolean function of this PrimitiveOpertor.

Returns:
PrimitiveOperator that represents the complete boolean function of this PrimitiveOpertor.

negLeft

public PrimitiveOperator negLeft()
Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table when the left input bit is negated.

Returns:
The newly created PrimitiveOperator.

negMid

public PrimitiveOperator negMid()
Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table when the middle input bit is negated.

Returns:
The newly created PrimitiveOperator.

negRight

public PrimitiveOperator negRight()
Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table when the right input bit is negated.

Returns:
The newly created PrimitiveOperator.

zeroRight

public PrimitiveOperator zeroRight()
Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table where the right input bit is the constant zero (false).

Returns:
The newly created PrimitiveOperator.

oneRight

public PrimitiveOperator oneRight()
Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table where the right input bit is the constant one (true).

Returns:
The newly created PrimitiveOperator.

zeroLeft

public PrimitiveOperator zeroLeft()
Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table where the left input bit is the constant zero (false).

Returns:
The newly created PrimitiveOperator.

oneLeft

public PrimitiveOperator oneLeft()
Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table where the left input bit is the constant one (true).

Returns:
The newly created PrimitiveOperator.

zeroMid

public PrimitiveOperator zeroMid()

oneMid

public PrimitiveOperator oneMid()
Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table where the middle input bit is the constant one (true). Note that this method will be called only for trinary gates (in the optimization stage)

Returns:
The newly created PrimitiveOperator.

equalLeftRight

public PrimitiveOperator equalLeftRight()
Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table where the left and the right inputs are assumed to be equal. Note: the two privious input will be the left input of the result (or midle if the combination yields an unary operator).


equalLeftMid

public PrimitiveOperator equalLeftMid()
Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table where the left and the middle inputs are assumed to be equal. Note: the two privious input will be the left input of the result. also note that method is called only for trinary operator.


equalRightMid

public PrimitiveOperator equalRightMid()
Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table where the right and the middle inputs are assumed to be equal. Note: the two privious input will be the right input of the result. also note that method is called only for trinary operator.


switchRightLeft

public PrimitiveOperator switchRightLeft()
Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table where the left anright inputs are switched.


switchLeftMid

public PrimitiveOperator switchLeftMid()
Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table where the left and middle inputs are switched. Note that method is called only for trinary operator.


switchRightMid

public PrimitiveOperator switchRightMid()
Creates a new PrimitiveOperator from this PrimitiveOpertor's truth table where the right and middle inputs are switched. Note that method is called only for trinary operator.


arity

public int arity()
Returns the arity of the operator 1 for unary ops; 2 for binary ops; 3 for terinary ops;

Specified by:
arity in class Operator
Returns:
the arity of the operator

priority

public int priority()
Returns an int theat represents the priority of the operator

Specified by:
priority in class Operator
Returns:
an int theat represents the priority of the operator

toCircuit

public void toCircuit(java.io.PrintWriter circuit)
Returns a string representing this object as it appear at the output circuit.

Parameters:
circuit - the circuit output file.

toString

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

Overrides:
toString in class java.lang.Object
Returns:
a string representing this object as it appear at the output circuit.

isID

public boolean isID()
Returns true if this operator is unary operator and is the identity function.

Returns:
true if this operator is unary operator and is the identity function.

isNot

public boolean isNot()
Returns true if this operator is unary operator and is the booelan function NOT.

Returns:
true if this operator is unary operator and is the booelan function NOT.

isOne

public boolean isOne()
Returns true if this operator is unary operator and is the booelan function output is constant one.

Returns:
true if this operator is unary operator and is the booelan function output is constant one.

isZero

public boolean isZero()
Returns true if this operator is unary operator and is the booelan function output is constant one.

Returns:
true if this operator is unary operator and is the booelan function output is constant one.

isComplexIDOfLeft

public boolean isComplexIDOfLeft()
returns true if gate is Trinary or Binary and ID on the left pin.

Returns:
true if gate is Trinary or Binary and ID on the left pin.

isComplexNotOfLeft

public boolean isComplexNotOfLeft()
returns true if gate is Trinary or Binary and ID on the left pin. Trinary or Binary gates.

Returns:
true if gate is Trinary or Binary and ID on the left pin.

isComplexIDOfRight

public boolean isComplexIDOfRight()
same as isComplexIDOfLeft but on right pin

Returns:
same as isComplexIDOfLeft but on right pin

isComplexNotOfRight

public boolean isComplexNotOfRight()
same as isComplexNotOfLeft but on right pin

Returns:
same as isComplexNotOfLeft but on right pin

isComplexIDOfMiddle

public boolean isComplexIDOfMiddle()
same as isComplexIDOfLeft but on right pin

Returns:
same as isComplexIDOfLeft but on right pin

isComplexNotOfMiddle

public boolean isComplexNotOfMiddle()
same as isComplexNotOfLeft but on middle pin

Returns:
same as isComplexNotOfLeft but on midle pin

combineRightNRight

public PrimitiveOperator combineRightNRight(PrimitiveOperator other)
combines this op and other op on the right pin and returns the result.

Parameters:
other - the op.
Returns:
the result gate.

combineRightNLeft

public PrimitiveOperator combineRightNLeft(PrimitiveOperator other)
same as combineRightNRight but on the this right and other left pin

Parameters:
other - the op.
Returns:
the result gate.

combineLeftNRight

public PrimitiveOperator combineLeftNRight(PrimitiveOperator other)
same as combineRightNRight but on the this left and other right pins

Parameters:
other - the op.
Returns:
the result gate.

combineLeftNLeft

public PrimitiveOperator combineLeftNLeft(PrimitiveOperator other)
same as combineRightNRight but on the this left and other left pins

Parameters:
other - the op.
Returns:
the result gate.

combineRightNRightOnLeft

public PrimitiveOperator combineRightNRightOnLeft(PrimitiveOperator other)
same as combineRightNRight but on the this right and other right pins

Parameters:
other - the op.
Returns:
the result gate.

combineRightNLeftOnLeft

public PrimitiveOperator combineRightNLeftOnLeft(PrimitiveOperator other)
same as combineRightNRightOnLeft but on appropraite pins

Parameters:
other - the op.
Returns:
the result gate.

combineMidNRightOnLeft

public PrimitiveOperator combineMidNRightOnLeft(PrimitiveOperator other)
same as combineRightNRightOnLeft but on appropraite pins

Parameters:
other - the op.
Returns:
the result gate.

combineMidNLeftOnLeft

public PrimitiveOperator combineMidNLeftOnLeft(PrimitiveOperator other)
same as combineRightNRightOnLeft but on appropraite pins

Parameters:
other - the op.
Returns:
the result gate.

combineRightNRightOnMid

public PrimitiveOperator combineRightNRightOnMid(PrimitiveOperator other)
same as combineRightNRightOnLeft but on appropraite pins

Parameters:
other - the op.
Returns:
the result gate.

combineRightNLeftOnMin

public PrimitiveOperator combineRightNLeftOnMin(PrimitiveOperator other)
same as combineRightNRightOnLeft but on appropraite pins

Parameters:
other - the op.
Returns:
the result gate.

combineLeftNRightOnMid

public PrimitiveOperator combineLeftNRightOnMid(PrimitiveOperator other)
same as combineRightNRightOnLeft but on appropraite pins

Parameters:
other - the op.
Returns:
the result gate.

combineLeftNLeftOnMid

public PrimitiveOperator combineLeftNLeftOnMid(PrimitiveOperator other)
same as combineRightNRightOnLeft but on appropraite pins

Parameters:
other - the op.
Returns:
the result gate.

combineMidNRightOnRight

public PrimitiveOperator combineMidNRightOnRight(PrimitiveOperator other)
same as combineRightNRightOnLeft but on appropraite pins

Parameters:
other - the op.
Returns:
the result gate.

combineMidNLeftOnRight

public PrimitiveOperator combineMidNLeftOnRight(PrimitiveOperator other)
same as combineRightNRightOnLeft but on appropraite pins

Parameters:
other - the op.
Returns:
the result gate.

combineLeftNRightOnRight

public PrimitiveOperator combineLeftNRightOnRight(PrimitiveOperator other)
same as combineRightNRightOnLeft but on appropraite pins

Parameters:
other - the op.
Returns:
the result gate.

combineLeftNLeftOnRight

public PrimitiveOperator combineLeftNLeftOnRight(PrimitiveOperator other)
same as combineRightNRightOnLeft but on appropraite pins

Parameters:
other - the op.
Returns:
the result gate.