atropos.lp
Class AvnmpQueue

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.Vector
                    |
                    +--atropos.util.OrderedList
                          |
                          +--atropos.lp.AvnmpQueue
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.util.List, java.io.Serializable
Direct Known Subclasses:
AvnmpRecQueue, AvnmpSndQueue

public class AvnmpQueue
extends OrderedList
implements java.io.Serializable

This class implements a queue for the logical process receive and send queues.

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
          Is this a send or receive queue ?
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
AvnmpQueue()
          Create an empty queue.
AvnmpQueue(java.lang.String name)
          Create an empty queue with the input name.
 
Method Summary
 boolean add(java.lang.Object sa)
          Add to the sorted table.
 void addMessage(AvnmpPacket ap, AvnmpLP mylp)
          Add a message to this queue.
 AvnmpQueue append(AvnmpQueue q, AvnmpLP mylp)
          Append the elements of another queue to this one.
protected  void cancel(AvnmpPacket cp, AvnmpLP mylp)
          Check for cancellation of an anti-message.
 int compare(java.lang.Object o1, java.lang.Object o2)
          This is required to keep the packets sorted by receive time.
 void deleteMessage(AvnmpPacket ap)
          Delete a message from this queue.
 AvnmpPacket getClosestTime(long st, AvnmpLP mylp)
          Return the packet from this queue whose receive time is closest to the input time.
 AvnmpPacket getGreaterOrEqualRecTime(long rt)
           
 AvnmpPacket getGreaterOrEqualSndTime(long st)
           
 AvnmpPacket getGreaterRecTime(long rt)
           
 AvnmpPacket getGreaterSndTime(long st)
           
 AvnmpPacket getLessOrEqualRecTime(long rt)
           
 AvnmpPacket getLessOrEqualSndTime(long st)
           
 AvnmpPacket getLessRecTime(long rt)
           
 AvnmpPacket getLessSndTime(long st)
           
 AvnmpPacket getMessage(byte a, java.lang.String Src, long rt, java.lang.String Dst, long st)
          Return a pointer to the message in this queue which matches the input parameters.
 AvnmpPacket getReal()
           
 AvnmpPacket getVirtual()
           
 double numReal(long t)
          Return the number of real messages between two times.
 double numVirtual(long t)
          Return the number of virtual messages between two times.
 void plotQueue(AvnmpLP mylp)
          Generate a gnuplot data file of the current state of the queue.
 java.lang.String QtoString()
          Display the contents of this queue.
 int queueSize()
          Return the size of the queue.
 boolean remove(java.lang.Object sa)
          Remove a from the sorted table.
 
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
Is this a send or receive queue ?
Constructor Detail

AvnmpQueue

public AvnmpQueue()
Create an empty queue.

AvnmpQueue

public AvnmpQueue(java.lang.String name)
Create an empty queue with the input name.
Parameters:
name - Queue name.
Method Detail

add

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

remove

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

addMessage

public void addMessage(AvnmpPacket ap,
                       AvnmpLP mylp)
Add a message to this queue.
Parameters:
ap - The message to add

deleteMessage

public void deleteMessage(AvnmpPacket ap)
Delete a message from this queue.
Parameters:
ap - A message equal to the message to delete.
See Also:
AvnmpPacket.isEqual(atropos.lp.AvnmpPacket)

getMessage

public AvnmpPacket getMessage(byte a,
                              java.lang.String Src,
                              long rt,
                              java.lang.String Dst,
                              long st)
Return a pointer to the message in this queue which matches the input parameters.
Parameters:
a - Anti-toggle
Src - Source Node
rt - Receive time
Dst - Destination Node
st - Send time
Returns:
A pointer to the packet in this queue.

getGreaterRecTime

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

getGreaterOrEqualRecTime

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

getLessRecTime

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

getLessOrEqualRecTime

public AvnmpPacket getLessOrEqualRecTime(long rt)
Parameters:
rt - Time
Returns:
The packet in this queue whose receive time is less than or equal to the input time.

getGreaterSndTime

public AvnmpPacket getGreaterSndTime(long st)
Parameters:
st - Time
Returns:
The packet in this queue whose send time is greater than the input time.

getGreaterOrEqualSndTime

public AvnmpPacket getGreaterOrEqualSndTime(long st)
Parameters:
st - Time
Returns:
The packet in this queue whose send time is greater than or equal to the input time.

getLessSndTime

public AvnmpPacket getLessSndTime(long st)
Parameters:
st - Time
Returns:
The packet in this queue whose send time is less than the input time.

getLessOrEqualSndTime

public AvnmpPacket getLessOrEqualSndTime(long st)
Parameters:
st - Time
Returns:
The packet in this queue whose send time is less than or equal to the input time.

getVirtual

public AvnmpPacket getVirtual()
Returns:
The next virtual packet in the queue.

numReal

public double numReal(long t)
Return the number of real messages between two times.
Parameters:
pt - Lower time
t - Upper time
Returns:
Number of virtual messages.

numVirtual

public double numVirtual(long t)
Return the number of virtual messages between two times.
Parameters:
pt - Lower time
t - Upper time
Returns:
Number of virtual messages.

getReal

public AvnmpPacket getReal()
Returns:
The next real packet in the queue.

QtoString

public java.lang.String QtoString()
Display the contents of this queue.

getClosestTime

public AvnmpPacket getClosestTime(long st,
                                  AvnmpLP mylp)
Return the packet from this queue whose receive time is closest to the input time.
Parameters:
st - Time
Returns:
The packet whose RECEIVE TIME is closest to the input time.

append

public AvnmpQueue append(AvnmpQueue q,
                         AvnmpLP mylp)
Append the elements of another queue to this one.
Parameters:
q - Queue to be appended
Returns:
This queue with q appended.

queueSize

public int queueSize()
Return the size of the queue.
Returns:
The current queue size.

plotQueue

public void plotQueue(AvnmpLP mylp)
Generate a gnuplot data file of the current state of the queue.

cancel

protected void cancel(AvnmpPacket cp,
                      AvnmpLP mylp)
Check for cancellation of an anti-message. The corresponding anti-message will be deleted from this queue. Note that the input message, cp, is assumed not to have entered the input queue yet, and thus is not deleted by this method.
Parameters:
cp - Message to check.
mylp - The current logical process.

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
This is required to keep the packets sorted by receive time.
Overrides:
compare in class OrderedList


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