Class: ConstrainedQueue

ConstrainedQueue(maxSizeopt, eqCompareropt, capacityPolicyopt)

new ConstrainedQueue(maxSizeopt, eqCompareropt, capacityPolicyopt)

Creates a new, empty ConstrainedQueue.
Parameters:
Name Type Attributes Description
maxSize Number <optional>
Optional. Defaults to Number.MAX_SAFE_INTEGER. Use this parameter to limit the maximum amount of elements this Queue can hold. When the limit is reached and items are being further enqueued, the ConstrainedQueue will, according to the maximum capacity policy, deal with additional items. This parameter must be a positive integer larger than zero.
eqComparer EqualityComparer.<T> <optional>
Optional. Defaults To EqualityComparer.default.
capacityPolicy ConstrainedQueueCapacityPolicy | Number <optional>
Optional. Defaults to Dequeue. How to deal with more items once this queue reaches its full capacity.
Author:
Source:

Members

capacityPolicy :ConstrainedQueueCapacityPolicy

Returns the current capacity policy.
Type:
Source:

capacityPolicy :void

Type:
  • void
Source:

isFull :Boolean

Returns whether this queue has reached its full maximum capacity.
Type:
  • Boolean
Source:

maxSize :Number

Type:
  • Number
Source:

maxSize :void

Sets the maximum size of this ConstrainedQueue. If currently there are more items, the queue will be truncated (i.e. the excess items will be discarded). The excess items will be taken from the head of the queue (dequeued).
Type:
  • void
Source:

Methods

enqueue(item) → {this}

Parameters:
Name Type Description
item T
Source:
Returns:
Type
this