|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.limegroup.gnutella.util.Buffer
A very simple fixed-size double-ended queue, i.e., a circular buffer. The fixed size is intentional, not the result of laziness; use this data structure when you want to use a fix amount of resources. This is not thread-safe.
Constructor Summary | |
Buffer(Buffer other)
"Copy constructor": constructs a new shallow copy of other. |
|
Buffer(int size)
|
Method Summary | |
java.lang.Object |
add(java.lang.Object x)
Same as addFirst(x). |
java.lang.Object |
addFirst(java.lang.Object x)
|
java.lang.Object |
addLast(java.lang.Object x)
|
void |
clear()
|
java.lang.Object |
clone()
Returns a shallow copy of this, of type Buffer |
boolean |
contains(java.lang.Object x)
Returns true if the input object x is in the buffer. |
java.lang.Object |
first()
Returns the head of this, or throws NoSuchElementException if this is empty. |
java.lang.Object |
get(int i)
If i<0 or i>=getSize(), throws IndexOutOfBoundsException. |
int |
getCapacity()
Returns the number of elements that this can hold, i.e., the max size that was passed to the constructor. |
int |
getSize()
Returns the number of elements in this. |
boolean |
isEmpty()
Returns true iff this is empty. |
boolean |
isFull()
Returns true iff this is full, e.g., adding another element would force another out. |
java.util.Iterator |
iterator()
|
java.lang.Object |
last()
Returns the tail of this, or throws NoSuchElementException if this is empty. |
java.lang.Object |
remove(int i)
|
boolean |
remove(java.lang.Object x)
|
boolean |
removeAll(java.lang.Object x)
|
java.lang.Object |
removeFirst()
|
java.lang.Object |
removeLast()
|
void |
set(int i,
java.lang.Object o)
|
int |
size()
Same as getSize(). |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Buffer(int size)
public Buffer(Buffer other)
Method Detail |
public boolean isEmpty()
public boolean isFull()
public final int size()
public int getSize()
public int getCapacity()
public java.lang.Object get(int i) throws java.lang.IndexOutOfBoundsException
java.lang.IndexOutOfBoundsException
public void set(int i, java.lang.Object o) throws java.lang.IndexOutOfBoundsException
java.lang.IndexOutOfBoundsException
public java.lang.Object add(java.lang.Object x)
public java.lang.Object addFirst(java.lang.Object x)
public java.lang.Object addLast(java.lang.Object x)
public boolean contains(java.lang.Object x)
public java.lang.Object first() throws java.util.NoSuchElementException
java.util.NoSuchElementException
public java.lang.Object last() throws java.util.NoSuchElementException
java.util.NoSuchElementException
public java.lang.Object removeFirst() throws java.util.NoSuchElementException
java.util.NoSuchElementException
public java.lang.Object removeLast() throws java.util.NoSuchElementException
java.util.NoSuchElementException
public java.lang.Object remove(int i) throws java.lang.IndexOutOfBoundsException
java.lang.IndexOutOfBoundsException
public boolean remove(java.lang.Object x)
public boolean removeAll(java.lang.Object x)
public void clear()
public java.util.Iterator iterator()
public java.lang.Object clone()
public java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |