public class MessageCrossbar<T extends SimProcess> extends Reportable
MessageChannel,
CrossbarMessage| Constructor and Description |
|---|
MessageCrossbar(Model owner,
java.lang.String name,
boolean showInReport,
boolean showInTrace)
Creates a MessageCrossbar object with all parameters required.
|
| Modifier and Type | Method and Description |
|---|---|
Reporter |
createDefaultReporter()
This method provides a reporter to generate report data about this
reportable.
|
MessageChannel<T> |
createMessageChannel(java.lang.String channelName)
Creates a new MessageChannel with is automatically associated with the
MessageCrossbar.
|
<ST extends T> |
createMessageChannel(java.lang.String channelName,
java.lang.Class<ST> desiredGenericType,
boolean showInReport,
boolean showInTrace)
Creates a new MessageChannel with is automatically associated with the
MessageCrossbar.
|
long |
getDeliveredMessages() |
long |
getInterruptedWaits() |
long |
getLostMessages() |
MessageChannel<T> |
getMessageChannel(java.lang.String channelName)
Returns the
MessageChannel identified by the given name. |
long |
getObservations()
Returns the number of observations made by the reportable object.
|
long |
getProcessActivations() |
long |
getReceivedMessages() |
void |
reset()
Resets the counter for observations made by this reportable.
|
TimeInstant |
resetAt()
Shows the point in simulation time when the last reset of this reportable
was made.
|
void |
sendMessage(CrossbarMessage message,
java.util.List<MessageChannel<T>> channelsToSendTo)
Sends the given
CrossbarMessage to the specified message
channels, thereby activating all processes that are waiting on these
channel. |
CrossbarMessage |
waitForMessage(java.util.List<MessageChannel<T>> channelsToWaitOn)
Wait for a
CrossbarMessage on the specified message channels,
thereby passivating the current process. |
CrossbarMessage |
waitForMessage(java.util.List<MessageChannel<T>> channelsToWaitOn,
TimeInstant waitUntil)
Wait for a
CrossbarMessage on the specified message channels,
thereby passivating the current process. |
CrossbarMessage |
waitForMessage(java.util.List<MessageChannel<T>> channelsToWaitOn,
TimeSpan maxWaitTime)
Wait for a
CrossbarMessage on the specified message channels,
thereby passivating the current process. |
getCorrespondingSchedulable, getDescription, getReporter, incrementObservations, incrementObservations, reportIsOn, reportOff, reportOn, setCorrespondingSchedulable, setDescription, setReportercurrent, currentEntity, currentEntityAll, currentEvent, currentModel, currentSimProcess, debugIsOn, debugOff, debugOn, getModel, isExperimentCompatible, isModelCompatible, presentTime, sendDebugNote, sendMessage, sendTraceNote, sendWarning, skipTraceNote, skipTraceNote, traceIsOn, traceOff, traceOngetName, getQuotedName, toStringpublic MessageCrossbar(Model owner, java.lang.String name, boolean showInReport, boolean showInTrace)
name - java.lang.String : The name of this reportableowner - Model : The model this reportable is associated toshowInReport - boolean : Flag for showing the report Set it to
true if reportable should show up in report. Set
it to false if reportable should not be shown in
report.showInTrace - boolean : Flag for showing this reportable in trace files. Set
it to true if reportable should show up in trace.
Set it to false if reportable should not be shown
in trace.public MessageChannel<T> createMessageChannel(java.lang.String channelName)
channelName - String : The name of the new channelpublic <ST extends T> MessageChannel<ST> createMessageChannel(java.lang.String channelName, java.lang.Class<ST> desiredGenericType, boolean showInReport, boolean showInTrace)
MessageChannel this method
allows the creation of MessageChannels which are more specifically typed
than the MessageCrossbar. In this way on a generally typed
MessageCrossbar< SimProcess> a MessageChannel< Truck> (where Truck
extends SimProcess) can be created.channelName - String : The name of the new channeldesiredGenericType - ClassshowInReport - boolean : Flag for showing the report Set it to
true if reportable should show up in report. Set
it to false if reportable should not be shown in
report.showInTrace - boolean : Flag for showing this reportable in trace files. Set
it to true if reportable should show up in trace.
Set it to false if reportable should not be shown
in trace.public Reporter createDefaultReporter()
StandardReporter
is returned. Lacking further knowledge about a specific reportable,
the StandardReporter is only able to read out the
reportable's name, number of observations and time of last reset.Accumulate,
Tally, Count, Queue, and many
others provide such reporters. setReporter() to have
this reportable use a custom reporter instead of the default reporter.public long getDeliveredMessages()
public long getInterruptedWaits()
public long getLostMessages()
public MessageChannel<T> getMessageChannel(java.lang.String channelName)
MessageChannel identified by the given name.channelName - The name of the channelMessageChannel identified by the given name, or
null if no channel with that name is managed by the
MessageCrossbar.public long getObservations()
ReportablegetObservations in class Reportablepublic long getProcessActivations()
public long getReceivedMessages()
public void reset()
resetAt().reset in class Reportablepublic TimeInstant resetAt()
resetAt in class Reportablepublic void sendMessage(CrossbarMessage message, java.util.List<MessageChannel<T>> channelsToSendTo)
CrossbarMessage to the specified message
channels, thereby activating all processes that are waiting on these
channel.message - The message to send to the specified channelschannelsToSendTo - The channels to which the message will be sentpublic CrossbarMessage waitForMessage(java.util.List<MessageChannel<T>> channelsToWaitOn) throws SuspendExecution
CrossbarMessage on the specified message channels,
thereby passivating the current process. The process is not reactivated
until a message is received.channelsToWaitOn - The channels on which to wait for a messageSuspendExecutionpublic CrossbarMessage waitForMessage(java.util.List<MessageChannel<T>> channelsToWaitOn, TimeInstant waitUntil) throws InterruptException, SuspendExecution
CrossbarMessage on the specified message channels,
thereby passivating the current process. The process is not reactivated
until a message is received. The parameter waitUntil specifies the point
in time to which the current process will wait for a message. If no
message is received before that time, the process will be interrupted and
a DelayedInterruptException will be thrown.channelsToWaitOn - The channels on which to wait for a messagewaitUntil - The point in time at which the waiting will be interruptedInterruptExceptionSuspendExecutionpublic CrossbarMessage waitForMessage(java.util.List<MessageChannel<T>> channelsToWaitOn, TimeSpan maxWaitTime) throws InterruptException, SuspendExecution
CrossbarMessage on the specified message channels,
thereby passivating the current process. The process is not reactivated
until a message is received. The parameter maxWaitTime specifies maximum
time the current process will wait for a message. If no message is
received before this amount of time has elapsed, the process will be
interrupted and a DelayedInterruptException will be thrown.channelsToWaitOn - The channels on which to wait for a messagemaxWaitTime - The maximum amount of time until the waiting will be
interruptedSuspendExecutionInterruptException