|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.jagrlib.BasicChannel
public class BasicChannel
Simple Channel
implementation. HashSets are used for left- and
right-side connections.
Field Summary | |
---|---|
protected java.lang.Object |
leftInterface
Interface object for the left-side (called by right-side Piece [s]). |
protected java.lang.String |
leftInterfaceName
Fully-qualified interface name of the left side (called from the right side). |
protected java.util.HashSet<Plug> |
leftSet
Set of Plug s connected to the left side. |
protected java.lang.Object |
rightInterface
Interface object for the right-side (called by left-side Piece [s]). |
protected java.lang.String |
rightInterfaceName
Fully-qualified interface name of the right side (called from the left side). |
protected java.util.HashSet<Plug> |
rightSet
Set of Plug s connected to the right side. |
Constructor Summary | |
---|---|
BasicChannel(java.lang.String _leftInterfaceName,
java.lang.String _rightInterfaceName)
Initializing constructor. |
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 Plug s from the Channel . |
Plug[] |
getAnti(Plug antiPlug)
Returns the array of opposite-side objects ( Plug s). |
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 ( Plug s). |
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 ( Plug s). |
Plug[] |
getRight()
Returns the array of right-side objects ( Plug s). |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String leftInterfaceName
protected java.lang.Object leftInterface
Piece
[s]).
protected java.util.HashSet<Plug> leftSet
Plug
s connected to the left side.
protected java.lang.String rightInterfaceName
protected java.lang.Object rightInterface
Piece
[s]).
protected java.util.HashSet<Plug> rightSet
Plug
s connected to the right side.
Constructor Detail |
---|
public BasicChannel(java.lang.String _leftInterfaceName, java.lang.String _rightInterfaceName)
_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).setInterfaceNames(java.lang.String, java.lang.String)
Method Detail |
---|
public void setInterfaceNames(java.lang.String _leftInterfaceName, java.lang.String _rightInterfaceName)
setInterfaceNames
in interface Channel
_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).getLeftInterfaceName()
,
getRightInterfaceName()
public java.lang.String getLeftInterfaceName()
getLeftInterfaceName
in interface Channel
setInterfaceNames(java.lang.String, java.lang.String)
,
getRightInterfaceName()
public java.lang.String getRightInterfaceName()
getRightInterfaceName
in interface Channel
setInterfaceNames(java.lang.String, java.lang.String)
,
getLeftInterfaceName()
public java.lang.String getInterfaceNamePro(Plug proPlug)
getInterfaceNamePro
in interface Channel
proPlug
- The Plug
connected to the same side.
getInterfaceNameAnti(cz.cuni.jagrlib.Plug)
public java.lang.String getInterfaceNameAnti(Plug antiPlug)
getInterfaceNameAnti
in interface Channel
antiPlug
- The Plug
connected to the opposite side.
getInterfaceNamePro(cz.cuni.jagrlib.Plug)
public java.lang.Object setLeftInterface(java.lang.Object newLeftInterface)
setLeftInterface
in interface Channel
newLeftInterface
- New interface object (= object called from the opposite side).
null
.setRightInterface(java.lang.Object)
,
setInterface(java.lang.Object, cz.cuni.jagrlib.Plug)
public java.lang.Object setRightInterface(java.lang.Object newRightInterface)
setRightInterface
in interface Channel
newRightInterface
- New interface object (= object called from the opposite side).
null
.setLeftInterface(java.lang.Object)
,
setInterface(java.lang.Object, cz.cuni.jagrlib.Plug)
public java.lang.Object setInterface(java.lang.Object newInterface, Plug called)
Plug
connected to it.
setInterface
in interface Channel
newInterface
- New interface object (= object called from the opposite side).called
- The Plug
defining the side.
null
.setLeftInterface(java.lang.Object)
,
setRightInterface(java.lang.Object)
public java.lang.Object getLeftInterface()
getLeftInterface
in interface Channel
null
.setLeftInterface(java.lang.Object)
public java.lang.Object getRightInterface()
getRightInterface
in interface Channel
null
.setRightInterface(java.lang.Object)
public java.lang.Object getInterface(Plug caller)
Plug
which calls it.
getInterface
in interface Channel
caller
- The Plug
defining the opposite (caller) side.
null
.setInterface(java.lang.Object, cz.cuni.jagrlib.Plug)
public void connectLeft(Plug newPlug)
Plug
to the left Channel-side.
Updates the Plug
's Piece
, too.
connectLeft
in interface Channel
newPlug
- The Plug
to be connected.connectRight(cz.cuni.jagrlib.Plug)
public void connectRight(Plug newPlug)
Plug
to the right Channel-side.
connectRight
in interface Channel
newPlug
- The Plug
to be connected.connectLeft(cz.cuni.jagrlib.Plug)
public void connectPro(Plug newPlug, Plug proPlug)
Plug
to the same Channel-side.
connectPro
in interface Channel
newPlug
- The Plug
to be connected.proPlug
- The Plug
connected to the same side.connectAnti(cz.cuni.jagrlib.Plug, cz.cuni.jagrlib.Plug)
public void connectAnti(Plug newPlug, Plug antiPlug)
Plug
to the opposite Channel-side.
connectAnti
in interface Channel
newPlug
- The Plug
to be connected.antiPlug
- The Plug
connected to the opposite side.connectPro(cz.cuni.jagrlib.Plug, cz.cuni.jagrlib.Plug)
public void disconnect(Plug oldPlug)
Plug
from the Channel
.
disconnect
in interface Channel
oldPlug
- The Plug
to be disconnected.disconnectAll()
public void disconnectAll()
Plug
s from the Channel
.
disconnectAll
in interface Channel
disconnect(cz.cuni.jagrlib.Plug)
public int getLeftCount()
getLeftCount
in interface Channel
Plug
s connected to that side).getRightCount()
public int getRightCount()
getRightCount
in interface Channel
Plug
s connected to that side).getLeftCount()
public boolean isLeft(Plug oldPlug)
Plug
connected to the left Channel-side?
isLeft
in interface Channel
oldPlug
- The checked Plug
.
Plug
is connected to the left side.isRight(cz.cuni.jagrlib.Plug)
public boolean isRight(Plug oldPlug)
Plug
connected to the right Channel-side?
isRight
in interface Channel
oldPlug
- The checked Plug
.
Plug
is connected to the right side.isLeft(cz.cuni.jagrlib.Plug)
public Plug[] getLeft()
Plug
s).
getLeft
in interface Channel
Plug
s connected to the left side.public Plug[] getRight()
Plug
s).
getRight
in interface Channel
Plug
s connected to the right side.public Plug[] getPro(Plug proPlug)
Plug
s).
getPro
in interface Channel
proPlug
- The Plug
connected to the same side.
Plug
s.public Plug[] getAnti(Plug antiPlug)
Plug
s).
getAnti
in interface Channel
antiPlug
- The Plug
connected to the opposite side.
Plug
s.public boolean prepare()
Channel
to regular operation.
prepare
in interface Channel
Channel
is prepared
for operation).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |