org.xmloperator.lambda2.net.impl
Class BinaryCellImpl

java.lang.Object
  extended byorg.xmloperator.lambda2.term.impl.TermImpl
      extended byorg.xmloperator.lambda2.term.impl.VariableImpl
          extended byorg.xmloperator.lambda2.net.impl.PortImpl
              extended byorg.xmloperator.lambda2.net.impl.CellImpl
                  extended byorg.xmloperator.lambda2.net.impl.BinaryCellImpl
All Implemented Interfaces:
BinaryCell, Cell, Port, Term, Variable

public final class BinaryCellImpl
extends CellImpl
implements BinaryCell

BinaryCell implementation.


Field Summary
 
Fields inherited from interface org.xmloperator.lambda2.net.model.Cell
INTERACTION_ABSTRACTOR_APPLICATOR, INTERACTION_ANNIHILATION_CONSTRUCTOR, INTERACTION_ANNIHILATION_DUPLICATOR, INTERACTION_ANNIHILATION_ERASER, INTERACTION_APPLICATOR_DECODER, INTERACTION_CONSTRUCTOR_DUPLICATOR, INTERACTION_CONSTRUCTOR_DUPLICATOR_CONTRUCTORS, INTERACTION_DUPLICATING_ABSTRACTOR, INTERACTION_DUPLICATING_APPLICATOR, INTERACTION_DUPLICATING_DECODER, INTERACTION_ERASING_ABSTRACTOR, INTERACTION_ERASING_APPLICATOR, INTERACTION_ERASING_CONSTRUCTOR, INTERACTION_ERASING_DECODER, INTERACTION_ERASING_DUPLICATOR, INTERACTION_MERGING_DECODER, INTERACTION_MERGING_DECODERS, INTERACTION_SYMBOLS, INTERACTION_WIRE, SYMBOL_ABSTRACTOR, SYMBOL_APPLICATOR, SYMBOL_CONSTRUCTOR, SYMBOL_DECODER, SYMBOL_DUPLICATOR, SYMBOL_ERASER, SYMBOL_SYMBOLS, SYMBOL_WIRE
 
Fields inherited from interface org.xmloperator.lambda2.term.model.Term
TYPE_ABSTRACTION, TYPE_APPLICATION, TYPE_VARIABLE
 
Constructor Summary
BinaryCellImpl(boolean isDuplicator)
           
 
Method Summary
 void changeToDuplicator()
          Changes this cell to a duplicator (if it is a constructor).
 Cell cloneCell()
          Clones this Cell and returns the clone.
 void collectPorts(Stack portStack)
          Adds its ports to a given Stack.
 Port getPort(int portNumber)
          Returns the port with the given number.
 Port getPort1()
          Returns the first auxiliary Port of this Cell.
 Port getPort2()
          Returns the second auxiliary Port of this Cell.
 int getSymbol()
          Returns the Symbol SYMBOL_* of this cell.
 int getSymbolArity()
          Returns the symbol arity of this Cell.
 int interact()
          Interacts with the opposite Cell.
 boolean isBinaryCell()
          Returns true if this Cell is a binaryCell, i.e. a constructor or a duplicator.
 boolean isDuplicator()
          Returns true if this cell is a duplicator, false if this is a constructor.
 
Methods inherited from class org.xmloperator.lambda2.net.impl.CellImpl
getPrincipalPort, isDecoder, isEraser, isPentaryMultiplexor, isWireCell
 
Methods inherited from class org.xmloperator.lambda2.net.impl.PortImpl
connectTo, disconnect, getCell, getConnectedPort, getPortNumber, isConnected, isFree, isPrincipal
 
Methods inherited from class org.xmloperator.lambda2.term.impl.VariableImpl
getTermType, isVariable
 
Methods inherited from class org.xmloperator.lambda2.term.impl.TermImpl
buildAbstraction, buildAbstraction, buildAbstraction, buildApplication, buildApplication, freeVariables, isAbstraction, isApplication, toString, toText
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.xmloperator.lambda2.net.model.Cell
getPrincipalPort, isDecoder, isEraser, isPentaryMultiplexor, isWireCell
 
Methods inherited from interface org.xmloperator.lambda2.term.model.Term
buildAbstraction, buildAbstraction, buildAbstraction, buildApplication, buildApplication, freeVariables, isAbstraction, isApplication, toText
 

Constructor Detail

BinaryCellImpl

public BinaryCellImpl(boolean isDuplicator)
Method Detail

getSymbol

public final int getSymbol()
Description copied from interface: Cell
Returns the Symbol SYMBOL_* of this cell.

Specified by:
getSymbol in interface Cell
Returns:
the Symbol SYMBOL_* of this cell.

getSymbolArity

public int getSymbolArity()
Description copied from interface: Cell
Returns the symbol arity of this Cell. It is >= 0.

Specified by:
getSymbolArity in interface Cell
Returns:
the symbol arity of this Cell. It is >= 0.

isBinaryCell

public final boolean isBinaryCell()
Description copied from interface: Cell
Returns true if this Cell is a binaryCell, i.e. a constructor or a duplicator.

Specified by:
isBinaryCell in interface Cell
Overrides:
isBinaryCell in class CellImpl

getPort

public Port getPort(int portNumber)
Description copied from interface: Cell
Returns the port with the given number.

Specified by:
getPort in interface Cell
Parameters:
portNumber - 0 for the principal port, 1 to the symbol arity for the auxiliary ports.
Returns:
the port with the given number.

collectPorts

public void collectPorts(Stack portStack)
Description copied from interface: Cell
Adds its ports to a given Stack.

Specified by:
collectPorts in interface Cell
Overrides:
collectPorts in class CellImpl

cloneCell

public Cell cloneCell()
Description copied from interface: Cell
Clones this Cell and returns the clone.

Specified by:
cloneCell in interface Cell
Returns:
this Cell and returns the clone.

interact

public final int interact()
Description copied from interface: Cell
Interacts with the opposite Cell.

Pre-condition: the two cells must have their principal Ports connected and have their all auxiliary Ports connected.

Specified by:
interact in interface Cell
Returns:
the interaction type INTERACTION_*.

getPort1

public final Port getPort1()
Description copied from interface: BinaryCell
Returns the first auxiliary Port of this Cell.

Specified by:
getPort1 in interface BinaryCell
Returns:
the first auxiliary Port of this Cell.

getPort2

public final Port getPort2()
Description copied from interface: BinaryCell
Returns the second auxiliary Port of this Cell.

Specified by:
getPort2 in interface BinaryCell
Returns:
the second auxiliary Port of this Cell.

isDuplicator

public final boolean isDuplicator()
Description copied from interface: BinaryCell
Returns true if this cell is a duplicator, false if this is a constructor.

Specified by:
isDuplicator in interface BinaryCell
Returns:
true if this cell is a duplicator, false if this is a constructor.

changeToDuplicator

public final void changeToDuplicator()
Description copied from interface: BinaryCell
Changes this cell to a duplicator (if it is a constructor).

Specified by:
changeToDuplicator in interface BinaryCell