Class MultiPort

java.lang.Object
org.simplesim.core.messaging.AbstractPort
org.simplesim.core.messaging.MultiPort
All Implemented Interfaces:
Port

public final class MultiPort extends AbstractPort
Port to send the same message to several inports.

Messages of the outport are copied to all connected inports. Does not need the destination information of a message.

Only use as outport. Can be used with DefaultMessageForwarding or DirectMessageForwarding.

See Also:
  • Constructor Details

  • Method Details

    • connect

      public void connect(Port port)
      Description copied from interface: Port
      Connects this port to another one.

      Note that connections are directed.

      Parameters:
      port - the other part of the connection
    • disconnect

      public void disconnect(Port port)
      Description copied from interface: Port
      Disconnects this port from another one.
      Parameters:
      port - the port to be removed
    • isEndPoint

      public boolean isEndPoint()
      Description copied from interface: Port
      Tests if the port is the end point of a connection.
      Returns:
      true if it is end point (destination port)
    • forwardMessages

      public Collection<Port> forwardMessages()
      Description copied from interface: Port
      Implements a message forwarding strategy specific for the port class.

      Port must be connected to other ports, please check if it is an end point beforehand!

      Note: Only to be used by an implementation of MessageForwardingStrategy

      Returns:
      list of destination ports that need further forwarding
    • isConnectedTo

      public boolean isConnectedTo(Port port)
      Description copied from interface: Port
      Tests if the port is connected to another one.
      Parameters:
      port - the port to test
      Returns:
      true if this port is connected to the other port