cz.cuni.jagrlib
Interface Channel

All Known Implementing Classes:
BasicChannel

public interface Channel

Channel connects two or more Pieces - the left Piece(s) can call the given interface of the right Piece(s) and vice versa.

Since:
0.01
See Also:
Channel.java

Method Summary
 void connectAnti(Plug newPlug, Plug antiPlug)
          Connects a new Plug to the opposite Channel-side.
 void connectLeft(Plug newPlug)
          Connects a new Plug to the left Channel-side.
 void connectPro(Plug newPlug, Plug proPlug)
          Connects a new Plug to the same Channel-side.
 void connectRight(Plug newPlug)
          Connects a new Plug to the right Channel-side.
 void disconnect(Plug oldPlug)
          Disconnects the old Plug from the Channel.
 void disconnectAll()
          Disconnects all Plugs from the Channel.
 Plug[] getAnti(Plug antiPlug)
          Returns the array of opposite-side objects (Plugs).
 java.lang.Object getInterface(Plug caller)
          Returns the interface object of the given Channel-side.
 java.lang.String getInterfaceNameAnti(Plug antiPlug)
          Returns an interface name of the opposite Channel-side.
 java.lang.String getInterfaceNamePro(Plug proPlug)
          Returns an interface name of the same Channel-side.
 Plug[] getLeft()
          Returns the array of left-side objects (Plugs).
 int getLeftCount()
          Returns the left Channel-side count.
 java.lang.Object getLeftInterface()
          Returns the interface object of the left Channel-side.
 java.lang.String getLeftInterfaceName()
          Returns an interface name of the left Channel-side.
 Plug[] getPro(Plug proPlug)
          Returns the array of same-side objects (Plugs).
 Plug[] getRight()
          Returns the array of right-side objects (Plugs).
 int getRightCount()
          Returns the right Channel-side count.
 java.lang.Object getRightInterface()
          Returns the interface object of the right Channel-side.
 java.lang.String getRightInterfaceName()
          Returns an interface name of the right Channel-side.
 boolean isLeft(Plug oldPlug)
          Is the given Plug connected to the left Channel-side?
 boolean isRight(Plug oldPlug)
          Is the given Plug connected to the right Channel-side?
 boolean prepare()
          Prepares the Channel to regular operation.
 java.lang.Object setInterface(java.lang.Object newInterface, Plug called)
          Sets new interface object for the given Channel-side.
 void setInterfaceNames(java.lang.String _leftInterfaceName, java.lang.String _rightInterfaceName)
          (Re-)initialize both interface names.
 java.lang.Object setLeftInterface(java.lang.Object newLeftInterface)
          Sets new interface object for the left Channel-side.
 java.lang.Object setRightInterface(java.lang.Object newRightInterface)
          Sets new interface object for the right Channel-side.
 

Method Detail

setInterfaceNames

void setInterfaceNames(java.lang.String _leftInterfaceName,
                       java.lang.String _rightInterfaceName)
(Re-)initialize both interface names.

Parameters:
_leftInterfaceName - Fully-qualified interface name of the left side (called from the right side).
_rightInterfaceName - Fully-qualified interface name of the right side (called from the left side).
See Also:
getLeftInterfaceName(), getRightInterfaceName()

getLeftInterfaceName

java.lang.String getLeftInterfaceName()
Returns an interface name of the left Channel-side.

Returns:
Fully-qualified interface name of the left side (called from the right side).
See Also:
setInterfaceNames(java.lang.String, java.lang.String), getRightInterfaceName()

getRightInterfaceName

java.lang.String getRightInterfaceName()
Returns an interface name of the right Channel-side.

Returns:
Fully-qualified interface name of the right side (called from the left side).
See Also:
setInterfaceNames(java.lang.String, java.lang.String), getLeftInterfaceName()

getInterfaceNamePro

java.lang.String getInterfaceNamePro(Plug proPlug)
Returns an interface name of the same Channel-side.

Parameters:
proPlug - The Plug connected to the same side.
Returns:
Fully-qualified interface name of the given Channel-side.
See Also:
getInterfaceNameAnti(cz.cuni.jagrlib.Plug)

getInterfaceNameAnti

java.lang.String getInterfaceNameAnti(Plug antiPlug)
Returns an interface name of the opposite Channel-side.

Parameters:
antiPlug - The Plug connected to the opposite side.
Returns:
Fully-qualified interface name of the given Channel-side.
See Also:
getInterfaceNamePro(cz.cuni.jagrlib.Plug)

setLeftInterface

java.lang.Object setLeftInterface(java.lang.Object newLeftInterface)
Sets new interface object for the left Channel-side.

Parameters:
newLeftInterface - New interface object (= object called from the opposite side).
Returns:
The old interface object or null.
See Also:
setRightInterface(java.lang.Object), setInterface(java.lang.Object, cz.cuni.jagrlib.Plug)

setRightInterface

java.lang.Object setRightInterface(java.lang.Object newRightInterface)
Sets new interface object for the right Channel-side.

Parameters:
newRightInterface - New interface object (= object called from the opposite side).
Returns:
The old interface object or null.
See Also:
setLeftInterface(java.lang.Object), setInterface(java.lang.Object, cz.cuni.jagrlib.Plug)

setInterface

java.lang.Object setInterface(java.lang.Object newInterface,
                              Plug called)
Sets new interface object for the given Channel-side. The side is defined by the Piece connected to it.

Parameters:
newInterface - New interface object (= object called from the opposite side).
called - The Plug defining the side.
Returns:
The old interface object or null.
See Also:
setLeftInterface(java.lang.Object), setRightInterface(java.lang.Object)

getLeftInterface

java.lang.Object getLeftInterface()
Returns the interface object of the left Channel-side.

Returns:
The interface object or null.
See Also:
setLeftInterface(java.lang.Object)

getRightInterface

java.lang.Object getRightInterface()
Returns the interface object of the right Channel-side.

Returns:
The interface object or null.
See Also:
setRightInterface(java.lang.Object)

getInterface

java.lang.Object getInterface(Plug caller)
Returns the interface object of the given Channel-side. The side is defined by the Plug which calls it.

Parameters:
caller - The Plug defining the opposite (caller) side.
Returns:
The interface object or null.
See Also:
setInterface(java.lang.Object, cz.cuni.jagrlib.Plug)

connectLeft

void connectLeft(Plug newPlug)
Connects a new Plug to the left Channel-side. Updates the Plug's Piece, too.

Parameters:
newPlug - The Plug to be connected.
See Also:
connectRight(cz.cuni.jagrlib.Plug)

connectRight

void connectRight(Plug newPlug)
Connects a new Plug to the right Channel-side. Updates the Plug's Piece, too.

Parameters:
newPlug - The Plug to be connected.
See Also:
connectLeft(cz.cuni.jagrlib.Plug)

connectPro

void connectPro(Plug newPlug,
                Plug proPlug)
Connects a new Plug to the same Channel-side. Updates the Plug's Piece, too.

Parameters:
newPlug - The Plug to be connected.
proPlug - The Plug connected to the same side.
See Also:
connectAnti(cz.cuni.jagrlib.Plug, cz.cuni.jagrlib.Plug)

connectAnti

void connectAnti(Plug newPlug,
                 Plug antiPlug)
Connects a new Plug to the opposite Channel-side. Updates the Plug's Piece, too.

Parameters:
newPlug - The Plug to be connected.
antiPlug - The Plug connected to the opposite side.
See Also:
connectPro(cz.cuni.jagrlib.Plug, cz.cuni.jagrlib.Plug)

disconnect

void disconnect(Plug oldPlug)
Disconnects the old Plug from the Channel. Updates the Plug's Piece, too.

Parameters:
oldPlug - The Plug to be disconnected.
See Also:
disconnectAll()

disconnectAll

void disconnectAll()
Disconnects all Plugs from the Channel. Updates the Plug's Piece, too.

See Also:
disconnect(cz.cuni.jagrlib.Plug)

getLeftCount

int getLeftCount()
Returns the left Channel-side count.

Returns:
The left-side count (number of Plugs connected to that side).
See Also:
getRightCount()

getRightCount

int getRightCount()
Returns the right Channel-side count.

Returns:
The right-side count (number of Plugs connected to that side).
See Also:
getLeftCount()

isLeft

boolean isLeft(Plug oldPlug)
Is the given Plug connected to the left Channel-side?

Parameters:
oldPlug - The checked Plug.
Returns:
true if the given Plug is connected to the left side.
See Also:
isRight(cz.cuni.jagrlib.Plug)

isRight

boolean isRight(Plug oldPlug)
Is the given Plug connected to the right Channel-side?

Parameters:
oldPlug - The checked Plug.
Returns:
true if the given Plug is connected to the right side.
See Also:
isLeft(cz.cuni.jagrlib.Plug)

getLeft

Plug[] getLeft()
Returns the array of left-side objects (Plugs).

Returns:
The array of Plugs connected to the left side.

getRight

Plug[] getRight()
Returns the array of right-side objects (Plugs).

Returns:
The array of Plugs connected to the right side.

getPro

Plug[] getPro(Plug proPlug)
Returns the array of same-side objects (Plugs).

Parameters:
proPlug - The Plug connected to the same side.
Returns:
The array of Plugs.

getAnti

Plug[] getAnti(Plug antiPlug)
Returns the array of opposite-side objects (Plugs).

Parameters:
antiPlug - The Plug connected to the opposite side.
Returns:
The array of Plugs.

prepare

boolean prepare()
Prepares the Channel to regular operation.

Returns:
true if everything is OK (Channel is prepared for operation).