public abstract class Entity extends Schedulable
Entities typically encapsulate all information about a model entity
relevant to the modeller. Events can manipulate these informations when the
scheduled point of simulation time is reached and thus change the state of
the model. When modelling different types of entities you need to derive
different classes from this superclass. Each carrying the specific
information to represent its counterpart in the system modelled. Thus a
simulation of e.g. a factory would require both machines and material to be
subclasses of class Entity
. They can act on each other by
scheduling themselves or other Entities with the appropriate events. To use
more than one entity of one type, create multiple instances of the same
Entity
class.
For better identification, all instances created from a subclass of class
NamedObject
(just as Entity
is) get an individual
identification number as a suffix to their name so there is no need to name
each individual differently yourself.
Entities can carry a queuing priority that can be modified after the entity has been instantiated, applied for inserting Entities into any kind of Queues: The entity's priority determines it's position inside the queue on entering it. Although within a model all attributes of an entity could be made public it is advisable to support data hiding by providing methods for accessing the internal attributes, as always in oo-design.
Event
,
SimProcess
,
NamedObject
Constructor and Description |
---|
Entity(Model owner,
java.lang.String name,
boolean showInTrace) |
Modifier and Type | Method and Description |
---|---|
long |
getIdentNumber()
Returns the entity's identification number.
|
int |
getQueueingPriority()
Returns the entity's queuing priority.
|
java.util.List<QueueBased> |
getQueues()
Returns a list of queues and other
QueueBased objects where this Entity is queued. |
java.util.List<EventAbstract> |
getScheduledEvents()
Returns a list of events associated to this Entity object.
|
static boolean |
isEqual(Entity a,
Entity b)
Checks if the two entities have the same priority.
|
static boolean |
isLarger(Entity a,
Entity b)
Checks if the first of the two entities has a higher priority than the
second.
|
static boolean |
isLargerOrEqual(Entity a,
Entity b)
Checks if the first of the two entities has higher or same priority than
the second.
|
static boolean |
isNotEqual(Entity a,
Entity b)
Checks if the first of the two entities have different priorities.
|
boolean |
isQueued()
Tests if this
Entity queued in a at least one queue or other QueueBased . |
boolean |
isSimProcess()
Tests if this Entity actually is a SimProcess.
|
static boolean |
isSmaller(Entity a,
Entity b)
Checks if the first of the two entities has a lower priority than the
second.
|
static boolean |
isSmallerOrEqual(Entity a,
Entity b)
Checks if the first of the two entities has lower or same priority than
the second.
|
<E extends Entity> |
schedule(E who2,
EventOf2Entities<?,E> what)
Schedules this Entity to be manipulated by the given EventOf2Entities at the current
time.
|
<E extends Entity> |
schedule(E who2,
EventOf2Entities<?,E> what,
TimeInstant when)
Schedules this Entity to be manipulated by the given EventOf2Entities at the given
point of time.
|
<E extends Entity> |
schedule(E who2,
EventOf2Entities<?,E> what,
TimeSpan dt)
Schedules this Entity to be manipulated by the given EventOf2Entities at the current
time plus the given offset.
|
<E extends Entity,F extends Entity> |
schedule(E who2,
F who3,
EventOf3Entities<?,E,F> what)
Schedules this Entity to be manipulated by the given EventOf3Entities at the current
time.
|
<E extends Entity,F extends Entity> |
schedule(E who2,
F who3,
EventOf3Entities<?,E,F> what,
TimeInstant when)
Schedules this Entity to be manipulated by the given EventOf3Entities at the given
point of time.
|
<E extends Entity,F extends Entity> |
schedule(E who2,
F who3,
EventOf3Entities<?,E,F> what,
TimeSpan dt)
Schedules this Entity to be manipulated by the given EventOf3Entities at the current
time plus the given offset.
|
void |
schedule(Event<?> what)
Schedules this Entity to be manipulated by the given Event at the current
time.
|
void |
schedule(Event<?> what,
TimeInstant when)
Schedules this Entity to be manipulated by the given Event at the given
point of time.
|
void |
schedule(Event<?> what,
TimeSpan dt)
Schedules this Entity to be manipulated by the given Event at the current
time plus the given offset.
|
void |
scheduleAfter(Schedulable after,
Event<?> what)
Schedules this Entity with the given Event to occur directly after the
given Schedulable that is already scheduled.
|
<E extends Entity> |
scheduleAfter(Schedulable after,
EventOf2Entities<?,E> what,
E who2)
Schedules this Entity with the given EventOf2Entities to occur directly after the
given Schedulable that is already scheduled.
|
<E extends Entity,F extends Entity> |
scheduleAfter(Schedulable after,
EventOf3Entities<?,E,F> what,
E who2,
F who3)
Schedules this Entity with the given EventOf3Entities to occur directly after the
given Schedulable that is already scheduled.
|
void |
scheduleBefore(Schedulable before,
Event<?> what)
Schedules this Entity with the given Event to occur directly before the
given Schedulable that is scheduled.
|
<E extends Entity> |
scheduleBefore(Schedulable before,
EventOf2Entities<?,E> what,
E who2)
Schedules this Entity with the given EventOf2Entities to occur directly before the
given Schedulable that is scheduled.
|
<E extends Entity,F extends Entity> |
scheduleBefore(Schedulable before,
EventOf3Entities<?,E,F> what,
E who2,
F who3)
Schedules this Entity with the given EventOf3Entities to occur directly before the
given Schedulable that is scheduled.
|
<E extends Entity> |
schedulePreempt(E who2,
EventOf2Entities<?,E> what)
Schedules this entity with an event to be executed immediately, preempting the
process lifecycle executed at the moment.
|
<E extends Entity,F extends Entity> |
schedulePreempt(E who2,
F who3,
EventOf3Entities<?,E,F> what)
Schedules this entity with an event to be executed immediately, preempting the
process lifecycle executed at the moment.
|
void |
schedulePreempt(Event<?> what)
Schedules this entity with an event to be executed immediately, preempting the
process lifecycle executed at the moment.
|
void |
setQueueingPriority(int newPriority)
Sets the entity's queuing priority to a given integer value.
|
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 Entity(Model owner, java.lang.String name, boolean showInTrace)
public java.util.List<EventAbstract> getScheduledEvents()
public long getIdentNumber()
public int getQueueingPriority()
public java.util.List<QueueBased> getQueues()
QueueBased
objects where this Entity
is queued.QueueBased
s containing this entity; may be empty if entity is not queued.public boolean isQueued()
Entity
queued in a at least one queue or other QueueBased
.true
if this Entity is queued in at least one queue or other QueueBased
,
false
otherwise.public static final boolean isEqual(Entity a, Entity b)
Entity.isEqual(a,b)
where a
and b
are valid Entity objects.a
- Entity : First comparand entityb
- Entity : Second comparand entitytrue
if a
has the same
priority as b
,/false
otherwisepublic static final boolean isLarger(Entity a, Entity b)
Entity.isLarger(a,b)
where a and b are
valid Entity objects.a
- Entity : First comparand entityb
- Entity : Second comparand entitytrue
if a
has a larger
priority than b
,/false
otherwisepublic static final boolean isLargerOrEqual(Entity a, Entity b)
Entity.isLargerOrEqual(a,b)
where a
and b are valid Entity objects.a
- Entity : First comparand entityb
- Entity : Second comparand entitytrue
if a
has a larger or
equal priority than b
,/false
otherwisepublic static final boolean isNotEqual(Entity a, Entity b)
Entity.isNotEqual(a,b)
where a and b are valid Entity
objects.a
- Entity : First comparand entityb
- Entity : Second comparand entitytrue
if a
has a different
priority than b
,/false
otherwisepublic boolean isSimProcess()
true
if this Entity is an instance of
class SimProcess
,false
otherwisepublic static final boolean isSmaller(Entity a, Entity b)
Entity.isSmaller(a,b)
where a and b are
valid Entity objects.a
- Entity : First comparand entityb
- Entity : Second comparand entitytrue
if a
has a lower
priority than b
,/false
otherwisepublic static final boolean isSmallerOrEqual(Entity a, Entity b)
Entity.isSmallerOrEqual(a,b)
where a
and b are valid Entity objects.a
- Entity : First comparand entityb
- Entity : Second comparand entitytrue
if a
has a smaller or
equal priority than b
, /false
otherwisepublic void schedule(Event<?> what, TimeInstant when)
what
- Event : The Event that manipulates this Entitywhen
- TimeInstant : The point in simulation time this event is
scheduled to happen.SimClock
public void schedule(Event<?> what, TimeSpan dt)
what
- Event : The Event that manipulates this Entitydt
- TimeSpan : The offset to the current simulation time at which
the event is to be scheduledSimClock
public void schedule(Event<?> what)
what
- Event : The Event that manipulates this EntitySimClock
public <E extends Entity> void schedule(E who2, EventOf2Entities<?,E> what, TimeInstant when)
who2
- Entity : The second entity to be scheduled for the EventOf2Entities.what
- EventOf2Entities : The event to be scheduledwhen
- TimeInstant : The point in simulation time this event is
scheduled to happen.SimClock
public <E extends Entity> void schedule(E who2, EventOf2Entities<?,E> what, TimeSpan dt)
who2
- Entity : The second entity to be scheduled for the EventOf2Entities.what
- EventOf2Entities : The event to be scheduleddt
- TimeSpan : The offset to the current simulation time at which
the event is to be scheduledSimClock
public <E extends Entity> void schedule(E who2, EventOf2Entities<?,E> what)
who2
- Entity : The second entity to be scheduled for the EventOf2Entities.what
- EventOf2Entities : The event to be scheduledSimClock
public <E extends Entity,F extends Entity> void schedule(E who2, F who3, EventOf3Entities<?,E,F> what, TimeInstant when)
who2
- Entity : The second entity to be scheduled for the EventOf3Entities.who3
- Entity : The third entity to be scheduled for the EventOf3Entities.what
- EventOf3Entities : The event to be scheduledwhen
- TimeInstant : The point in simulation time the event is
scheduled to happen.SimClock
public <E extends Entity,F extends Entity> void schedule(E who2, F who3, EventOf3Entities<?,E,F> what, TimeSpan dt)
who2
- Entity : The second entity to be scheduled for the EventOf3Entities.who3
- Entity : The third entity to be scheduled for the EventOf3Entities.what
- EventOf3Entities : The event to be scheduleddt
- TimeSpan : The offset to the current simulation time at which
the event is to be scheduledSimClock
public <E extends Entity,F extends Entity> void schedule(E who2, F who3, EventOf3Entities<?,E,F> what)
who2
- Entity : The second entity to be scheduled for the EventOf3Entities.who3
- Entity : The third entity to be scheduled for the EventOf3Entities.what
- EventOf3Entities : The event to be scheduledSimClock
public void schedulePreempt(Event<?> what) throws SuspendExecution
what
- Event : The Event that manipulates this EntitySuspendExecution
SimClock
public <E extends Entity> void schedulePreempt(E who2, EventOf2Entities<?,E> what) throws SuspendExecution
who2
- Entity : The second entity to be scheduled for the EventOf2Entities.what
- EventOf2Entities : The event to be scheduledSuspendExecution
SimClock
public <E extends Entity,F extends Entity> void schedulePreempt(E who2, F who3, EventOf3Entities<?,E,F> what) throws SuspendExecution
who2
- Entity : The second entity to be scheduled for the EventOf3Entities.who3
- Entity : The third entity to be scheduled for the EventOf3Entities.what
- EventOf3Entities : The event to be scheduledSuspendExecution
SimClock
public void scheduleAfter(Schedulable after, Event<?> what)
after
- Schedulable : The Schedulable this Entity should be scheduled
afterwhat
- Event : The Event to manipulate this Entitypublic <E extends Entity> void scheduleAfter(Schedulable after, EventOf2Entities<?,E> what, E who2)
who2
- Entity : The second entity to be scheduled for the EventOf2Entities.what
- EventOf2Entities : The event to be scheduledafter
- Schedulable : The Schedulable the event should be scheduled
afterpublic <E extends Entity,F extends Entity> void scheduleAfter(Schedulable after, EventOf3Entities<?,E,F> what, E who2, F who3)
who2
- Entity : The second entity to be scheduled for the EventOf3Entities.who3
- Entity : The third entity to be scheduled for the EventOf3Entities.what
- EventOf3Entities : The event to be scheduledafter
- Schedulable : The Schedulable this Entity should be scheduled
afterwhat
- Event : The Event to manipulate this Entitypublic void scheduleBefore(Schedulable before, Event<?> what)
before
- Schedulable : The Schedulable this Entity should be scheduled
beforewhat
- Event : The Event to manipulate this Entitypublic <E extends Entity> void scheduleBefore(Schedulable before, EventOf2Entities<?,E> what, E who2)
who2
- Entity : The second entity to be scheduled for the EventOf2Entities.what
- EventOf2Entities : The event to be scheduledbefore
- Schedulable : The Schedulable this Entity should be scheduled
beforepublic <E extends Entity,F extends Entity> void scheduleBefore(Schedulable before, EventOf3Entities<?,E,F> what, E who2, F who3)
who2
- Entity : The second entity to be scheduled for the EventOf3Entities.who3
- Entity : The third entity to be scheduled for the EventOf3Entities.what
- EventOf3Entities : The event to be scheduledbefore
- Schedulable : The Schedulable this Entity should be scheduled
beforepublic void setQueueingPriority(int newPriority)
integer
data type [-2147483648, +2147483647].
An entity's queuing priority can be used by the modeller to determine how
the entity is treated by queues, though how precisely a queue will use
the priority to determine sort order is up to it's queuing strategy:
QueueBased.FIFO
sorts entities by their queuing priority,
highest priority first. Entities with the same priority are
enqueued based on "first in, first out".QueueBased.LIFO
also sorts entities by their priority,
highest priority first. However, entities with the same priority are
enqueued based on "last in, first out".QueueBased.Random
assigns a random position to each
entity entering the queue, disregarding priority.newPriority
- int : The new queuing priority value