#region License Information
/*
* This file is part of SimSharp which is licensed under the MIT license.
* See the LICENSE file in the project root for more information.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
namespace SimSharp {
///
/// A PriorityStore is similar to a .
/// However, items are removed from the store in order of their priority.
///
/// PriorityStore holds a variable number of individual items.
/// Put and Get are both processed in strict FIFO order.
///
public class PriorityStore {
public int Capacity { get; protected set; }
public int Count { get { return Items.Count; } }
protected Simulation Environment { get; private set; }
protected Queue PutQueue { get; private set; }
protected Queue GetQueue { get; private set; }
protected SimplePriorityQueue Items { get; private set; }
protected List WhenNewQueue { get; private set; }
protected List WhenAnyQueue { get; private set; }
protected List WhenFullQueue { get; private set; }
protected List WhenEmptyQueue { get; private set; }
protected List WhenChangeQueue { get; private set; }
public ITimeSeriesMonitor Utilization { get; set; }
public ITimeSeriesMonitor WIP { get; set; }
public ISampleMonitor LeadTime { get; set; }
public ITimeSeriesMonitor PutQueueLength { get; set; }
public ISampleMonitor PutWaitingTime { get; set; }
public ITimeSeriesMonitor GetQueueLength { get; set; }
public ISampleMonitor GetWaitingTime { get; set; }
public PriorityStore(Simulation environment, int capacity = int.MaxValue) {
if (capacity <= 0) throw new ArgumentException("Capacity must be > 0", "capacity");
Environment = environment;
Capacity = capacity;
PutQueue = new Queue();
GetQueue = new Queue();
Items = new SimplePriorityQueue();
WhenNewQueue = new List();
WhenAnyQueue = new List();
WhenFullQueue = new List();
WhenEmptyQueue = new List();
WhenChangeQueue = new List();
}
public PriorityStore(Simulation environment, IEnumerable