DRCL J-Sim API

drcl.comp
Class Port

java.lang.Object
  extended bydrcl.DrclObj
      extended bydrcl.comp.Port
All Implemented Interfaces:
java.lang.Cloneable, ObjectCloneable, ObjectDuplicable, java.io.Serializable

public class Port
extends DrclObj

The implementation of a port in the autonomous component architecture (ACA). A port has separate input and output channels. Each channel can be connected to a different Wire. The wire that is connected to the input channel is called the "in-wire" of the port. The wire that is connected to the output channel is called the "out-wire" of the port. Use getInWire() and getOutWire() to access those wires.

See Also:
Component, Wire, Serialized Form

Field Summary
static boolean EXECUTION_BOUNDARY
          Set to true to make ports created from now execution boundary.
 java.lang.String groupID
          ID of the port group this port belongs to.
 Component host
           
 java.lang.String id
          ID of the port, unique in the port group it belongs to.
static int PortType_EVENT
          The event port type
static int PortType_FORK
          The fork port type
static int PortType_IN
          The input-only port type.
static int PortType_INOUT
          The duplex port type.
static int PortType_OUT
          The output-only port type.
static int PortType_SERVER
          The server port type
static java.lang.Object SEND_RCV_REQUEST
           
 
Constructor Summary
Port()
          Constructor, default duplex port type.
Port(int type_)
          Constructor, with specified port type.
Port(int type_, boolean exeBoundary_)
          Constructor, with specified port type and properties.
 
Method Summary
 boolean _isEventExportEnabled()
           
 boolean anyClient()
          Clients = InClients + OutClients.
 boolean anyConnection()
          Returns true if the port connects to or shadows for at least one port.
 boolean anyOutConnection()
          Returns true if the port connects to or shadows for at least one port.
 boolean anyPeer()
          Any peer conntected to this port?
 void attachIn(Port p_)
          Attaches the port to the IN wire for receiving data from the wire.
 void attachIn(Port[] pp_)
          Attaches the ports to the IN wire for receiving data from the wire.
 void attachOut(Port p_)
          Attaches the port to the OUT wire for receiving data from the wire.
 void attachOut(Port[] pp_)
          Attaches the ports to the OUT wire for receiving data from the wire.
 boolean connect(Port peer_)
          Bi-direction connection, consider proxying.
 void connect(Port[] pp_)
          Disconnects from the given ports.
 boolean connectTo(Port peer_)
          Uni-direction connection, consider proxying.
 void connectTo(Port[] pp_)
          Connects to the given ports.
 void detachIn(Port p_)
          Removes the port from the IN wire.
 void detachIn(Port[] pp_)
          Removes the ports from the IN wire.
 void detachOut(Port p_)
          Removes the port from the OUT wire.
 void detachOut(Port[] pp_)
          Removes the port from the OUT wire.
 void disconnect()
          Disconnect with all peers.
 void disconnectClients()
           
 void disconnectInWire()
          Disconnect with all peers and clients on the IN wire.
 void disconnectOutWire()
          Disconnect with all peers and clients on the OUT wire.
 void disconnectPeers()
          Removes peers from the wires attached with this port.
 void disconnectWithParent()
           
 void doLastSending(java.lang.Object data_)
          Same as doSending(Object) in terms of functionality.
 void doSending(java.lang.Object data_)
          Called by the host component to send data at this port.
 void duplicate(java.lang.Object source_)
          Duplicates the content of the port from source_.
 void exportEvent(java.lang.String evtName_, double value_, java.lang.String evtDescription_)
           
 void exportEvent(java.lang.String evtName_, java.lang.Object evtObj_, java.lang.String evtDescription_)
           
 Port[] getAncestors()
          Returns all the ancestor ports (def: the host of which contains the host of this port.
 Port[] getClients()
          Clients = InClients + OutClients.
 Port[] getConceptualClients()
          ConceptualClients = ConceptualOutClients + ConceptualInClients.
 Port[] getConceptualInClients()
          ConceptualInClients: the InClients that belong to direct child components.
 Port[] getConceptualInPeers()
          ConceptualInPeers: the InPeers except those are hidden by outer components.
 Port[] getConceptualOutClients()
          ConceptualOutClients: the OutClients that belong to direct child components.
 Contract getContract()
           
 int getFlag()
           
 java.lang.String getGroupID()
          Get the id of the group this port belongs to.
 Component getHost()
          Returns the host component.
 java.lang.String getID()
          Returns the id of the port.
 Port[] getInAncestors()
          Returns all the ancestor in ports (def: the host of which contains the host of this port.
 Port[] getInClients()
          InClients: the set of ports at which if data is sent, the data would arrive at this port.
 Port[] getInPeers()
          InPeers: if data is sent at this port, the set of ports (including shadow ports) at which the data would arrive.
 Port[] getInShadows()
           
 Wire getInWire()
           
 Port[] getOutAncestors()
          Returns all the ancestor out ports (def: the host of which contains the host of this port.
 Port[] getOutClients()
          OutClients: the set of ports at which if data is sent, the data would arrive at this port.
 Port[] getOutPeers()
          OutPeers: the set of ports (including shadow ports) at which if data is sent, the data would arrive at this port.
 Port[] getOutShadows()
           
 Wire getOutWire()
           
 Port[] getParentPeers()
          Returns host's ancestor's peers and the shadow ports.
 Port[] getPeers()
          Peers = InPeers + OutPeers.
 Port[] getShadows()
           
 int getType()
           
 java.lang.String getTypeInString()
          Returns the port type of this port.
 java.lang.String info()
           
 void inoutSplit()
          Splits the "IN" wire/"OUT" wire of this port.
 boolean isConnectedWith(Port p_)
           
 boolean isDataTraceEnabled()
           
 boolean isEventExportEnabled()
           
 boolean isExecutionBoundary()
           
 boolean isRemovable()
           
 boolean isSendTraceEnabled()
           
 boolean isShadow()
           
 void reset()
           
 java.lang.Object sendReceive(java.lang.Object data_)
           
 boolean set(java.lang.String gid_, java.lang.String id_)
          Sets the group ID and port ID of this port.
 void setDataTraceEnabled(boolean enabled_)
           
 void setEventExportEnabled(boolean enabled_)
           
 void setExecutionBoundary(boolean flag_)
           
 boolean setGroupID(java.lang.String groupID_)
          Sets the id of the group this port belongs to.
 void setHost(Component host_)
          Sets the host component.
 boolean setID(java.lang.String id_)
          Set the id of the port, unique in the port group it belongs to.
 void setRemovable(boolean flag_)
           
 void setSendTraceEnabled(boolean enabled_)
           
 void setShadow(boolean flag_)
           
 void setTraceEnabled(boolean enabled_)
           
 void setType(int type_)
           
 void setType(java.lang.String type_)
           
 java.lang.String toString()
          Returns the full path.
 
Methods inherited from class drcl.DrclObj
clone
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EXECUTION_BOUNDARY

public static boolean EXECUTION_BOUNDARY
Set to true to make ports created from now execution boundary.


PortType_INOUT

public static final int PortType_INOUT
The duplex port type.

See Also:
Constant Field Values

PortType_IN

public static final int PortType_IN
The input-only port type.

See Also:
Constant Field Values

PortType_OUT

public static final int PortType_OUT
The output-only port type.

See Also:
Constant Field Values

PortType_SERVER

public static final int PortType_SERVER
The server port type

See Also:
Constant Field Values

PortType_EVENT

public static final int PortType_EVENT
The event port type

See Also:
Constant Field Values

PortType_FORK

public static final int PortType_FORK
The fork port type

See Also:
Constant Field Values

groupID

public java.lang.String groupID
ID of the port group this port belongs to. Must use setGroupID(String) or set(String, String) to set the group ID of a port because it affects the bookkeeping in the host component.


id

public java.lang.String id
ID of the port, unique in the port group it belongs to. Must use setID(String) or set(String, String) to set the ID of a port because it affects the bookkeeping in the host component.

See Also:
groupID

host

public Component host

SEND_RCV_REQUEST

public static final java.lang.Object SEND_RCV_REQUEST
Constructor Detail

Port

public Port()
Constructor, default duplex port type.


Port

public Port(int type_)
Constructor, with specified port type.


Port

public Port(int type_,
            boolean exeBoundary_)
Constructor, with specified port type and properties.

Method Detail

reset

public final void reset()

setHost

public final void setHost(Component host_)
Sets the host component.


getHost

public final Component getHost()
Returns the host component.


setGroupID

public final boolean setGroupID(java.lang.String groupID_)
Sets the id of the group this port belongs to. Returns false if failed.


getGroupID

public final java.lang.String getGroupID()
Get the id of the group this port belongs to.


setID

public final boolean setID(java.lang.String id_)
Set the id of the port, unique in the port group it belongs to. Returns false if failed.


set

public final boolean set(java.lang.String gid_,
                         java.lang.String id_)
Sets the group ID and port ID of this port.


getID

public final java.lang.String getID()
Returns the id of the port.


setType

public final void setType(int type_)

setType

public final void setType(java.lang.String type_)

getTypeInString

public final java.lang.String getTypeInString()
Returns the port type of this port.


getType

public final int getType()

setExecutionBoundary

public final void setExecutionBoundary(boolean flag_)

isExecutionBoundary

public final boolean isExecutionBoundary()

getFlag

public final int getFlag()

setRemovable

public final void setRemovable(boolean flag_)

isRemovable

public final boolean isRemovable()

setTraceEnabled

public final void setTraceEnabled(boolean enabled_)

setDataTraceEnabled

public final void setDataTraceEnabled(boolean enabled_)

isDataTraceEnabled

public final boolean isDataTraceEnabled()

setSendTraceEnabled

public final void setSendTraceEnabled(boolean enabled_)

isSendTraceEnabled

public final boolean isSendTraceEnabled()

setEventExportEnabled

public final void setEventExportEnabled(boolean enabled_)

isEventExportEnabled

public final boolean isEventExportEnabled()

isShadow

public final boolean isShadow()

setShadow

public void setShadow(boolean flag_)

getContract

public final Contract getContract()

getOutWire

public Wire getOutWire()

getInWire

public Wire getInWire()

anyConnection

public final boolean anyConnection()
Returns true if the port connects to or shadows for at least one port.


anyOutConnection

public final boolean anyOutConnection()
Returns true if the port connects to or shadows for at least one port.


anyClient

public final boolean anyClient()
Clients = InClients + OutClients.

See Also:
{@link #getInClients()}, {@link #getOutClients()}

getClients

public final Port[] getClients()
Clients = InClients + OutClients.

See Also:
{@link #getInClients()}, {@link #getOutClients()}

getOutClients

public final Port[] getOutClients()
OutClients: the set of ports at which if data is sent, the data would arrive at this port.


getInClients

public final Port[] getInClients()
InClients: the set of ports at which if data is sent, the data would arrive at this port.


getConceptualClients

public final Port[] getConceptualClients()
ConceptualClients = ConceptualOutClients + ConceptualInClients.

See Also:
{@link #getConceptualInClients()}, {@link #getConceptualOutClients()}

getConceptualOutClients

public final Port[] getConceptualOutClients()
ConceptualOutClients: the OutClients that belong to direct child components.


getConceptualInClients

public final Port[] getConceptualInClients()
ConceptualInClients: the InClients that belong to direct child components.


anyPeer

public final boolean anyPeer()
Any peer conntected to this port? Peer = InPeer or OutPeer.

See Also:
{@link #getInPeers()}, {@link #getOutPeers()}

getPeers

public final Port[] getPeers()
Peers = InPeers + OutPeers.

See Also:
{@link #getInPeers()}, {@link #getOutPeers()}

getOutPeers

public final Port[] getOutPeers()
OutPeers: the set of ports (including shadow ports) at which if data is sent, the data would arrive at this port.


getInPeers

public final Port[] getInPeers()
InPeers: if data is sent at this port, the set of ports (including shadow ports) at which the data would arrive.


getConceptualInPeers

public final Port[] getConceptualInPeers()
ConceptualInPeers: the InPeers except those are hidden by outer components.


getAncestors

public final Port[] getAncestors()
Returns all the ancestor ports (def: the host of which contains the host of this port.


getOutAncestors

public final Port[] getOutAncestors()
Returns all the ancestor out ports (def: the host of which contains the host of this port.


getInAncestors

public final Port[] getInAncestors()
Returns all the ancestor in ports (def: the host of which contains the host of this port.


getShadows

public final Port[] getShadows()

getOutShadows

public final Port[] getOutShadows()

getInShadows

public final Port[] getInShadows()

getParentPeers

public final Port[] getParentPeers()
Returns host's ancestor's peers and the shadow ports.


isConnectedWith

public boolean isConnectedWith(Port p_)

doSending

public final void doSending(java.lang.Object data_)
Called by the host component to send data at this port.


doLastSending

public final void doLastSending(java.lang.Object data_)
Same as doSending(Object) in terms of functionality. Performance-aware components may use the runtime notifies the runtime


sendReceive

public final java.lang.Object sendReceive(java.lang.Object data_)

connect

public final boolean connect(Port peer_)
Bi-direction connection, consider proxying. Returns true if either direction is set up successfully.


connect

public final void connect(Port[] pp_)
Disconnects from the given ports.


attachIn

public final void attachIn(Port p_)
Attaches the port to the IN wire for receiving data from the wire.


attachIn

public final void attachIn(Port[] pp_)
Attaches the ports to the IN wire for receiving data from the wire.


detachIn

public final void detachIn(Port p_)
Removes the port from the IN wire.


detachIn

public final void detachIn(Port[] pp_)
Removes the ports from the IN wire.


attachOut

public final void attachOut(Port p_)
Attaches the port to the OUT wire for receiving data from the wire.


attachOut

public final void attachOut(Port[] pp_)
Attaches the ports to the OUT wire for receiving data from the wire.


detachOut

public final void detachOut(Port p_)
Removes the port from the OUT wire.


detachOut

public final void detachOut(Port[] pp_)
Removes the port from the OUT wire.


connectTo

public final boolean connectTo(Port peer_)
Uni-direction connection, consider proxying. Returns true if the connection is set up successfully.


connectTo

public final void connectTo(Port[] pp_)
Connects to the given ports.


disconnect

public final void disconnect()
Disconnect with all peers.


disconnectInWire

public final void disconnectInWire()
Disconnect with all peers and clients on the IN wire.


disconnectOutWire

public final void disconnectOutWire()
Disconnect with all peers and clients on the OUT wire.


disconnectPeers

public final void disconnectPeers()
Removes peers from the wires attached with this port.


disconnectClients

public final void disconnectClients()

disconnectWithParent

public final void disconnectWithParent()

inoutSplit

public void inoutSplit()
Splits the "IN" wire/"OUT" wire of this port.


exportEvent

public final void exportEvent(java.lang.String evtName_,
                              java.lang.Object evtObj_,
                              java.lang.String evtDescription_)

exportEvent

public final void exportEvent(java.lang.String evtName_,
                              double value_,
                              java.lang.String evtDescription_)

_isEventExportEnabled

public final boolean _isEventExportEnabled()

duplicate

public final void duplicate(java.lang.Object source_)
Duplicates the content of the port from source_. This method is meant to be invoked by Component. It only duplicates the flag. ID, groupID and wires are not copied.

Specified by:
duplicate in interface ObjectDuplicable
Overrides:
duplicate in class DrclObj

toString

public final java.lang.String toString()
Returns the full path.

Overrides:
toString in class DrclObj

info

public final java.lang.String info()

DRCL J-Sim API

Copyright © 1998-2003 Distributed Real-time Computing Lab (DRCL). All Rights Reserved.     ~ To J-Sim Home ~