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"
-
current
-
-
head
- head of queue
-
index
- index of elements
-
size
- default queue size is 10000
-
tail
- tail of queue
-
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.
-
Queue()
- Constructor of Queue with default length 10000.
-
Append(UpdateData)
- Append one UpdateData as end of the Queue.
-
dequeue()
- Same as Dequeue function.
-
Dequeue()
- this Method will dequeue an Element from the queue
if the queue is emtpy, the return Element will be null
-
enqueue(Element)
- Just for standards the Naming rules.
-
Enqueue(Element)
-
-
getFirst()
-
-
getNext()
-
-
increase(int)
-
-
Initialize()
- Construct a Queue with specific Length.
-
isEmpty()
-
-
isFull()
-
-
length()
- Return the current length of the queue.
size
int size
- default queue size is 10000
index
Element index[]
- index of elements
head
int head
- head of queue
tail
int tail
- tail of queue
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.
current
int current
Queue
public Queue()
- Constructor of Queue with default length 10000.
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
Initialize
private synchronized void Initialize()
- Construct a Queue with specific Length.
- Parameters:
- newSize - length of the queue.
dequeue
public synchronized Element dequeue() throws Exception
- Same as Dequeue function. Correct Naming format of function.
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
enqueue
public synchronized int enqueue(Element NewElement) throws QueueFullException
- Just for standards the Naming rules. Functions should start with lower case
letters.
Enqueue
public synchronized int Enqueue(Element NewElement) throws QueueFullException
isEmpty
public boolean isEmpty()
isFull
public boolean isFull()
length
public int length()
- Return the current length of the queue.
getFirst
protected synchronized Element getFirst()
getNext
protected synchronized Element getNext()
increase
private synchronized int increase(int Num)
All Packages Class Hierarchy This Package Previous Next Index