Entity

open inner class Entity(aName: String? = null) : ModelElement.QObject, SpatialElementIfc, VelocityIfc

An entity is something that can experience processes and as such may wait in queue. It is a subclass of QObject. The general approach is to use the process() function to define a process that a subclass of Entity can follow. Entity instances may use resources, signals, hold queues, etc. as shared mutable state. Entities may follow a process sequence if defined.

Parameters

aName

an optional name for the entity

Constructors

Link copied to clipboard
constructor(aName: String? = null)

Types

Link copied to clipboard
inner class Request(amountNeeded: Int = 1) : ModelElement.QObject

Represents some amount of units needed from 1 or more resources

Properties

Link copied to clipboard

A reference to an object that can be attached to the QObject when queued

Link copied to clipboard

Controls whether the entity goes through the function dispose() of its containing ProcessModel. The default is true.

Link copied to clipboard
Link copied to clipboard
override val createTime: Double

The time that the QObject was created

Link copied to clipboard
open override var currentLocation: LocationIfc
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The receiver that last received the qObject

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
override val currentTime: Double

The current simulation time. Attached to the queue object for convenience of checking time outside of model element instances.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

True if a process has been scheduled to activate

Link copied to clipboard
override val id: Long

Gets a uniquely assigned identifier for this QObject. This identifier is assigned when the QObject is created. It may vary if the order of creation changes.

Link copied to clipboard
open override val initialLocation: LocationIfc
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override var isMoving: Boolean
Link copied to clipboard
override val isNotQueued: Boolean
Link copied to clipboard
Link copied to clipboard
override val isQueued: Boolean

Checks if the QObject is queued

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val isTracked: Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val modelElement: ModelElement
Link copied to clipboard
override val name: String

The name of the QObject

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

If not null, the name of the process scheduled to activate

Link copied to clipboard
open override val previousLocation: LocationIfc
Link copied to clipboard
Link copied to clipboard
override var priority: Int

Sets the priority to the supplied value If the QObject is queued, the queue's changePriority() method is called (possibly causing a reordering of the queue) which may cause significant reordering overhead otherwise the priority is directly changed Changing this value only changes how the QObjects are compared and may or may not change how they are ordered in the queue, depending on the queue discipline used

Link copied to clipboard
Link copied to clipboard

Provides a list of processes for the entity to follow before being disposed

Link copied to clipboard

An iterator over the entity's current process sequence. If a process sequence is supplied and the property useProcessSequence is true then the iterator is used to determine the next process for the entity to execute.

Link copied to clipboard
open override var qObjectType: Int

A generic attribute to indicate a type for the QObject

Link copied to clipboard
var queue: Queue<*>?

The current queue that the QObject is in, null if not in a queue

Link copied to clipboard

This method can be used to get direct access to the State that represents when the object was queued. This allows access to the total time in the queued state as well as other statistical accumulation of state statistics

Link copied to clipboard
open override var sender: QObjectSenderIfc?

Something that knows how to send qObjects to receivers

Link copied to clipboard
open override val spatialID: Int
Link copied to clipboard
open override val spatialModel: SpatialModel
Link copied to clipboard
open override val spatialName: String
Link copied to clipboard
open override val status: SpatialModel.Status
Link copied to clipboard
override val timeEnteredQueue: Double

The time that the QObject was LAST enqueued

Link copied to clipboard
override val timeExitedQueue: Double

The time that the QObject LAST exited a queue

Link copied to clipboard
override val timeInQueue: Double

The time that the QObject spent in the Queue based on the LAST time dequeued

Link copied to clipboard

can be used to time stamp the qObject

Link copied to clipboard

Controls whether the entity uses an assigned process sequence via the processSequence property at the end of successfully completing a process to determine the next process to experience. The default is true.

Link copied to clipboard
open override var valueObject: GetValueIfc?

Allows for a generic value to be held by the QObject

Link copied to clipboard
open override var velocity: GetValueIfc

The default velocity for the entity's movement within the spatial model of its ProcessModel

Functions

Link copied to clipboard

A string representation of the allocations held by the entity. Useful for printing and diagnostics.

Link copied to clipboard
open override fun attachObserver(observer: ObserverIfc<SpatialElementIfc>)

Allows the adding (attaching) of an observer to the observable

Link copied to clipboard
open operator override fun compareTo(other: ModelElement.QObject): Int

Returns a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified object.

Link copied to clipboard
open override fun countObservers(): Int

Returns how many observers are currently attached to the observable

Link copied to clipboard
fun createRequest(amountNeeded: Int = 1, resource: Resource): ProcessModel.Entity.Request
fun createRequest(amountNeeded: Int = 1, resourcePool: ResourcePool): ProcessModel.Entity.Request

Facilitates the creation of requests for the entity by clients that have access to a reference to the entity or via the entity itself.

Link copied to clipboard
open override fun detachAllObservers()

Detaches all the observers from the observable

Link copied to clipboard
open override fun detachObserver(observer: ObserverIfc<SpatialElementIfc>)

Allows the deletion (removing) of an observer from the observable

Link copied to clipboard
open override fun distanceTo(location: LocationIfc): Double
open override fun distanceTo(element: SpatialElementIfc): Double
Link copied to clipboard

If the entity is in a HoldQueue return the queue

Link copied to clipboard
open override fun initializeSpatialElement()
Link copied to clipboard
open override fun isAttached(observer: ObserverIfc<SpatialElementIfc>): Boolean

Returns true if the observer is already attached

Link copied to clipboard
open override fun isLocationEqualTo(location: LocationIfc): Boolean
open override fun isLocationEqualTo(element: SpatialElementIfc): Boolean
Link copied to clipboard
fun isUsing(resource: Resource): Boolean

Checks if the entity is using (has allocated units) the specified resource.

Link copied to clipboard

Computes the number of different allocations of the resource held by the entity.

Link copied to clipboard
fun resumeProcess(timeUntilResumption: Double = 0.0, priority: Int = KSLEvent.DEFAULT_PRIORITY)

If the entity is executing a process and the process is suspended, then the process is scheduled to resume at the current simulation time.

Link copied to clipboard
fun sender(sender: QObjectSenderIfc?)

Facilitates SAM setting with a lambda

Link copied to clipboard
fun terminateProcess(afterTermination: (entity: ProcessModel.Entity) -> Unit? = null)

If the entity is executing a process and the process is suspended, then the process routine is terminated. This causes the currently suspended process to exit, essentially with an error condition. No further processing within the process will execute. The process ends (is terminated). All resources that the entity has allocated will be deallocated. If the entity was waiting in a queue, the entity is removed from the queue and no statistics are collected on its queueing. If the entity is experiencing a delay, then the event associated with the delay is cancelled.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard

Computes the total number of units of the specified resource that are allocated to the entity.

Link copied to clipboard

Facilitates SAM setting with a lambda