cz.cuni.jagrlib
Interface Plug

All Known Implementing Classes:
BasicPlug

public interface Plug

Plug is virtual one-sided (local) interface between Piece's inside and its outside - it defines possibility of (and conditions for) connecting Channels to the Piece object.

Since:
0.01
See Also:
Plug.java, Piece, Channel, BasicPlug

Method Summary
 void connectChannel(Channel channel)
          Connects the Channel in the associated Piece.
 boolean disconnectChannel()
          Disconnects the associated channel.
 java.lang.Object getInputInterface()
          Returns the internal (implemented) interface object - to be called from outside.
 java.lang.String getInputInterfaceName()
          Returns the fully-qualified name of an internal (implemented) interface - to be called from outside.
 java.lang.String getKey()
          Gets the access key from associated Template to this Plug.
 java.lang.String getOutputInterfaceName()
          Returns the fully-qualified name of an external (required) interface - to be called from this Piece.
 Piece getPiece()
          Gets the associated Piece.
 Template getTemplate()
          Gets the associated Template.
 boolean isCloneable()
          Can this Plug be cloned?
 boolean isCompatible(Plug pl)
          Compatibility test: Am I compatible with the given Plug?
 boolean isCompatible(java.lang.String iInterface, java.lang.String oInterface, boolean cl, boolean mul)
          Compatibility test: Am I compatible with the given parameters?
 boolean isInput()
          Has this Plug the input capability (can be called from outside)?
 boolean isMandatory()
          Is this Plug mandatory?
 boolean isMulti()
          Can this Plug be used in multi-channels?
 boolean isOpposite(Plug opposite)
          Compatibility test: Am I compatible with the opposite Plug?
 boolean isOutput()
          Has this Plug the output capability (can call other interfaces)?
 

Method Detail

isInput

boolean isInput()
Has this Plug the input capability (can be called from outside)?

Returns:
true if this Plug can be called from outside.
See Also:
getInputInterfaceName(), getInputInterface()

isOutput

boolean isOutput()
Has this Plug the output capability (can call other interfaces)?

Returns:
true if this Plug can call other interfaces.
See Also:
getOutputInterfaceName()

isMandatory

boolean isMandatory()
Is this Plug mandatory?

Returns:
true if this Plug is mandatory (has to be connected).

isMulti

boolean isMulti()
Can this Plug be used in multi-channels?

Returns:
true if this Plug can be connected to multi-channel.

isCloneable

boolean isCloneable()
Can this Plug be cloned? For filters with variable number of (input) channels.
Sibling channels should have access keys with common prefix - integer numbers starting from 0 will be appended.

Returns:
true if this Plug can be cloned.
See Also:
getKey()

getInputInterfaceName

java.lang.String getInputInterfaceName()
Returns the fully-qualified name of an internal (implemented) interface - to be called from outside.

Returns:
Fully-qualified name of the interface or null if it is not used.
See Also:
isInput()

getOutputInterfaceName

java.lang.String getOutputInterfaceName()
Returns the fully-qualified name of an external (required) interface - to be called from this Piece.

Returns:
Fully-qualified name of the interface or null if it is not used.
See Also:
isOutput()

getInputInterface

java.lang.Object getInputInterface()
Returns the internal (implemented) interface object - to be called from outside.

Returns:
The internal (implemented) interface object or null.

getTemplate

Template getTemplate()
Gets the associated Template. For topological purposes only.

Returns:
The associated Template or null.
See Also:
getKey(), getPiece()

getPiece

Piece getPiece()
Gets the associated Piece. For topological purposes only.

Returns:
The associated Piece or null.
See Also:
getKey(), getTemplate()

getKey

java.lang.String getKey()
Gets the access key from associated Template to this Plug. For topological purposes only.

Returns:
The access key or null.
See Also:
getTemplate()

isCompatible

boolean isCompatible(java.lang.String iInterface,
                     java.lang.String oInterface,
                     boolean cl,
                     boolean mul)
Compatibility test: Am I compatible with the given parameters?

Parameters:
iInterface - Required input interface (or null).
oInterface - Required output interface (or null).
cl - Is the cloneability required?.
mul - Is the multi-channel property required?.
Returns:
true if I'm able to implement the given interface.

isCompatible

boolean isCompatible(Plug pl)
Compatibility test: Am I compatible with the given Plug?

Parameters:
pl - The checked Plug.
Returns:
true if I'm comptible with the given Plug.

isOpposite

boolean isOpposite(Plug opposite)
Compatibility test: Am I compatible with the opposite Plug?

Parameters:
opposite - The opposite Plug.
Returns:
true if I'm compatible with the opposite Plug.

connectChannel

void connectChannel(Channel channel)
Connects the Channel in the associated Piece.

Parameters:
channel - The Channel to be connected to this Plug.

disconnectChannel

boolean disconnectChannel()
Disconnects the associated channel.

Returns:
true if there was a Channel connected.