org.xmloperator.lambda2.net.impl
Class PortImpl

java.lang.Object
  extended byorg.xmloperator.lambda2.term.impl.TermImpl
      extended byorg.xmloperator.lambda2.term.impl.VariableImpl
          extended byorg.xmloperator.lambda2.net.impl.PortImpl
All Implemented Interfaces:
Port, Term, Variable
Direct Known Subclasses:
CellImpl

public class PortImpl
extends VariableImpl
implements Port

Port implementation. In the mapping with terms, a Port is a Variable.


Field Summary
 
Fields inherited from interface org.xmloperator.lambda2.term.model.Term
TYPE_ABSTRACTION, TYPE_APPLICATION, TYPE_VARIABLE
 
Constructor Summary
PortImpl()
          Free port constructor.
PortImpl(CellImpl cell, int portNumber)
          Cell port constructor.
 
Method Summary
 void connectTo(Port port)
          Connects this Port to another Port.
 void disconnect()
          Disconnects this Port.
 Cell getCell()
          Returns the Cell to which this port belongs to or null if this Port is free.
 Port getConnectedPort()
          Returns the Port to which this one is connected or null if it is not connected.
 int getPortNumber()
          Returns the number of this port.
 boolean isConnected()
          Returns true if this Port is connected, false elsewhere.
 boolean isFree()
          Returns true if this Port is free, i.e. if it doesn't belong to a Cell.
 boolean isPrincipal()
          Returns true if this Port is principal, false elsewhere.
 
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.term.model.Term
buildAbstraction, buildAbstraction, buildAbstraction, buildApplication, buildApplication, freeVariables, isAbstraction, isApplication, toText
 

Constructor Detail

PortImpl

public PortImpl()
Free port constructor.


PortImpl

public PortImpl(CellImpl cell,
                int portNumber)
Cell port constructor.

Parameters:
cell - a Cell.
Method Detail

getCell

public final Cell getCell()
Description copied from interface: Port
Returns the Cell to which this port belongs to or null if this Port is free.

Specified by:
getCell in interface Port
Returns:
the Cell to which this port belongs to or null if this Port is free.

isFree

public final boolean isFree()
Description copied from interface: Port
Returns true if this Port is free, i.e. if it doesn't belong to a Cell.

Specified by:
isFree in interface Port
Returns:
true if this Port is free, i.e. if it doesn't belong to a Cell.

getPortNumber

public final int getPortNumber()
Description copied from interface: Port
Returns the number of this port. The principal Port of a Cell has the number 0. The other Ports of a Cell are numbered from 1. A free Port has -1 as port number.

Specified by:
getPortNumber in interface Port
Returns:
the number of this port.

isPrincipal

public final boolean isPrincipal()
Description copied from interface: Port
Returns true if this Port is principal, false elsewhere.

Specified by:
isPrincipal in interface Port
Returns:
true if this Port is principal, false elsewhere.

getConnectedPort

public final Port getConnectedPort()
Description copied from interface: Port
Returns the Port to which this one is connected or null if it is not connected.

Specified by:
getConnectedPort in interface Port
Returns:
the Port to which this one is connected or null if it is not connected.

isConnected

public final boolean isConnected()
Description copied from interface: Port
Returns true if this Port is connected, false elsewhere.

Specified by:
isConnected in interface Port
Returns:
true if this Port is connected, false elsewhere.

connectTo

public final void connectTo(Port port)
Description copied from interface: Port
Connects this Port to another Port. If this Port is already connected then it is first disconnected. If the other Port is already connected then it is first disconnected.

Specified by:
connectTo in interface Port
Parameters:
port - another Port.

disconnect

public final void disconnect()
Description copied from interface: Port
Disconnects this Port.

Post-condition: connectedPort == null.

Specified by:
disconnect in interface Port