org.xmloperator.lambda2.net.model
Interface Port

All Known Implementing Classes:
PortImpl

public interface Port

A Port belongs to a Cell or is free. A free Port is used as interface/support of an interaction net.

A Port is either connected to another Port or disconnected.


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.
 

Method Detail

getCell

public Cell getCell()
Returns the Cell to which this port belongs to or null if this Port is free.

Returns:
the Cell to which this port belongs to or null if this Port is free.

isFree

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

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

getPortNumber

public int getPortNumber()
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.

Returns:
the number of this port.

isPrincipal

public boolean isPrincipal()
Returns true if this Port is principal, false elsewhere.

Returns:
true if this Port is principal, false elsewhere.

getConnectedPort

public Port getConnectedPort()
Returns the Port to which this one is connected or null if it is not connected.

Returns:
the Port to which this one is connected or null if it is not connected.

isConnected

public boolean isConnected()
Returns true if this Port is connected, false elsewhere.

Returns:
true if this Port is connected, false elsewhere.

connectTo

public void connectTo(Port 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.

Parameters:
port - another Port.
Throws:
java.lang.IllegalArgumentException - if the given argument is itself.
java.lang.NullPointerException - if the given argument is null.

disconnect

public void disconnect()
Disconnects this Port.

Post-condition: connectedPort == null.