edu.jhu.ece.iacl.jist.pipeline
Class PipePort<T>

java.lang.Object
  extended by edu.jhu.ece.iacl.jist.pipeline.PipePort<T>
Direct Known Subclasses:
ParamModel, PipeChildPort, PipeParentPort

public abstract class PipePort<T>
extends java.lang.Object

The Class PipePort.


Nested Class Summary
static interface PipePort.PortListener
          Listener class to monitor for changes to a port.
static class PipePort.type
          Differentiate between input and output ports.
 
Field Summary
protected  boolean connectible
          Indicates if this port can be connected to.
protected  PipeModulePort gport
          Rendering port component.
protected  java.util.Vector<PipeConnector> incomingConnectors
          incoming connectors attached to this port.
protected  java.util.Vector<PipePort.PortListener> listeners
          Listeners that are called when port is connected or disconnected.
protected  int maxIncoming
          Maximum number of incoming ports.
protected  int maxOutgoing
          Maximum number of outgoing ports.
protected  java.util.Vector<PipeConnector> outgoingConnectors
          outgoing connectors attached to this port.
protected  PipeModule owner
          Module that this port is attached to.
protected  PipePort.type portType
          indicates whether this is an input or output port.
protected  boolean useWire
          Flag indicating whether the user prefers to use a connector or not for this port.
 
Constructor Summary
PipePort()
          Default constructor.
PipePort(PipeModule owner, PipePort.type type)
          Default constructor.
 
Method Summary
 void addListener(PipePort.PortListener listener)
          Add listener.
abstract  PipePort clone()
          Clone parameter.
 void disconnect()
          Disconnect all incoming and outgoing connectors.
 void disconnect(int index)
          Disconnect a specific connector.
 void disconnect(PipeConnector wire)
          Remove connector from this port.
 void disconnect(PipePort port)
          Remove all connections between this port and the specified port.
 java.lang.String getDescription()
          Get port description.
 Port getGraphPort()
          Get port to display on graph.
 PipeConnector getIncomingConnector(PipePort src)
          Get incoming connector for specified source.
 java.util.Vector<PipeConnector> getIncomingConnectors()
          Get input connections.
 java.util.Vector<PipePort> getIncomingPorts()
          Get all ports that are connected to this port.
abstract  java.lang.String getLabel()
          Get displayed label.
 java.util.Vector<PipePort.PortListener> getListeners()
          Get all listeners.
 int getMaxIncoming()
          Maximum number of input ports.
 int getMaxOutgoing()
          Get maximum number of outgoing ports.
abstract  java.lang.String getName()
          Get identifying name.
 PipeConnector getOutgoingConnector(PipePort dest)
          Get outgoing connector for specified destination.
 java.util.Vector<PipeConnector> getOutgoingConnectors()
          Get output connections.
 java.util.Vector<PipePort> getOutgoingPorts()
          Get all ports that are connected to this port.
 PipeModule getOwner()
          Module that owns this port.
 PipePort.type getPortType()
          Get port type.
abstract  T getValue()
          Value associated with this port.
abstract  javax.swing.JPanel getView()
          Get panel to render user input to this port.
abstract  void init()
          Initialized data that could not be deserialized.
abstract  boolean isCompatible(PipePort p)
          Check if port is compatible with other port.
 boolean isConnected()
          Returns true if this port is connected to another port.
 boolean isConnectedTo(PipePort p)
          Returns true if this port is connected to the specified port.
 boolean isConnectible()
          Returns true if this port is connectible.
 boolean isInputPort()
          Returns true if this is an input port.
 boolean isOutputPort()
          Returns true if this is an output port.
 void notifyListenersOfConnection()
          Notify port listeners of connections.
 void notifyListenersOfDisconnection(PipePort child, PipeConnector wire)
          Notify port listeners of disconnections.
 void removeAllListeners()
          Remove all listeners.
 void removeListener(PipePort.PortListener listener)
          Remove listener.
 void setConnectable(boolean connectable)
          Set whether this port is connectible.
 void setGraphPort(PipeModulePort p)
          Set port to display on graph.
abstract  void setLabel(java.lang.String label)
          Set label to display next to port.
 void setMaxIncoming(int maxIncoming)
          Set maximum number of input ports.
 void setMaxOutgoing(int maxOutgoing)
          Set maximum number of outgoing ports.
abstract  void setName(java.lang.String name)
          Set name to identify port.
 void setOwner(PipeModule owner)
          Set module that owns this port.
 void setPortType(PipePort.type ty)
          Set port type as either input or output.
 void setUseConnector(boolean useWire)
          Indicate that this port should use a connector instead of a default value.
abstract  void setValue(T value)
          Set value for this parameter.
 java.lang.String toString()
          Get port description.
 boolean usingConnector()
          Returns true if this port should use a connector instead of a default value.
abstract  void validate()
          Validate parameter associated with this port.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

owner

protected PipeModule owner
Module that this port is attached to.


incomingConnectors

protected java.util.Vector<PipeConnector> incomingConnectors
incoming connectors attached to this port.


outgoingConnectors

protected java.util.Vector<PipeConnector> outgoingConnectors
outgoing connectors attached to this port.


portType

protected transient PipePort.type portType
indicates whether this is an input or output port.


maxIncoming

protected transient int maxIncoming
Maximum number of incoming ports. -1 indicates unlimited.


maxOutgoing

protected transient int maxOutgoing
Maximum number of outgoing ports. -1 indicates unlimited.


useWire

protected transient boolean useWire
Flag indicating whether the user prefers to use a connector or not for this port.


gport

protected transient PipeModulePort gport
Rendering port component.


listeners

protected transient java.util.Vector<PipePort.PortListener> listeners
Listeners that are called when port is connected or disconnected.


connectible

protected transient boolean connectible
Indicates if this port can be connected to.

Constructor Detail

PipePort

public PipePort()
Default constructor.


PipePort

public PipePort(PipeModule owner,
                PipePort.type type)
Default constructor.

Parameters:
owner - module that owns this port
type - port type
Method Detail

addListener

public void addListener(PipePort.PortListener listener)
Add listener.

Parameters:
listener - port listener

clone

public abstract PipePort clone()
Clone parameter.

Overrides:
clone in class java.lang.Object
Returns:
the pipe port

disconnect

public void disconnect()
Disconnect all incoming and outgoing connectors.


disconnect

public void disconnect(int index)
Disconnect a specific connector.

Parameters:
index - connector index

disconnect

public void disconnect(PipeConnector wire)
Remove connector from this port.

Parameters:
wire - connector

disconnect

public void disconnect(PipePort port)
Remove all connections between this port and the specified port.

Parameters:
port - the port

getDescription

public java.lang.String getDescription()
Get port description.

Returns:
port description

getGraphPort

public Port getGraphPort()
Get port to display on graph.

Returns:
the graph port

getIncomingConnector

public PipeConnector getIncomingConnector(PipePort src)
Get incoming connector for specified source.

Parameters:
src - source port
Returns:
the incoming connector

getIncomingConnectors

public java.util.Vector<PipeConnector> getIncomingConnectors()
Get input connections.

Returns:
input connections

getIncomingPorts

public java.util.Vector<PipePort> getIncomingPorts()
Get all ports that are connected to this port.

Returns:
the incoming ports

getLabel

public abstract java.lang.String getLabel()
Get displayed label.

Returns:
displayed label

getListeners

public java.util.Vector<PipePort.PortListener> getListeners()
Get all listeners.

Returns:
the listeners

getMaxIncoming

public int getMaxIncoming()
Maximum number of input ports.

Returns:
the max incoming

getMaxOutgoing

public int getMaxOutgoing()
Get maximum number of outgoing ports.

Returns:
the max outgoing

getName

public abstract java.lang.String getName()
Get identifying name.

Returns:
identifying name

getOutgoingConnector

public PipeConnector getOutgoingConnector(PipePort dest)
Get outgoing connector for specified destination.

Parameters:
dest - destination port
Returns:
the outgoing connector

getOutgoingConnectors

public java.util.Vector<PipeConnector> getOutgoingConnectors()
Get output connections.

Returns:
output connections

getOutgoingPorts

public java.util.Vector<PipePort> getOutgoingPorts()
Get all ports that are connected to this port.

Returns:
the outgoing ports

getOwner

public PipeModule getOwner()
Module that owns this port.

Returns:
module owner

getPortType

public PipePort.type getPortType()
Get port type.

Returns:
port type

getValue

public abstract T getValue()
Value associated with this port.

Returns:
the value

getView

public abstract javax.swing.JPanel getView()
Get panel to render user input to this port.

Returns:
the view

init

public abstract void init()
Initialized data that could not be deserialized.


isCompatible

public abstract boolean isCompatible(PipePort p)
Check if port is compatible with other port. This check is not as rigorous as validate.

Parameters:
p - parameter to check against compatibility
Returns:
true is compatible

isConnectible

public boolean isConnectible()
Returns true if this port is connectible.

Returns:
true if connectible

isConnected

public boolean isConnected()
Returns true if this port is connected to another port.

Returns:
true if this port is connected

isConnectedTo

public boolean isConnectedTo(PipePort p)
Returns true if this port is connected to the specified port.

Parameters:
p - port
Returns:
true, if checks if is connected to

isInputPort

public boolean isInputPort()
Returns true if this is an input port.

Returns:
true if input port

isOutputPort

public boolean isOutputPort()
Returns true if this is an output port.

Returns:
true if output port

notifyListenersOfConnection

public void notifyListenersOfConnection()
Notify port listeners of connections.


notifyListenersOfDisconnection

public void notifyListenersOfDisconnection(PipePort child,
                                           PipeConnector wire)
Notify port listeners of disconnections.

Parameters:
child - disconnected port
wire - disconnected connector

removeAllListeners

public void removeAllListeners()
Remove all listeners.


removeListener

public void removeListener(PipePort.PortListener listener)
Remove listener.

Parameters:
listener - port listener

setConnectable

public void setConnectable(boolean connectable)
Set whether this port is connectible.

Parameters:
connectable - true if connectible

setGraphPort

public void setGraphPort(PipeModulePort p)
Set port to display on graph.

Parameters:
p - the port

setLabel

public abstract void setLabel(java.lang.String label)
Set label to display next to port.

Parameters:
label - the label

setMaxIncoming

public void setMaxIncoming(int maxIncoming)
Set maximum number of input ports.

Parameters:
maxIncoming - the max incoming

setMaxOutgoing

public void setMaxOutgoing(int maxOutgoing)
Set maximum number of outgoing ports.

Parameters:
maxOutgoing - the max outgoing

setName

public abstract void setName(java.lang.String name)
Set name to identify port.

Parameters:
name - the name

setOwner

public void setOwner(PipeModule owner)
Set module that owns this port.

Parameters:
owner - module owner

setPortType

public void setPortType(PipePort.type ty)
Set port type as either input or output.

Parameters:
ty - port type

setUseConnector

public void setUseConnector(boolean useWire)
Indicate that this port should use a connector instead of a default value.

Parameters:
useWire - the use wire

setValue

public abstract void setValue(T value)
                       throws InvalidParameterValueException
Set value for this parameter.

Parameters:
value - parameter value
Throws:
InvalidParameterValueException - the invalid parameter value exception

toString

public java.lang.String toString()
Get port description.

Overrides:
toString in class java.lang.Object
Returns:
the string

usingConnector

public boolean usingConnector()
Returns true if this port should use a connector instead of a default value.

Returns:
true, if using connector

validate

public abstract void validate()
                       throws InvalidParameterException
Validate parameter associated with this port.

Throws:
InvalidParameterException - the invalid parameter exception