org.xmloperator.lambda2.net.impl
Class DecoderImpl

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.DecoderImpl
All Implemented Interfaces:
Cell, Decoder, Port, Term, Variable

public final class DecoderImpl
extends CellImpl
implements Decoder

Decoder 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
DecoderImpl(int index)
           
 
Method Summary
 Port addNewAuxiliaryPort()
          Adds a new auxiliary Port to this Cell and returns it.
 void addSequenceCount(long sequenceCount)
          Adds a given sequence count to this unary Decoder.
 Cell cloneCell()
          Clones this Cell and returns the clone.
 void collectPorts(Stack portStack)
          Adds its ports to a given Stack.
 int getIndex()
          Returns the index attached to this Decoder.
 Port getPort(int portNumber)
          Returns the port with the given number.
 long getSequenceCount()
          Returns the sequence count of this unary Decoder.
 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 isDecoder()
          Returns true if this Cell is a DecodingCell.
 
Methods inherited from class org.xmloperator.lambda2.net.impl.CellImpl
getPrincipalPort, isBinaryCell, 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, isBinaryCell, isEraser, isPentaryMultiplexor, isWireCell
 
Methods inherited from interface org.xmloperator.lambda2.term.model.Term
buildAbstraction, buildAbstraction, buildAbstraction, buildApplication, buildApplication, freeVariables, isAbstraction, isApplication, toText
 

Constructor Detail

DecoderImpl

public DecoderImpl(int index)
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 final 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.

isDecoder

public final boolean isDecoder()
Description copied from interface: Cell
Returns true if this Cell is a DecodingCell.

Specified by:
isDecoder in interface Cell
Overrides:
isDecoder 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_*.

getIndex

public final int getIndex()
Description copied from interface: Decoder
Returns the index attached to this Decoder.

Specified by:
getIndex in interface Decoder
Returns:
the index attached to this Decoder.

addNewAuxiliaryPort

public final Port addNewAuxiliaryPort()
Description copied from interface: Decoder
Adds a new auxiliary Port to this Cell and returns it. The symbol arity is incremented. The new Port has the new arity as port number.

Specified by:
addNewAuxiliaryPort in interface Decoder
Returns:
the created auxiliary Port.

getSequenceCount

public long getSequenceCount()
Description copied from interface: Decoder
Returns the sequence count of this unary Decoder.

This doesn't make sense for a Decoder that is not unary.

Specified by:
getSequenceCount in interface Decoder
Returns:
the sequence count of this unary Decoder.

addSequenceCount

public void addSequenceCount(long sequenceCount)
Description copied from interface: Decoder
Adds a given sequence count to this unary Decoder.

This doesn't make sense for a Decoder that is not unary.

Specified by:
addSequenceCount in interface Decoder
Parameters:
sequenceCount - a sequence count.