|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.kernel.Port
ptolemy.kernel.ComponentPort
ptolemy.actor.IOPort
public class IOPort
This class supports exchanging data between entities via message passing. It can serve as an input port, an output port, or both. If it is an input port, then it contains some number of receivers, which are responsible for receiving data from remote entities. If it is an output port, then it can send data to remote receivers.
Its receivers are created by a director. It must therefore be contained by an actor that has a director. If it is not, then any attempt to read data or list the receivers will trigger an exception.
If this port is at the boundary of an composite actor, then it can have both inside and outside links, with corresponding inside and outside receivers if it opaque. The inside links are to relations inside the opaque composite actor, whereas the outside links are to relations outside. If it is not specified, then a link is an outside link.
The port has a width, which by default is constrained to be either zero or one. The width is the sum of the widths of the linked relations. A port with a width greater than one behaves as a bus interface, so if the width is w, then the port can simultaneously handle w distinct input or output channels of data.
In general, an input port might have more than one receiver for each channel. This occurs particularly for transparent input ports, which treat the receivers of the ports linked on the inside as its own. This might also occur for opaque ports in some derived classes. Each receiver in the group is sent the same data. Thus, an input port in general will have w distinct groups of receivers, and can receive w distinct channels.
By default, the maximum width of the port is one, so only one channel is handled. A port that allows a width greater than one is called a multiport. Calling setMultiport() with a true argument converts the port to a multiport.
The width of the port is not set directly. It is the sum of the widths of the relations that the port is linked to on the outside. The sum of the widths of the relations linked on the inside can be more or less than the width. If it is more, then the excess inside relations will be treated as if they are unconnected. If it is less, then the excess outside relations will be treated as if they are unconnected.
An IOPort can only link to instances of IORelation. Derived classes may further constrain links to a subclass of IORelation. To do this, they should override the protected methods _checkLink() and _checkLiberalLink() to throw an exception if their arguments are not of the appropriate type. Similarly, an IOPort can only be contained by a class derived from ComponentEntity and implementing the Actor interface. Subclasses may further constrain the containers by overriding the protected method _checkContainer().
| Red (neuendor) |
| Green (eal) |
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj |
|---|
NamedObj.ContainedObjectsIterator |
| Field Summary | |
|---|---|
protected boolean |
_hasPortEventListeners
Flag that is true if there are port event listeners. |
protected java.util.LinkedList |
_portEventListeners
The list of IOPortEventLsteners registered with this object. |
static int |
CONFIGURATION
Indicate that the description(int) method should include information about whether the port is an input, output, or multiport, whether it is opaque, and what is its width. |
static int |
RECEIVERS
Indicate that the description(int) method should include receivers contained by this port (if any). |
static int |
REMOTERECEIVERS
Indicate that the description(int) method should include receivers remotely connected to this port (if any). |
| Fields inherited from class ptolemy.kernel.Port |
|---|
_insideLinks, _relationsList |
| Fields inherited from class ptolemy.kernel.util.NamedObj |
|---|
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
| Constructor Summary | |
|---|---|
IOPort()
Construct an IOPort with no container and no name that is neither an input nor an output. |
|
IOPort(ComponentEntity container,
java.lang.String name)
Construct an IOPort with a containing actor and a name that is neither an input nor an output. |
|
IOPort(ComponentEntity container,
java.lang.String name,
boolean isInput,
boolean isOutput)
Construct an IOPort with a container and a name that is either an input, an output, or both, depending on the third and fourth arguments. |
|
IOPort(Workspace workspace)
Construct a port in the specified workspace with an empty string as a name. |
|
| Method Summary | |
|---|---|
protected void |
_checkContainer(Entity container)
Check that the specified container implements the Actor interface (or is null). |
protected void |
_checkLiberalLink(Relation relation)
Override parent method to ensure compatibility of the relation and validity of the width of the port. |
protected void |
_checkLink(Relation relation)
Override parent method to ensure compatibility of the relation and validity of the width of the port. |
protected java.lang.String |
_description(int detail,
int indent,
int bracket)
Return a description of the object. |
protected void |
_exportMoMLContents(java.io.Writer output,
int depth)
Write a MoML description of the contents of this object, which in this class is the attributes plus possibly a special attribute to indicate whether the port is a multiport. |
protected int |
_getInsideWidth(IORelation except)
Return the sums of the widths of the relations linked on the inside, except the specified relation. |
protected int |
_getOutsideWidth(IORelation except)
Return the sums of the widths of the relations linked on the outside, except the specified relation. |
protected Receiver[][] |
_getReceiversLinkedToGroup(IORelation relation,
int occurrence)
If the port is an input, return receivers that handle incoming channels from the specified relation or any relation in its relation group. |
protected Receiver |
_newInsideReceiver()
Create a new receiver compatible with the local director. |
protected Receiver |
_newReceiver()
Create a new receiver compatible with the executive director. |
protected void |
_notifyPortEventListeners(IOPortEvent event)
Send a PortEvent to all port event listeners that have registered with this IOPort. |
protected void |
_removeReceivers(Relation relation)
Remove the receivers associated with the specified relation, if there are any. |
void |
addIOPortEventListener(IOPortEventListener listener)
Append a listener to the current set of port event listeners. |
void |
broadcast(Token token)
Send a token to all connected receivers. |
void |
broadcast(Token[] tokenArray,
int vectorLength)
Send the specified portion of a token array to all receivers connected to this port. |
void |
broadcastClear()
Set all receivers connected on the outside to have no tokens. |
java.lang.Object |
clone(Workspace workspace)
Clone this port into the specified workspace. |
Token |
convert(Token token)
Convert the specified token into a token acceptable to this port. |
void |
createReceivers()
Create new receivers for this port, replacing any that may previously exist, and validate any instances of Settable that this port may contain. |
java.util.List |
deepConnectedInPortList()
Return a list of input ports connected to this port on the outside. |
java.util.Enumeration |
deepConnectedInPorts()
Deprecated. Use deepConnectedInPortList() instead. |
java.util.List |
deepConnectedOutPortList()
Return a list of output ports connected to this port on the outside. |
java.util.Enumeration |
deepConnectedOutPorts()
Deprecated. Use deepConnectedInPortList() instead. |
Receiver[][] |
deepGetReceivers()
If the port is an input, return the receivers deeply linked on the inside. |
Token |
get(int channelIndex)
Get a token from the specified channel. |
Token[] |
get(int channelIndex,
int vectorLength)
Get an array of tokens from the specified channel. |
int |
getChannelForReceiver(Receiver receiver)
Return the channel number for the specified receiver. |
double |
getCurrentTime(int channelIndex)
Deprecated. As Ptolemy II 4.1, replaced by getModelTime(int). |
Token |
getInside(int channelIndex)
Get a token from the specified inside channel of this port. |
Receiver[][] |
getInsideReceivers()
If the port is an opaque output port, return the receivers that receive data from all inside linked relations. |
Time |
getModelTime(int channelIndex)
Return the current time associated with a certain channel. |
Receiver[][] |
getReceivers()
If the port is an input, return the receivers that receive data from all linked relations. |
Receiver[][] |
getReceivers(IORelation relation)
If the port is an input, return receivers that handle incoming channels from the specified relation. |
Receiver[][] |
getReceivers(IORelation relation,
int occurrence)
If the port is an input, return receivers that handle incoming channels from the specified relation. |
Receiver[][] |
getRemoteReceivers()
If the port is an output, return the remote receivers that can receive from the port. |
Receiver[][] |
getRemoteReceivers(IORelation relation)
If this port is an output, return the remote receivers that can receive data from this port through the specified relation or any relation in its relation group. |
int |
getWidth()
Return the width of the port. |
int |
getWidthInside()
Return the inside width of this port. |
boolean |
hasRoom(int channelIndex)
Return true if the specified channel can accept a token via the put() method. |
boolean |
hasRoomInside(int channelIndex)
Return true if the specified channel can accept a token via the putInside() method. |
boolean |
hasToken(int channelIndex)
Return true if the specified channel has a token to deliver via the get() method. |
boolean |
hasToken(int channelIndex,
int tokens)
Return true if the specified channel has the specified number of tokens to deliver via the get() method. |
boolean |
hasTokenInside(int channelIndex)
Return true if the specified channel has a token to deliver via the getInside() method. |
void |
insertLink(int index,
Relation relation)
Override the base class to invalidate the schedule and resolved types of the director of the container, if there is one, in addition to what the base class does. |
java.util.List |
insideSinkPortList()
Return a list of the ports that may accept data from this port when it sends on the inside. |
java.util.List |
insideSourcePortList()
Return a list of the ports that can send data to this port from the inside. |
boolean |
isInput()
Return true if the port is an input. |
boolean |
isKnown()
Return true if all channels of this port have known state; that is, the tokens on each channel are known, or each channel is known not to have any tokens. |
boolean |
isKnown(int channelIndex)
Return true if the specified channel has known state; that is, the tokens on this channel are known, or this channel is known not to have any tokens. |
boolean |
isKnownInside(int channelIndex)
Return true if the specified inside channel has known state; that is, the tokens on this channel are known, or this channel is known not to have any tokens. |
boolean |
isMultiport()
Return true if the port is a multiport. |
boolean |
isOutput()
Return true if the port is an output. |
void |
liberalLink(ComponentRelation relation)
Override the base class to invalidate the schedule and resolved types of the director of the container, if there is one, in addition to what the base class does. |
void |
link(Relation relation)
Override the base class to invalidate the schedule and resolved types of the director of the container, if there is one, in addition to what the base class does. |
int |
numberOfSinks()
Return the number of sink ports that may receive data from this one. |
int |
numberOfSources()
Return the number of source ports that may send data to this one. |
void |
removeIOPortEventListener(IOPortEventListener listener)
Unregister a token sent listener. |
void |
send(int channelIndex,
Token token)
Send the specified token to all receivers connected to the specified channel. |
void |
send(int channelIndex,
Token[] tokenArray,
int vectorLength)
Send the specified portion of a token array to all receivers connected to the specified channel. |
void |
sendClear(int channelIndex)
Set all destination receivers connected via the specified to channel to have no token. |
void |
sendClearInside(int channelIndex)
Set all destination receivers connected on the inside via the specified to channel to have no token. |
void |
sendInside(int channelIndex,
Token token)
Send the specified token to all receivers connected to the specified inside channel of this port. |
void |
setContainer(Entity container)
Override the base class to ensure that the proposed container implements the Actor interface (the base class ensures that the container is an instance of ComponentEntity) or null. |
void |
setInput(boolean isInput)
If the argument is true, make the port an input port. |
void |
setMultiport(boolean isMultiport)
If the argument is true, make the port a multiport. |
void |
setOutput(boolean isOutput)
If the argument is true, make the port an output port. |
java.util.List |
sinkPortList()
Return a list of the ports that may accept data from this port when it sends on the outside. |
java.util.List |
sourcePortList()
Return a list of ports that may send data to this port from the outside. |
boolean |
transferInputs()
Deprecated. Domains should use sendInside directly to implement their transferInputs method. |
boolean |
transferOutputs()
Deprecated. domains should use getInside directly to implement their transferOutputs method. |
void |
unlink(int index)
Unlink whatever relation is currently linked at the specified index number. |
void |
unlink(Relation relation)
Unlink the specified Relation. |
void |
unlinkAll()
Unlink all relations that are linked on the outside. |
void |
unlinkAllInside()
Unlink all relations that are linked on the inside. |
void |
unlinkInside(int index)
Unlink whatever relation is currently linked on the inside with the specified index number. |
void |
unlinkInside(Relation relation)
Unlink the specified Relation on the inside. |
| Methods inherited from class ptolemy.kernel.ComponentPort |
|---|
_deepConnectedPortList, _deepConnectedPorts, _deepInsidePortList, _deepInsidePorts, _isInsideLinkable, deepConnectedPortList, deepConnectedPorts, deepInsidePortList, deepInsidePorts, insertInsideLink, insidePortList, insidePorts, insideRelationList, insideRelations, isDeeplyConnected, isInsideGroupLinked, isInsideLinked, isOpaque, numInsideLinks |
| Methods inherited from class ptolemy.kernel.Port |
|---|
_getContainedObject, _propagateExistence, connectedPortList, connectedPorts, getContainer, isGroupLinked, isLinked, linkedRelationList, linkedRelations, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, numLinks, setName |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int CONFIGURATION
public static final int RECEIVERS
public static final int REMOTERECEIVERS
protected boolean _hasPortEventListeners
protected java.util.LinkedList _portEventListeners
| Constructor Detail |
|---|
public IOPort()
public IOPort(Workspace workspace)
workspace - The workspace that will list the port.
public IOPort(ComponentEntity container,
java.lang.String name)
throws IllegalActionException,
NameDuplicationException
container - The container actor.name - The name of the port.
IllegalActionException - If the port is not of an acceptable
class for the container, or if the container does not implement the
Actor interface.
NameDuplicationException - If the name coincides with
a port already in the container.
public IOPort(ComponentEntity container,
java.lang.String name,
boolean isInput,
boolean isOutput)
throws IllegalActionException,
NameDuplicationException
container - The container actor.name - The name of the port.isInput - True if this is to be an input port.isOutput - True if this is to be an output port.
IllegalActionException - If the port is not of an acceptable
class for the container, or if the container does not implement the
Actor interface.
NameDuplicationException - If the name coincides with
a port already in the container.| Method Detail |
|---|
public void addIOPortEventListener(IOPortEventListener listener)
listener - The listener to which to send token sent messages.removeIOPortEventListener(IOPortEventListener)
public void broadcast(Token token)
throws IllegalActionException,
NoRoomException
Some of this method is read-synchronized on the workspace. Since it is possible for a thread to block while executing a put(), it is important that the thread does not hold read access on the workspace when it is blocked. Thus this method releases read access on the workspace before calling put().
token - The token to send
IllegalActionException - Not thrown in this base class.
NoRoomException - If a send to one of the channels throws
it.
public void broadcast(Token[] tokenArray,
int vectorLength)
throws IllegalActionException,
NoRoomException
Tokens are in general immutable, so each receiver is given a reference to the same token and no clones are made. If the port is not connected to anything, or receivers have not been created in the remote port, or the channel index is out of range, or the port is not an output port, then just silently return. This behavior makes it easy to leave output ports unconnected when you are not interested in the output. The transfer is accomplished by calling the vectorized put() method of the remote receivers. If the port is not connected to anything, or receivers have not been created in the remote port, then just return.
Some of this method is read-synchronized on the workspace. Since it is possible for a thread to block while executing a put, it is important that the thread does not hold read access on the workspace when it is blocked. Thus this method releases read access on the workspace before calling put().
tokenArray - The token array to sendvectorLength - The number of elements of the token
array to send.
NoRoomException - If there is no room in the receiver.
IllegalActionException - Not thrown in this base class.
public void broadcastClear()
throws IllegalActionException
IllegalActionException - If a receiver does not support
clear().sendClear(int )
public java.lang.Object clone(Workspace workspace)
throws java.lang.CloneNotSupportedException
clone in class ComponentPortworkspace - The workspace for the cloned object.
java.lang.CloneNotSupportedException - If one or more of the attributes
cannot be cloned.NamedObj.exportMoML(Writer, int, String),
NamedObj.setDeferringChangeRequests(boolean)
public Token convert(Token token)
throws IllegalActionException
token - The token to convert.
IllegalActionException - If the conversion is
invalid (not thrown in this base class).
public void createReceivers()
throws IllegalActionException
If the port is an input port, receivers are created as necessary for each relation connecting to the port from the outside. If the port is an output port, receivers are created as necessary for each relation connected to the port from the inside. Note that only composite entities will have relations connecting to ports from the inside.
Note that it is perfectly allowable for a zero width output port to have insideReceivers. This can be used to allow a model to be embedded in a container that does not connect the port to anything.
This method is not write-synchronized on the workspace, so the caller should be.
IllegalActionException - If this port is not
an opaque input port or if there is no director.public java.util.List deepConnectedInPortList()
ComponentPort.deepConnectedPortList()public java.util.Enumeration deepConnectedInPorts()
ComponentPort.deepConnectedPorts()public java.util.List deepConnectedOutPortList()
ComponentPort.deepConnectedPorts()public java.util.Enumeration deepConnectedOutPorts()
ComponentPort.deepConnectedPorts()public Receiver[][] deepGetReceivers()
public Token get(int channelIndex)
throws NoTokenException,
IllegalActionException
Some of this method is read-synchronized on the workspace. Since it is possible for a thread to block while executing a get, it is important that the thread does not hold read access on the workspace when it is blocked. Thus this method releases read access on the workspace before calling get().
channelIndex - The channel index.
NoTokenException - If there is no token.
IllegalActionException - If there is no director, and hence
no receivers have been created, if the port is not an input port, or
if the channel index is out of range.
public Token[] get(int channelIndex,
int vectorLength)
throws NoTokenException,
IllegalActionException
If the channel has a group with more than one receiver (something that is possible if this is a transparent port), then this method calls get() on all receivers, but returns only the result from the first in the group. Normally this method is not used on transparent ports. If there are not enough tokens to fill the array, then throw an exception.
Some of this method is read-synchronized on the workspace. Since it is possible for a thread to block while executing a get, it is important that the thread does not hold read access on the workspace when it is blocked. Thus this method releases read access on the workspace before calling get.
channelIndex - The channel index.vectorLength - The number of valid tokens to get in the
returned array.
NoTokenException - If there is no array of tokens.
IllegalActionException - If there is no director, and hence
no receivers have been created, if the port is not an input port, or
if the channel index is out of range.
public int getChannelForReceiver(Receiver receiver)
throws IllegalActionException
receiver - A receiver in this port.
IllegalActionException - If the receiver is not in the port.
public double getCurrentTime(int channelIndex)
throws IllegalActionException
getModelTime(int).
getModelTime(int) method and return a double
representation of the model time.
channelIndex - The channel index.
IllegalActionException - If the channel index
is out of range or if the port is not an input port.
public Token getInside(int channelIndex)
throws NoTokenException,
IllegalActionException
If the channel has a group with more than one receiver (something that is possible if this is a transparent port), then this method calls get() on all receivers, but returns only the first non-null token returned by these calls. Normally this method is not used on transparent ports. If there is no token to return, then throw an exception. This method is usually called only by the director of a composite actor during transferOutputs(), as atomic actors do not normally have relations connected on the inside of their ports.
Some of this method is read-synchronized on the workspace. Since it is possible for a thread to block while executing a get(), it is important that the thread does not hold read access on the workspace when it is blocked. Thus this method releases read access on the workspace before calling get().
channelIndex - The channel index.
NoTokenException - If there is no token.
IllegalActionException - If there is no director, and hence
no receivers have been created, if the port is not an output port, or
if the channel index is out of range.public Receiver[][] getInsideReceivers()
getInside(int)
public Time getModelTime(int channelIndex)
throws IllegalActionException
if (hasToken(n)) {
double time = port.getCurrentTime(n);
Token token = port.get(n);
}
I.e., getCurrentTime() is called before get().
Currently, only the DT domain uses this per-channel time feature.
channelIndex - The channel index.
IllegalActionException - If the channel index
is out of range or if the port is not an input port.public Receiver[][] getReceivers()
For a transparent port (a port of a non-opaque entity), this method returns receivers in ports connected to this port on the inside. For an opaque port, the receivers returned are contained directly by this port.
The number of channels (number of groups) is the width of the port.
For each channel, there may be any number of receivers in the group. The individual receivers are selected using the second index of the returned array of arrays. If there are no receivers in the group, then the channel is represented by null. I.e., if the returned array of arrays is x and the channel number is c, then x[c] is null. Otherwise, it is an array, where the size of the array is the number of receivers in the group. If the port is opaque, then the group size is one, so only x[c][0] is defined. If the port is transparent, the group size is arbitrary.
For an opaque port, this method creates receivers by calling _newReceiver() if there are no receivers or the number of receivers does not match the width of the port. In the latter case, previous receivers are lost, together with any data they may contain.
This method is read-synchronized on the workspace. If its cached list of local receivers is not valid, however, then it acquires write synchronization on the workspace to reconstruct it.
public Receiver[][] getReceivers(IORelation relation)
throws IllegalActionException
This method is read-synchronized on the workspace.
relation - Relations that are linked on the outside or inside.
IllegalActionException - If the relation is not linked
from the outside, or if there is no director.
public Receiver[][] getReceivers(IORelation relation,
int occurrence)
throws IllegalActionException
This method is read-synchronized on the workspace.
relation - Relations that are linked on the outside or inside.occurrence - The occurrence number that we are interested in,
starting at 0.
IllegalActionException - If the relation is not linked
from the outside.public Receiver[][] getRemoteReceivers()
This method may have the effect of creating new receivers in the remote input ports, if they do not already have the right number of receivers. In this case, previous receivers are lost, together with any data they may contain.
This method is read-synchronized on the workspace.
public Receiver[][] getRemoteReceivers(IORelation relation)
throws IllegalActionException
This method may have the effect of creating new receivers in the remote input ports, if they do not already have the right number of receivers. In this case, previous receivers are lost, together with any data they may contain.
This method is read-synchronized on the workspace.
relation - The specified relation from which the remote
receivers can receive data.
IllegalActionException - If the IORelation is not linked
to the port from the inside.public int getWidth()
numberOfSinks(),
numberOfSources()public int getWidthInside()
public boolean hasRoom(int channelIndex)
throws IllegalActionException
channelIndex - The channel index.
IllegalActionException - If the receivers do not support
this query, if this is not an output port, or if the channel index
is out of range.
public boolean hasRoomInside(int channelIndex)
throws IllegalActionException
channelIndex - The channel index.
IllegalActionException - If the receivers do not
support this query, if this is not an input port, or if the
channel index is out of range.
public boolean hasToken(int channelIndex)
throws IllegalActionException
channelIndex - The channel index.
IllegalActionException - If the receivers do not support
this query, if there is no director, and hence no receivers,
if the port is not an input port, or if the channel index is out
of range.
public boolean hasToken(int channelIndex,
int tokens)
throws IllegalActionException
channelIndex - The channel index.tokens - The number of tokens to query the channel for.
IllegalActionException - If the receivers do not support
this query, if there is no director, and hence no receivers,
if the port is not an input port, or if the channel index is out
of range.
public boolean hasTokenInside(int channelIndex)
throws IllegalActionException
channelIndex - The channel index.
IllegalActionException - If the receivers do not support
this query, if there is no director, and hence no receivers,
if the port is not an output port, or if the channel index is out
of range.
public void insertLink(int index,
Relation relation)
throws IllegalActionException
insertLink in class ComponentPortindex - The index at which to insert the link.relation - The relation to link to this port.
IllegalActionException - If the link would cross levels of
the hierarchy, or the relation is incompatible,
or the port has no container, or the port is not in the
same workspace as the relation, or if this port is not a multiport
and the index is greater than zero or if another link already exists.public java.util.List insideSinkPortList()
deepGetReceivers()public java.util.List insideSourcePortList()
public boolean isInput()
public boolean isKnown()
throws IllegalActionException
This method supports domains, such as SR, which have fixed-point semantics. In such domains, an iteration of a model starts with the state of all channels unknown, and the iteration concludes when the state of all channels is known.
IllegalActionException - If the receivers do not support
this query, or if there is no director, and hence no receivers.isKnown(int),
isKnownInside(int)
public boolean isKnown(int channelIndex)
throws IllegalActionException
This method supports domains, such as SR, which have fixed-point semantics. In such domains, an iteration of a model starts with the state of all channels unknown, and the iteration concludes when the state of all channels is known.
channelIndex - The channel index.
IllegalActionException - If the receivers do not support
this query, if there is no director, and hence no receivers,
if the port is not an input port, or if the channel index is out
of range.isKnown(),
*
public boolean isKnownInside(int channelIndex)
throws IllegalActionException
This method supports domains, such as SR, which have fixed-point semantics. In such domains, an iteration of a model starts with the state of all channels unknown, and the iteration concludes when the state of all channels is known.
channelIndex - The channel index.
IllegalActionException - If the receivers do not
support this query, if there is no director, and hence no
receivers, or if the inside channel index is out of range.public boolean isMultiport()
public boolean isOutput()
public void liberalLink(ComponentRelation relation)
throws IllegalActionException
liberalLink in class ComponentPortrelation - The relation to link to.
IllegalActionException - If the relation does not share
the same workspace, or the port has no container.
public void link(Relation relation)
throws IllegalActionException
link in class ComponentPortrelation - The relation to link to.
IllegalActionException - If the link crosses levels of
the hierarchy, or the port has no container, or the relation
is not an instance of IORelation.public int numberOfSinks()
sinkPortList(),
numberOfSources(),
getWidth()public int numberOfSources()
sourcePortList(),
numberOfSinks(),
getWidth()public void removeIOPortEventListener(IOPortEventListener listener)
listener - The listener to remove from the list of listeners
to which token sent messages are sent.addIOPortEventListener(IOPortEventListener)
public void send(int channelIndex,
Token token)
throws IllegalActionException,
NoRoomException
Some of this method is read-synchronized on the workspace. Since it is possible for a thread to block while executing a put, it is important that the thread does not hold read access on the workspace when it is blocked. Thus this method releases read access on the workspace before calling put.
channelIndex - The index of the channel, from 0 to width-1token - The token to send
NoRoomException - If there is no room in the receiver.
IllegalActionException - Not thrown in this base class.
public void send(int channelIndex,
Token[] tokenArray,
int vectorLength)
throws IllegalActionException,
NoRoomException
Tokens are in general immutable, so each receiver is given a reference to the same token and no clones are made. If the port is not connected to anything, or receivers have not been created in the remote port, or the channel index is out of range, or the port is not an output port, then just silently return. This behavior makes it easy to leave output ports unconnected when you are not interested in the output. The transfer is accomplished by calling the vectorized put() method of the remote receivers. If the port is not connected to anything, or receivers have not been created in the remote port, then just return.
Some of this method is read-synchronized on the workspace. Since it is possible for a thread to block while executing a put, it is important that the thread does not hold read access on the workspace when it is blocked. Thus this method releases read access on the workspace before calling put.
channelIndex - The index of the channel, from 0 to width-1tokenArray - The token array to sendvectorLength - The number of elements of of the token
array to send.
NoRoomException - If there is no room in the receiver.
IllegalActionException - Not thrown in this base class.
public void sendClear(int channelIndex)
throws IllegalActionException
channelIndex - The index of the channel, from 0 to width-1
IllegalActionException - If a receiver does not support
clear().broadcastClear(),
sendClearInside(int)
public void sendClearInside(int channelIndex)
throws IllegalActionException
channelIndex - The index of the channel, from 0 to insideWidth-1.
IllegalActionException - If a receiver does not support
clear().sendClear(int)
public void sendInside(int channelIndex,
Token token)
throws IllegalActionException,
NoRoomException
Some of this method is read-synchronized on the workspace. Since it is possible for a thread to block while executing a put, it is important that the thread does not hold read access on the workspace when it is blocked. Thus this method releases read access on the workspace before calling put.
channelIndex - The index of the channel, from 0 to width-1token - The token to send
NoRoomException - If there is no room in the receiver.
IllegalActionException - Not thrown in this base class.
public void setContainer(Entity container)
throws IllegalActionException,
NameDuplicationException
setContainer in class ComponentPortcontainer - The proposed container.
IllegalActionException - If the proposed container is not a
ComponentEntity, doesn't implement Actor, or has no name,
or the port and container are not in the same workspace. Or
it's not null
NameDuplicationException - If the container already has
a port with the name of this port.Port.getContainer(),
Port._checkContainer(Entity)
public void setInput(boolean isInput)
throws IllegalActionException
isInput - True to make the port an input.
IllegalActionException - If changing the port status is
not permitted (not thrown in this base class).
public void setMultiport(boolean isMultiport)
throws IllegalActionException
isMultiport - True to make the port a multiport.
IllegalActionException - If changing the port status is
not permitted (not thrown in this base class).
public void setOutput(boolean isOutput)
throws IllegalActionException
isOutput - True to make the port an output.
IllegalActionException - If changing the port status is
not permitted (not thrown in this base class).public java.util.List sinkPortList()
getRemoteReceivers()public java.util.List sourcePortList()
public boolean transferInputs()
throws IllegalActionException
IllegalActionException - If this port is not an
opaque input port.
public boolean transferOutputs()
throws IllegalActionException
IllegalActionException - If the port is not an opaque
output port.public void unlink(int index)
unlink in class Portindex - The index number of the link to remove.public void unlink(Relation relation)
unlink in class ComponentPortrelation - The relation to unlink.public void unlinkAll()
unlinkAll in class ComponentPortpublic void unlinkAllInside()
unlinkAllInside in class ComponentPortpublic void unlinkInside(int index)
unlinkInside in class ComponentPortindex - The index number of the link to remove.public void unlinkInside(Relation relation)
unlinkInside in class ComponentPortrelation - The relation to unlink.
protected void _checkContainer(Entity container)
throws IllegalActionException
_checkContainer in class ComponentPortcontainer - The proposed container.
IllegalActionException - If the container is not of
an acceptable class.
protected void _checkLiberalLink(Relation relation)
throws IllegalActionException
_checkLiberalLink in class ComponentPortrelation - The relation to link to on the inside.
IllegalActionException - If this port has no container or
the relation is not an IORelation, or the port already linked to a
relation and is not a multiport, or the relation has width
not exactly one and the port is not a multiport, or the
relation is incompatible with this port, or the port is not
in the same workspace as the relation.
protected void _checkLink(Relation relation)
throws IllegalActionException
_checkLink in class ComponentPortrelation - The relation to link to.
IllegalActionException - If this port has no container or
the relation is not an IORelation, or the port already linked to a
relation and is not a multiport, or if the relation has width
not exactly one and the port is not a multiport, or the port is
not in the same workspace as the relation.
protected java.lang.String _description(int detail,
int indent,
int bracket)
If the detail argument sets the bit defined by the constant CONFIGURATION, then append to the description a field containing any subset of the words "input", "output", "multiport", and "opaque", separated by spaces, plus a subfield of the form "{width integer}", where the integer is the width of the port. The field keyword is "configuration".
If the detail argument sets the bit defined by the constant RECEIVERS, then append to the description a field containing the receivers contained by this port. The keyword is "receivers" and the format is like the Receivers array, an array of groups, with each group receiving from a channel. Each group is a list of receiver descriptions (it may also be empty). If the detail argument sets the bit defined by the constant REMOTERECEIVERS, then also append to the description a field containing the remote receivers connected to this port. This method is read-synchronized on the workspace.
_description in class ComponentPortdetail - The level of detail.indent - The amount of indenting.bracket - The number of surrounding brackets (0, 1, or 2).
protected void _exportMoMLContents(java.io.Writer output,
int depth)
throws java.io.IOException
_exportMoMLContents in class NamedObjoutput - The output stream to write to.depth - The depth in the hierarchy, to determine indenting.
java.io.IOException - If an I/O error occurs.NamedObj.exportMoML(Writer, int)protected int _getInsideWidth(IORelation except)
except - The relation to exclude.
protected int _getOutsideWidth(IORelation except)
except - The relation to exclude.
protected Receiver[][] _getReceiversLinkedToGroup(IORelation relation,
int occurrence)
throws IllegalActionException
This method handles relation groups. That is, given any relation in a relation group, it returns the combined receivers of all the relations in the relation group, in the order as returned by the getRelationGroup() method of Receiver.
This method is read-synchronized on the workspace.
relation - Relations that are linked on the outside or inside.occurrence - The occurrence number that we are interested in,
starting at 0.
IllegalActionException - If the relation is not linked
from the outside.
protected Receiver _newInsideReceiver()
throws IllegalActionException
IllegalActionException - If the port has no container,
or the container is unable to return a new receiver (for example
if it has no local director).
protected Receiver _newReceiver()
throws IllegalActionException
IllegalActionException - If the port has no container,
or the container is unable to return a new receiver (for example
if it has no executive director).protected void _removeReceivers(Relation relation)
relation - The relation.protected final void _notifyPortEventListeners(IOPortEvent event)
event - The event.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||