queueSysPriority

Class: matlab.DiscreteEventSystem
Package: matlab

Define system priority queue storage

Syntax

storage=queueSysPriority(entityType,capacity,order)

Description

storage=queueSysPriority(entityType,capacity,order) defines a priority queue storage element that sorts entities by their system priorities. Use this method when implementing the getEntityStorageImpl method.

Input Arguments

expand all

Type of entities that the new storage element works with.

Maximum number of entities that the storage can contain, specified as a double.

Direction of sorting. Specify 'ascending' if you want entities with smaller system priority values (higher priority) to appear in front of the queue. Use 'descending' if you want entities with higher system priority values (lower priority) to appear in front of the queue.

Output Arguments

expand all

Queue storage element that contains entities and sorts them by the entities’ system priorities.

Examples

expand all

Define a storage element that uses an entity system priority for sorting.

% - Queue sorts entities using entity priority (i.e.
%   the field 'entVar.sys.priority' on a MATLAB variable 'entVar'
%   representing a SimEvents entity)
% - Queue can store entities of type 'myEntity'
% - Queue can store no more than 25 entities
% - Sorting direction is 'ascending', resulting entities with
%   higher priority (or smaller entity priority values) to appear
%   in the front of the queue
storage = obj.queueSysPriority('myEntity', 25, 'ascending');

Introduced in R2016a