simnet
Class Socket.FixedSizeQueue

java.lang.Object
  extended bysimnet.Socket.FixedSizeQueue
Enclosing class:
Socket

private class Socket.FixedSizeQueue
extends java.lang.Object

A class that keeps a queue of objects, with a limited number of bytes to store them in.


Field Summary
protected  java.util.LinkedList queue
           
protected  int size
           
protected  int used
           
 
Constructor Summary
Socket.FixedSizeQueue(int s)
          Create a fixed size queue with the specified capacity (<=0 is infinite capacity).
 
Method Summary
 boolean in(java.lang.Object data)
          Add the specified object to the queue, returns if there is sufficient space.
 boolean isEmpty()
          Returns if the queue is empty.
 java.lang.Object out()
          Returns the next object from the queue and removes it, or null if the queue is empty.
 java.lang.Object peek()
          Returns the first object in the queue (without removing it), or null if the queue is empty.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

size

protected int size

used

protected int used

queue

protected java.util.LinkedList queue
Constructor Detail

Socket.FixedSizeQueue

public Socket.FixedSizeQueue(int s)
Create a fixed size queue with the specified capacity (<=0 is infinite capacity).

Method Detail

in

public boolean in(java.lang.Object data)
Add the specified object to the queue, returns if there is sufficient space.


out

public java.lang.Object out()
Returns the next object from the queue and removes it, or null if the queue is empty.


peek

public java.lang.Object peek()
Returns the first object in the queue (without removing it), or null if the queue is empty.


isEmpty

public boolean isEmpty()
Returns if the queue is empty.