|
Boeing Simulation 3.1 API Specification | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--util.FairWeightedQueue
A queue structure that provides for weighted priorities while still dequeueing in a manner that allows lower priorities to be dequeued even when higher priority objects may still be in the system.
| Field Summary | |
private double[] |
distributions
This array represent the numerical distributions for a given priority. |
private util.PriorityProvider |
pp
This field provides a priority index for an enqueued object via the getPriority() call. |
private util.Queue[] |
queues
These queues represent all possible probabilities from 1 to queues.length, with queues.length representing the lowest possible priority. |
private Random |
random
The Random object provides a stochastic way of choosing the next priority from our array of distributions. |
private static long |
serialVersionUID
|
private int |
size
Total number of all objects enqueued in all queues. |
private boolean |
waiting
To conserve the number of notify calls made, the dequeue method will set this field to true before it waits. |
| Constructor Summary | |
FairWeightedQueue(util.PriorityProvider pp)
The number of priorities is gotten from the PriorityProvider. |
|
| Method Summary | |
Object |
dequeue()
This method removes from a queue by selected a random number and then iterating through the distribution values until it finds a priority with a distribution that is greated than the ranged value. |
void |
enqueue(Object o)
This method queries the given ProvidesPriority for the priority value Object o. |
boolean |
enqueue(util.PriorityEnqueueable p)
This method queries the given ProvidesPriority for the priority value of the getEvaluationObject(). |
protected boolean |
enqueueObject(Object o,
int index)
This method tries to enqueue the object at the specified index in the array of queues. |
boolean |
isEmpty()
Returns whether the queue is currently empty. |
int |
size()
Returns the number of items currently in the queue. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static final long serialVersionUID
private util.PriorityProvider pp
private util.Queue[] queues
private double[] distributions
private Random random
private int size
private boolean waiting
| Constructor Detail |
public FairWeightedQueue(util.PriorityProvider pp)
| Method Detail |
public void enqueue(Object o)
enqueue in interface Queuepublic boolean enqueue(util.PriorityEnqueueable p)
protected boolean enqueueObject(Object o,
int index)
public boolean isEmpty()
Queue
isEmpty in interface Queuepublic int size()
Queue
size in interface Queuepublic Object dequeue()
dequeue in interface Queue
|
Boeing Simulation 3.1 API Specification | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||