Boeing Simulation 3.1 API Specification

util
Class PriorityProvider

java.lang.Object
  |
  +--util.PriorityProvider

public class PriorityProvider
extends Object

An object for dynamically adjusting the priorities of object when enqueued in a FairWeightedQueue.

Version:
$Revision: 1.10 $
Author:
Jim Adamich
, Dave Jurgens

Field Summary
 int defaultPriority
           
 int highestPriority
           
 int lowestPriority
           
 int numberOfPriorities
           
private  HashMap priorityMappings
           
private static long serialVersionUID
           
private  HashMap specifiedClasses
           
 
Constructor Summary
PriorityProvider(int numberOfPriorities)
          If no default is selected, choose the middle priority as the default
PriorityProvider(int numberOfPriorities, int defaultPriority)
           
 
Method Summary
 void decrementClassPriority(Class c)
          Sets a mark so that all objects of the specified class will have one lower priority.
 boolean decrementPriority(Object o)
          Decrements the priority of object o.
protected  int getHighestPriority(int i, int j)
          Returns the highest priority between the two priorities.
protected  int getNextHighestPriority(int priority)
          Returns the next highest priority or the highest priority, if priority is currently at maximum.
protected  int getNextLowestPriority(int priority)
          Returns the next lowest priority or the lowest priority, if priority is currently at minimum.
 int getNumberOfPriorities()
          Returns the number of priorities currently supported.
 int getPriority(Object o)
          For a given object o, returns the priority specified for o.
 void incrementClassPriority(Class c)
          Sets a mark so that all objects of the specified class will have one higher priority.
 boolean incrementPriority(Object o)
          Increments the priority of object o.
 void resetPriorities()
          Removes all specified Priorities
 void resetPriority(Object o)
          Removes any specified priority association.
 void setHighestClassPriority(Class c)
          Sets a mark so that all objects of the specified class will have the highest priority.
 boolean setHighestPriority(Object o)
          Attempts to set o to the highest priority.
 void setLowestClassPriority(Class c)
          Sets a mark so that all objects of the specified class will have the lowest priority.
 boolean setLowestPriority(Object o)
          Attempts to set o to the lowest priority.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

highestPriority

public final int highestPriority

lowestPriority

public final int lowestPriority

defaultPriority

public final int defaultPriority

numberOfPriorities

public final int numberOfPriorities

priorityMappings

private HashMap priorityMappings

specifiedClasses

private HashMap specifiedClasses
Constructor Detail

PriorityProvider

public PriorityProvider(int numberOfPriorities,
                        int defaultPriority)

PriorityProvider

public PriorityProvider(int numberOfPriorities)
If no default is selected, choose the middle priority as the default

Method Detail

getNumberOfPriorities

public int getNumberOfPriorities()
Returns the number of priorities currently supported.


resetPriorities

public void resetPriorities()
Removes all specified Priorities


resetPriority

public void resetPriority(Object o)
Removes any specified priority association. Does not remove any associated class-based priority.


incrementPriority

public boolean incrementPriority(Object o)
Increments the priority of object o. Returns true if o's priority was actually changed.


decrementPriority

public boolean decrementPriority(Object o)
Decrements the priority of object o. Returns true if o's priority was actually changed.


setHighestPriority

public boolean setHighestPriority(Object o)
Attempts to set o to the highest priority. Returns true if the priority of o was changed to the highest priority.


setLowestPriority

public boolean setLowestPriority(Object o)
Attempts to set o to the lowest priority. Returns true if the priority of o was changed to the lowest priority.


incrementClassPriority

public void incrementClassPriority(Class c)
Sets a mark so that all objects of the specified class will have one higher priority.


decrementClassPriority

public void decrementClassPriority(Class c)
Sets a mark so that all objects of the specified class will have one lower priority.


setHighestClassPriority

public void setHighestClassPriority(Class c)
Sets a mark so that all objects of the specified class will have the highest priority.


setLowestClassPriority

public void setLowestClassPriority(Class c)
Sets a mark so that all objects of the specified class will have the lowest priority.


getNextHighestPriority

protected int getNextHighestPriority(int priority)
Returns the next highest priority or the highest priority, if priority is currently at maximum.


getNextLowestPriority

protected int getNextLowestPriority(int priority)
Returns the next lowest priority or the lowest priority, if priority is currently at minimum.


getHighestPriority

protected int getHighestPriority(int i,
                                 int j)
Returns the highest priority between the two priorities.


getPriority

public int getPriority(Object o)
For a given object o, returns the priority specified for o. Specified object priority takes precedence to specified class priority. The method also traverses the superclass / interface tree to make sure no specified priorities are missed. If two or more class priorities have been specified at class level, the highest class's priority is returned. If more than one interface has proiority has been set for a class, then highest priority is returned. If no priority has been specified, defaultPriority is returned.


Boeing Simulation 3.1 API Specification

To submit a bug or feature email the author of that class. Funding for this research was provided by Boeing and DARPA.