public abstract class EventOf2Entities<E extends Entity,F extends Entity> extends EventAbstract
For events changing the state of one or three entities,
refer to Event
and EventOf3Entities
.
Events not associated to a specific entity are based on ExternalEvent
.
For type safety it is recommended to generically assign the entity types an
EventOf2Entities
operates on by using the generic type
EventOf2Entities<E,F>
where
E
and F
are derived from Entity
.
All event object should be used only once. Implement the changes of state for the
specific entities associated with this event by overriding the abstract method
eventRoutine(E who1, F who2)
.
Entity
,
ExternalEvent
,
Event
,
EventOf3Entities
,
TimeInstant
,
TimeSpan
Constructor and Description |
---|
EventOf2Entities(Model owner,
java.lang.String name,
boolean showInTrace)
Creates a new Event of the given model, with the given name and trace
option.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
eventRoutine(E who1,
F who2)
Implement this abstract method to express the changes of state this event
does to two entities (as
SimProcess is a subclass of
Entity , processes can be passed as well). |
void |
schedule(E who1,
F who2)
Schedules this event to act the given entities now.
|
void |
schedule(E who1,
F who2,
NumericalDist<?> dist)
Schedules this event to act the given entities at the specified point in
simulation time determined by a sample from the distribution provided
to the method.
|
void |
schedule(E who1,
F who2,
TimeInstant instant)
Schedules this event to act on the given entities at a certain point in
simulation time.
|
void |
schedule(E who1,
F who2,
TimeSpan dt)
Schedules this event to act the given entities at the specified point in
simulation time.
|
void |
scheduleAfter(Schedulable after,
E who1,
F who2)
Schedules this event to act on the given Entity directly after the given
Schedulable is already set to be activated.
|
void |
scheduleBefore(Schedulable before,
E who1,
F who2)
Schedules this event to act on the given Entity directly before the given
Schedulable is already set to be activated.
|
void |
schedulePreempt(E who1,
F who2)
Schedules this event to be executed immediately, preempting the
process lifecycle executed at the moment.
|
getNumberOfEntities, getRealTimeConstraint, getSchedulingPriority, isExternal, setRealTimeConstraint, setSchedulingPriority
assignReporter, cancel, getCorrespondingReportable, isCurrent, isScheduled, rename, reSchedule, reSchedule, reSchedulePreempt, scheduledNext, setCorrespondingReportable
current, currentEntity, currentEntityAll, currentEvent, currentModel, currentSimProcess, debugIsOn, debugOff, debugOn, getModel, isExperimentCompatible, isModelCompatible, presentTime, sendDebugNote, sendMessage, sendTraceNote, sendWarning, skipTraceNote, skipTraceNote, traceIsOn, traceOff, traceOn
getName, getQuotedName, toString
public EventOf2Entities(Model owner, java.lang.String name, boolean showInTrace)
name
- java.lang.String : The name of this eventowner
- Model : The model this event is associated toshowInTrace
- boolean : Flag for showing Event in trace-files. Set it to
true
if Event should show up in trace. Set it to
false
if Event should not be shown in trace.public abstract void eventRoutine(E who1, F who2)
SimProcess
is a subclass of
Entity
, processes can be passed as well).
For type safety, it is recommended to derive your events from the generic
type EventOf2Entities<EntityType1,EntityType2>
where
EntityType1
and EntityType2
(which are derived from class
Entity
) represent the entity types your event is supposed to
operate on.
Should you decide to derive your event from the raw type
EventOf2Entities
(which is not recommended), please take extra care in
checking the given Entity parameters to your special eventRoutine since
any subtype of Entity will be accepted! If your model uses several
different entity types, chances are that while developing the model,
wrong entity types might be passed.
who1
- E : The first entity associated to this event.who2
- F : The second entity associated to this event.public void schedule(E who1, F who2, TimeInstant instant)
who1
- E : The first entity to be manipulated by this eventwho2
- F : The second entity to be manipulated by this eventinstant
- TimeInstant : The point in simulation time this event is
scheduled to happen.public void schedule(E who1, F who2, TimeSpan dt)
who1
- E : The first entity this event happens towho2
- F : The second entity this event happens todt
- TimeSpan : The offset to the current simulation time this
Event is to happenSimClock
public void schedule(E who1, F who2)
who1
- E : The first entity this event happens towho2
- F : The second entity this event happens toSimClock
public void schedulePreempt(E who1, F who2) throws SuspendExecution
who1
- E : The first entity this event happens towho2
- F : The second entity this event happens toSuspendExecution
public void schedule(E who1, F who2, NumericalDist<?> dist)
who1
- E : The first entity this event happens towho2
- F : The second entity this event happens todist
- NumericalDist> : Numerical distribution to sample the
offset to the current simulation time fromSimClock
public void scheduleAfter(Schedulable after, E who1, F who2)
after
- Schedulable : The Schedulable this entity should be scheduled
afterwho1
- E : The first entity to be manipulated by this eventwho2
- F : The second entity to be manipulated by this eventpublic void scheduleBefore(Schedulable before, E who1, F who2)
before
- Schedulable : The Schedulable this entity should be scheduled
beforewho1
- E : The first entity to be manipulated by this eventwho2
- F : The second entity to be manipulated by this event