All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class SWEEP.Queue

java.lang.Object
   |
   +----SWEEP.Queue

public class Queue
extends Object
implements Serializable
This class implement a rotate queue I think this class need to consider "Syncronize"


Variable Index

 o current
 o head
head of queue
 o index
index of elements
 o size
default queue size is 10000
 o tail
tail of queue
 o wl
For the queue, not only the method to be synchronized that only one thread can access the method at one time, we also need all the methods need to be synchronized, that means only one modification methods can access the queue at one time.

Constructor Index

 o Queue()
Constructor of Queue with default length 10000.

Method Index

 o Append(UpdateData)
Append one UpdateData as end of the Queue.
 o dequeue()
Same as Dequeue function.
 o Dequeue()
this Method will dequeue an Element from the queue if the queue is emtpy, the return Element will be null
 o enqueue(Element)
Just for standards the Naming rules.
 o Enqueue(Element)
 o getFirst()
 o getNext()
 o increase(int)
 o Initialize()
Construct a Queue with specific Length.
 o isEmpty()
 o isFull()
 o length()
Return the current length of the queue.

Variables

 o size
 int size
default queue size is 10000

 o index
 Element index[]
index of elements

 o head
 int head
head of queue

 o tail
 int tail
tail of queue

 o wl
 Lock wl
For the queue, not only the method to be synchronized that only one thread can access the method at one time, we also need all the methods need to be synchronized, that means only one modification methods can access the queue at one time.

 o current
 int current

Constructors

 o Queue
 public Queue()
Constructor of Queue with default length 10000.

Methods

 o Append
 public synchronized int Append(UpdateData theUpdata) throws Exception
Append one UpdateData as end of the Queue. Same as the Enqueue method.

Parameters:
theUpdata - a data update.
Returns:
length of the queue
 o Initialize
 private synchronized void Initialize()
Construct a Queue with specific Length.

Parameters:
newSize - length of the queue.
 o dequeue
 public synchronized Element dequeue() throws Exception
Same as Dequeue function. Correct Naming format of function.

 o Dequeue
 public synchronized Element Dequeue() throws Exception
this Method will dequeue an Element from the queue if the queue is emtpy, the return Element will be null

 o enqueue
 public synchronized int enqueue(Element NewElement) throws QueueFullException
Just for standards the Naming rules. Functions should start with lower case letters.

 o Enqueue
 public synchronized int Enqueue(Element NewElement) throws QueueFullException
 o isEmpty
 public boolean isEmpty()
 o isFull
 public boolean isFull()
 o length
 public int length()
Return the current length of the queue.

 o getFirst
 protected synchronized Element getFirst()
 o getNext
 protected synchronized Element getNext()
 o increase
 private synchronized int increase(int Num)

All Packages  Class Hierarchy  This Package  Previous  Next  Index