|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.xj.anylogic.engine.Port<InMessageType,OutMessageType>
InMessageType - the type of messages being received by the portOutMessageType - the type of messages being sent by the portpublic class Port<InMessageType,OutMessageType>
Port is a universal interface of an active object via which it can send and
receive messages - arbitrary objects. Ports are used to graphically connect
objects that do not need to know anything about each other type or structure.
There are two major types of links a port maintains: connections to the
ports of objects on the same hierarchy level (embedded in the same active object)
or "mappings" to the ports of embedded objects or statecharts. In the first
case a message sent at one port is received at the other. In case of mapping
the message sent at the inner port is forwarded out at the outer port, and vice
versa: message received at the outer port is received by the inner port or by
the statechart. The user may define his own actions that are executed upon
reception or sending the message that may prevent the port from continuing
the message processing. The port class is generic with two parameters - the
classes of messages being received and sent. Once instantiated and parameterized,
it will only accept the messages of those classes. Moreover, the port can only
be connected / mapped to a port with the corresponding message types.
Memory: sizeof(Object) + 20 bytes = 34 bytes + sizeof up to 4 LinkedList's
| Constructor Summary | |
|---|---|
Port(ActiveObject ao)
|
|
| Method Summary | |
|---|---|
void |
connect(Port<OutMessageType,InMessageType> port)
Connects the port to another port of an object on the same level. |
void |
disconnect(Port<OutMessageType,InMessageType> port)
Disconnects the port from another port of an object on the same level. |
void |
disconnectAndUnmapAll()
Disconnects and unmaps the port from all ports and statechart it is connected and/or mapped to. |
ActiveObject |
getActiveObject()
Returns the active object that owns the port. |
java.util.List<Port<InMessageType,OutMessageType>> |
getDownLinks()
Returns an unmodifiable list with mapped ports on active objects embedded in the current active object (owner of port) |
java.util.List<Port<OutMessageType,InMessageType>> |
getFlatLinks()
Returns an unmodifiable list with connected ports |
java.lang.String |
getFullName()
Returns the name of the port prefixed by the full name of its active object. |
java.lang.String |
getName()
Returns the name of the port as specified by the user. |
java.util.List<Statechart> |
getStatechartLinks()
Returns an unmodifiable list with mapped statecharts of the current active object (owner of this port) |
java.util.List<Port<InMessageType,OutMessageType>> |
getUpLinks()
Returns an unmodifiable list with mapped ports on active objects which own the current active object (owner of port) |
void |
map(Port<InMessageType,OutMessageType> port)
Maps (connects) the port to a port of an embedded object. |
void |
map(Statechart statechart)
Maps (connects) the port to a statechart of the same active object. |
void |
onDestroy()
Should be called when the port is destroyed, e.g. when the owner active object is destroyed. |
void |
receive(InMessageType msg)
Receives an incoming message. |
void |
restoreOwner(java.lang.Object owner)
This method normally should not be called by user This method restores owner of this object The method is used in snapshot saving/loading |
void |
send(OutMessageType msg)
Send the message out. |
java.lang.String |
toString()
|
void |
unmap(Port<InMessageType,OutMessageType> port)
Unmaps (disconnects) the port from a port of an embedded object. |
void |
unmap(Statechart statechart)
Unmaps (disconnects) the port from the statechart of the same active object. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Port(ActiveObject ao)
| Method Detail |
|---|
public java.lang.String getName()
public java.lang.String getFullName()
public java.lang.String toString()
toString in class java.lang.Objectpublic ActiveObject getActiveObject()
public void connect(Port<OutMessageType,InMessageType> port)
port - another portpublic void disconnect(Port<OutMessageType,InMessageType> port)
port - another portpublic void map(Port<InMessageType,OutMessageType> port)
port - port of an embedded objectpublic void unmap(Port<InMessageType,OutMessageType> port)
port - port of an embedded objectpublic void map(Statechart statechart)
statechart - the statechartpublic void unmap(Statechart statechart)
statechart - the statechartpublic void disconnectAndUnmapAll()
public void send(OutMessageType msg)
msg - the message being sent.public void receive(InMessageType msg)
msg - the message being receivedpublic java.util.List<Port<OutMessageType,InMessageType>> getFlatLinks()
public java.util.List<Port<InMessageType,OutMessageType>> getUpLinks()
map(Port)public java.util.List<Port<InMessageType,OutMessageType>> getDownLinks()
map(Port)public java.util.List<Statechart> getStatechartLinks()
map(Statechart)public void onDestroy()
public void restoreOwner(java.lang.Object owner)
restoreOwner in interface com.xj.anylogic.engine.internal.Childowner - owner of this object, usually ActiveObject,
Experiment or
ShapeGroup
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||