Exemple #1
0
        public override bool Remove(T item)
        {
            var tmpPair = WaitQueue.NewPair(item, 0);

            Debug.Assert(_items.Contains(tmpPair));
            return(_items.Remove(tmpPair));
        }
Exemple #2
0
 internal FilterStore(SimEnvironment env, int capacity, WaitPolicy getPolicy, WaitPolicy putPolicy,
                      WaitPolicy itemPolicy) : base(env)
 {
     _capacity  = capacity;
     _getQueue  = WaitQueue.New <GetEvent>(getPolicy, Env);
     _putQueue  = WaitQueue.New <PutEvent>(putPolicy, Env);
     _itemQueue = WaitQueue.New <T>(itemPolicy, Env);
 }
Exemple #3
0
 internal Container(SimEnvironment env, double capacity, double level, WaitPolicy getPolicy, WaitPolicy putPolicy)
     : base(env)
 {
     _capacity = capacity;
     Level     = level;
     _getQueue = WaitQueue.New <GetEvent>(getPolicy, Env);
     _putQueue = WaitQueue.New <PutEvent>(putPolicy, Env);
 }
Exemple #4
0
 public override bool Contains(T item)
 {
     return(_items.Contains(WaitQueue.NewPair(item, 0)));
 }
Exemple #5
0
 public override void Add(T item, double priority)
 {
     _items.Add(WaitQueue.NewPair(item, _random.Next()));
 }
Exemple #6
0
 public override void Add(T item, double priority)
 {
     _items.Add(WaitQueue.NewPair(item, priority));
 }
Exemple #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="env"></param>
 /// <param name="capacity"></param>
 /// <param name="requestPolicy"></param>
 internal Resource(SimEnvironment env, int capacity, WaitPolicy requestPolicy) : base(env)
 {
     _capacity     = capacity;
     _requestQueue = WaitQueue.New <RequestEvent>(requestPolicy, Env);
 }