ResourcePool

open class ResourcePool @JvmOverloads constructor(parent: ModelElement, poolResources: List<Resource>, name: String? = null) : AbstractResourcePool<Resource> , ResourcePoolCIfc(source)

A ResourcePool represents a list of Resources from which resources can be selected to fill requests made by Entities.

Resources are selected according to a ResourceSelectionRule. The assumption is that any of the resources within the pool may be used to fill the request.

If no selection rule is supplied the pool selects a list of resources that can fully satisfy the request and makes allocations to the resources based on the order in which they are listed in the pool.

Author

rossetti

Parameters

parent

the parent model element

poolResources

a list of resources to be included in the pool

name

the name of the pool

Inheritors

Constructors

Link copied to clipboard
constructor(parent: ModelElement, numResources: Int = 1, name: String? = null)

Makes the specified number of single unit resources and includes them in the pool.

constructor(parent: ModelElement, poolResources: List<Resource>, name: String? = null)

Functions

Link copied to clipboard
open override fun addResource(resource: Resource)

Adds a resource to the pool. The model must not be running when adding a resource.

Link copied to clipboard
fun allocate(entity: ProcessModel.Entity, amountNeeded: Int = 1, queue: RequestQ, resourceSelectionRule: ResourceSelectionRuleIfc = defaultResourceSelectionRule, resourceAllocationRule: ResourceAllocationRuleIfc = defaultResourceAllocationRule, allocationName: String? = null): ResourcePoolAllocation

It is an error to attempt to allocate resource units to an entity if there are insufficient units available. Thus, the amount requested must be less than or equal to the number of units available at the time of this call.

Link copied to clipboard
fun canAllocate(resourceSelectionRule: ResourceSelectionRuleIfc, amountNeeded: Int): Boolean

For use, before calling allocate()

Link copied to clipboard
fun deallocate(poolAllocation: ResourcePoolAllocation)