|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--EVEDemo.SWEEP.Queue
This class implement a rotate queue I think this class need to consider "Syncronize"
Field Summary | |
(package private) int |
current
|
(package private) int |
head
head of queue |
(package private) Element[] |
index
index of elements |
(package private) int |
size
default queue size is 10000 |
(package private) int |
tail
tail of queue |
(package private) 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. |
Constructor Summary | |
Queue()
Constructor of Queue with default length 10000. |
Method Summary | |
int |
Append(UpdateData theUpdata)
Append one UpdateData as end of the Queue. |
Element |
dequeue()
Same as Dequeue function. |
Element |
Dequeue()
this Method will dequeue an Element from the queue if the queue is emtpy, the return Element will be null |
int |
enqueue(Element NewElement)
Just for standards the Naming rules. |
int |
Enqueue(Element NewElement)
|
protected Element |
getFirst()
|
protected Element |
getNext()
|
private int |
increase(int Num)
|
private void |
Initialize()
Construct a Queue with specific Length. |
boolean |
isEmpty()
|
boolean |
isFull()
|
int |
length()
Return the current length of the queue. |
Methods inherited from class java.lang.Object |
|
Field Detail |
int size
Element[] index
int head
int tail
Lock wl
int current
Constructor Detail |
public Queue()
Method Detail |
public int Append(UpdateData theUpdata) throws java.lang.Exception
theUpdata
- a data update.private void Initialize()
newSize
- length of the queue.public Element dequeue() throws java.lang.Exception
public Element Dequeue() throws java.lang.Exception
public int enqueue(Element NewElement) throws QueueFullException
public int Enqueue(Element NewElement) throws QueueFullException
public boolean isEmpty()
public boolean isFull()
public int length()
protected Element getFirst()
protected Element getNext()
private int increase(int Num)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |