atropos.lp
Class AvnmpStateQueue

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.Vector
                    |
                    +--atropos.util.OrderedList
                          |
                          +--atropos.lp.AvnmpStateQueue
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.util.List, java.io.Serializable

public class AvnmpStateQueue
extends OrderedList
implements java.io.Serializable

This class implements the AVNMP state queue.

This research is funded by DARPA/ITO Contract Number: F30602-98-C-0230 supported by the Air Force Research Laboratory/IF.

Version:
$Revision: 1.1.1.1 $ $State: Exp $
Author:
Steve Bush
See Also:
Serialized Form

Field Summary
protected  java.lang.String QueueName
          Name to identify this queue.
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
AvnmpStateQueue()
          Construct an empty state queue.
 
Method Summary
 boolean add(java.lang.Object sa)
          Add a subagent to the sorted table.
 void addStateQueue(long t, java.lang.Object pl, boolean p, AvnmpLP mylp)
          Cache a state in the queue.
 int compare(java.lang.Object o1, java.lang.Object o2)
          Keep states ordered by save time.
 void deleteStateQueue(long t)
          Remove a state from the queue.
 double getAvg(long ts, long te)
          Return the average of a set of state values from a given start time to a given end time from the state queue.
 AvnmpState getClosestTime(long st)
          Return a pointer to the closest state based on the time.
 AvnmpState getGreaterOrEqualRecTime(long rt)
           
 AvnmpState getGreaterRecTime(long rt)
           
 AvnmpState getLessOrEqualRecTime(long rt)
           
 AvnmpState getLessRecTime(long rt)
           
 AvnmpState getStateQueue(long t)
          Return a state based on time.
 AvnmpStateQueue getStates(long ts, long te)
          Retrieve a set of state values from a given start time to a given end time.
 void plotQueue(AvnmpLP mylp)
          Generate a gnuplot data file of the current state of the queue.
 java.lang.String QtoString()
          Display the state queue.
 void rbstate(long t)
          Remove states which are invalid after a given time.
 boolean remove(java.lang.Object sa)
          Remove from the sorted table.
 void RemoveFossils(long t)
          Remove messages with a value less than the given time.
 void updateSnmpObjects(snmp.agent.AppCommunicator c, java.lang.String pLoadOid, java.lang.String pTimeOid, AvnmpTime lvt, AvnmpTime t, AvnmpLP mylp)
          Update the SNMP agent with the entire contents of the state queue.
 
Methods inherited from class atropos.util.OrderedList
clear, get, remove
 
Methods inherited from class java.util.Vector
add, addAll, addAll, addElement, capacity, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Field Detail

QueueName

protected java.lang.String QueueName
Name to identify this queue.
Constructor Detail

AvnmpStateQueue

public AvnmpStateQueue()
Construct an empty state queue.
Method Detail

add

public boolean add(java.lang.Object sa)
Add a subagent to the sorted table.
Overrides:
add in class OrderedList

remove

public boolean remove(java.lang.Object sa)
Remove from the sorted table.
Overrides:
remove in class java.util.Vector

rbstate

public void rbstate(long t)
Remove states which are invalid after a given time.
Parameters:
t - Time after which all predictions should be removed.

addStateQueue

public void addStateQueue(long t,
                          java.lang.Object pl,
                          boolean p,
                          AvnmpLP mylp)
Cache a state in the queue. Remove any previous predictions.
Parameters:
t - Time state is valid
pl - State
p - true indicates a predicted state, false a real state
mylp - The logical process object

deleteStateQueue

public void deleteStateQueue(long t)
Remove a state from the queue.
Parameters:
t - Delete state based on the time

getStateQueue

public AvnmpState getStateQueue(long t)
                         throws NotFoundInQueueException
Return a state based on time.
Parameters:
t - Time state is valid
Returns:
State with the given time.

getGreaterRecTime

public AvnmpState getGreaterRecTime(long rt)
                             throws NotFoundInQueueException
Parameters:
rt - Time
Returns:
The state in this queue whose receive time is greater than the input time.

getGreaterOrEqualRecTime

public AvnmpState getGreaterOrEqualRecTime(long rt)
                                    throws NotFoundInQueueException
Parameters:
rt - Time
Returns:
The state in this queue whose receive time is greater than or equal to the input time.

getLessRecTime

public AvnmpState getLessRecTime(long rt)
                          throws NotFoundInQueueException
Parameters:
rt - Time
Returns:
The state in this queue whose receive time is less than the input time.

getLessOrEqualRecTime

public AvnmpState getLessOrEqualRecTime(long rt)
                                 throws NotFoundInQueueException
Parameters:
rt - Time
Returns:
The state in this queue which has the largest save time that is less than or equal to the input time.

getClosestTime

public AvnmpState getClosestTime(long st)
                          throws NotFoundInQueueException
Return a pointer to the closest state based on the time.
Parameters:
st - Time
Returns:
The state whose valid time is closest to the input parameter.

QtoString

public java.lang.String QtoString()
Display the state queue.

plotQueue

public void plotQueue(AvnmpLP mylp)
Generate a gnuplot data file of the current state of the queue.
Parameters:
mylp - The logical process in which this object resides.

getStates

public AvnmpStateQueue getStates(long ts,
                                 long te)
Retrieve a set of state values from a given start time to a given end time.
Parameters:
ts - start time
te - end time
Returns:
The states between the given start and end times inclusive.

getAvg

public double getAvg(long ts,
                     long te)
Return the average of a set of state values from a given start time to a given end time from the state queue.
Parameters:
ts - start time
te - end time
Returns:
An average of the state values between the given start and end times * inclusive.

updateSnmpObjects

public void updateSnmpObjects(snmp.agent.AppCommunicator c,
                              java.lang.String pLoadOid,
                              java.lang.String pTimeOid,
                              AvnmpTime lvt,
                              AvnmpTime t,
                              AvnmpLP mylp)
Update the SNMP agent with the entire contents of the state queue.
Parameters:
c - The SNMP agent context
pLoadOid - The predicted load object id
pTimeOid - The predicted time for the above load object
lvt - The current object's LVT
t - The current wallclock time for this LP
mylp - The current LP

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Keep states ordered by save time. Largest times first.
Overrides:
compare in class OrderedList

RemoveFossils

public void RemoveFossils(long t)
Remove messages with a value less than the given time. Clean out fossils.
Parameters:
t - Remove values less than this time.


Copyright © 2002 GE Corporate Research and Development. All Rights Reserved.