udt.util
Class CircularArray<T>

java.lang.Object
  extended by udt.util.CircularArray<T>
Direct Known Subclasses:
AckHistoryWindow, PacketHistoryWindow, PacketPairWindow

public class CircularArray<T>
extends Object

Circular array: the most recent value overwrites the oldest one if there is no more free space in the array


Field Summary
protected  List<T> circularArray
           
protected  boolean haveOverflow
           
protected  int max
           
protected  int position
           
 
Constructor Summary
CircularArray(int size)
          Create a new circularArray of the given size
 
Method Summary
 void add(T entry)
          add an entry
 int size()
          Returns the number of elements in this list
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

position

protected int position

haveOverflow

protected boolean haveOverflow

max

protected final int max

circularArray

protected final List<T> circularArray
Constructor Detail

CircularArray

public CircularArray(int size)
Create a new circularArray of the given size

Parameters:
size -
Method Detail

add

public void add(T entry)
add an entry


size

public int size()
Returns the number of elements in this list


toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013 LittleShoot. All Rights Reserved.