Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

echopoint.asynch
Class AsynchEventQueue  view AsynchEventQueue download AsynchEventQueue.java

java.lang.Object
  extended byechopoint.asynch.AsynchEventQueue
All Implemented Interfaces:
AsynchEventSink, java.io.Serializable

public class AsynchEventQueue
extends java.lang.Object
implements AsynchEventSink, java.io.Serializable

AysnchEventQueue is a class that can hold AsyncEvents in a queue'ed fashion.


Field Summary
private  int capacity
           
private  int front
           
private  java.lang.Object[] queue
           
private  int rear
           
 
Constructor Summary
AsynchEventQueue()
          Constructs a AysnchEventQueue with a capacity of 20 events.
AsynchEventQueue(int capacity)
          Constructs a AysnchEventQueue with the specified capacity.
 
Method Summary
 AsynchEvent getEvent()
          Returns the next event in the sink, waiting forever till one is available.
 AsynchEvent getEvent(long waitTime)
          Returns the next event in the sink, waiting for waitTime.
 int getSize()
          Returns the number of events in the queue
 boolean isEmpty()
          Is the queue empty ?
 boolean isFull()
          Is the queue full ?
private  int next(int index)
          Circular counter.
 boolean putEvent(AsynchEvent asynchEvent)
          Puts an event into the sink, waiting forever until there is room to place the event..
 boolean putEvent(AsynchEvent asynchEvent, int waitTime)
          Puts an event into the sink, waiting up to waitTime until there is room to place the event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

capacity

private int capacity

queue

private java.lang.Object[] queue

front

private int front

rear

private int rear
Constructor Detail

AsynchEventQueue

public AsynchEventQueue()
Constructs a AysnchEventQueue with a capacity of 20 events.


AsynchEventQueue

public AsynchEventQueue(int capacity)
Constructs a AysnchEventQueue with the specified capacity.

Method Detail

getEvent

public AsynchEvent getEvent()
                     throws java.lang.InterruptedException
Description copied from interface: AsynchEventSink
Returns the next event in the sink, waiting forever till one is available.

Specified by:
getEvent in interface AsynchEventSink

getEvent

public AsynchEvent getEvent(long waitTime)
                     throws java.lang.InterruptedException
Description copied from interface: AsynchEventSink
Returns the next event in the sink, waiting for waitTime.

Specified by:
getEvent in interface AsynchEventSink

putEvent

public boolean putEvent(AsynchEvent asynchEvent)
                 throws java.lang.InterruptedException
Description copied from interface: AsynchEventSink
Puts an event into the sink, waiting forever until there is room to place the event..

Specified by:
putEvent in interface AsynchEventSink

putEvent

public boolean putEvent(AsynchEvent asynchEvent,
                        int waitTime)
                 throws java.lang.InterruptedException
Description copied from interface: AsynchEventSink
Puts an event into the sink, waiting up to waitTime until there is room to place the event.

Specified by:
putEvent in interface AsynchEventSink

isFull

public boolean isFull()
Is the queue full ?


isEmpty

public boolean isEmpty()
Is the queue empty ?


getSize

public int getSize()
Returns the number of events in the queue


next

private int next(int index)
Circular counter.