EVEDemo.SWEEP
Class Queue

java.lang.Object
  |
  +--EVEDemo.SWEEP.Queue
Direct Known Subclasses:
MessageQueue

public class Queue
extends java.lang.Object
implements java.io.Serializable

This class implement a rotate queue I think this class need to consider "Syncronize"

See Also:
Serialized Form

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
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

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
Constructor Detail

Queue

public Queue()
Constructor of Queue with default length 10000.
Method Detail

Append

public int Append(UpdateData theUpdata)
           throws java.lang.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 void Initialize()
Construct a Queue with specific Length.
Parameters:
newSize - length of the queue.

dequeue

public Element dequeue()
                throws java.lang.Exception
Same as Dequeue function. Correct Naming format of function.

Dequeue

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

enqueue

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

Enqueue

public 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 Element getFirst()

getNext

protected Element getNext()

increase

private int increase(int Num)