Ejemplo n.º 1
0
            public QueueRequestIfc Dequeue()
            {
                Monitor.Enter(this);
                QueueRequestIfc result;

                try
                {
                    QueuedTileProvider.QueueRequestCell firstKey = this.queue.FirstKey;
                    if (firstKey == null)
                    {
                        result = null;
                    }
                    else
                    {
                        this.queue.Remove(firstKey);
                        this.cellMap.Remove(firstKey.qr);
                        this.UpdateDebugList();
                        result = firstKey.qr;
                    }
                }
                finally
                {
                    Monitor.Exit(this);
                }
                return(result);
            }
Ejemplo n.º 2
0
            public void TruncateQueue(int targetCount)
            {
                List <QueuedTileProvider.QueueRequestCell> list = new List <QueuedTileProvider.QueueRequestCell>();

                Monitor.Enter(this);
                try
                {
                    while (this.queue.Count > targetCount)
                    {
                        QueuedTileProvider.QueueRequestCell lastKey = this.queue.LastKey;
                        this.cellMap.Remove(lastKey.qr);
                        this.queue.Remove(lastKey);
                        list.Add(lastKey);
                    }
                    this.UpdateDebugList();
                }
                finally
                {
                    Monitor.Exit(this);
                }
                foreach (QueuedTileProvider.QueueRequestCell current in list)
                {
                    current.qr.DeQueued();
                }
            }
Ejemplo n.º 3
0
            public int CompareTo(object o)
            {
                QueuedTileProvider.QueueRequestCell queueRequestCell = (QueuedTileProvider.QueueRequestCell)o;
                int num = -this.queuedInterest.CompareTo(queueRequestCell.queuedInterest);

                if (num != 0)
                {
                    return(num);
                }
                return(this.uniqueID.CompareTo(queueRequestCell.uniqueID));
            }
Ejemplo n.º 4
0
 public void Enqueue(QueueRequestIfc qr)
 {
     Monitor.Enter(this);
     try
     {
         QueuedTileProvider.QueueRequestCell queueRequestCell = new QueuedTileProvider.QueueRequestCell();
         queueRequestCell.qr             = qr;
         queueRequestCell.queuedInterest = qr.GetInterest();
         this.cellMap.Add(qr, queueRequestCell);
         this.queue.Add(queueRequestCell, qr);
         this.UpdateDebugList();
     }
     finally
     {
         Monitor.Exit(this);
     }
 }
Ejemplo n.º 5
0
			public void Enqueue(QueueRequestIfc qr)
			{
				Monitor.Enter(this);
				try
				{
					QueuedTileProvider.QueueRequestCell queueRequestCell = new QueuedTileProvider.QueueRequestCell();
					queueRequestCell.qr = qr;
					queueRequestCell.queuedInterest = qr.GetInterest();
					this.cellMap.Add(qr, queueRequestCell);
					this.queue.Add(queueRequestCell, qr);
					this.UpdateDebugList();
				}
				finally
				{
					Monitor.Exit(this);
				}
			}
Ejemplo n.º 6
0
 public void ChangePriority(QueueRequestIfc qr)
 {
     Monitor.Enter(this);
     try
     {
         if (this.cellMap.ContainsKey(qr))
         {
             QueuedTileProvider.QueueRequestCell key = this.cellMap[qr];
             this.queue.Remove(key);
             this.cellMap.Remove(qr);
             this.Enqueue(qr);
             this.UpdateDebugList();
         }
     }
     finally
     {
         Monitor.Exit(this);
     }
 }