public class FIFOQueue
extends java.lang.Object
implements java.lang.Cloneable
Green (liuj) |
Green (eal) |
Modifier and Type | Field and Description |
---|---|
static int |
INFINITE_CAPACITY
Used to indicate that the size of the queue or the history
queue is infinite.
|
Constructor and Description |
---|
FIFOQueue()
Construct an empty queue with no container.
|
FIFOQueue(FIFOQueue model)
Copy constructor.
|
FIFOQueue(Nameable container)
Construct an empty queue with the specified container.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Remove all items currently stored in the queue and
clear the history queue.
|
java.lang.Object |
clone()
Clone this queue.
|
java.util.List |
elementList()
List the objects in the queue, beginning with the oldest.
|
java.util.Enumeration |
elements()
Deprecated.
Used elementList() instead.
|
java.lang.Object |
get(int offset)
Return an object in the queue or history.
|
int |
getCapacity()
Return the queue capacity, or INFINITE_CAPACITY if it is unbounded.
|
Nameable |
getContainer()
Return the container of the queue, or null if there is none.
|
int |
getHistoryCapacity()
Return the capacity of the history queue.
|
java.util.List |
historyElementList()
List the objects in the history, which are the N most recent
objects taken from the queue, beginning with the oldest, where
N is less than or equal to the history capacity.
|
java.util.Enumeration |
historyElements()
Deprecated.
Use historyElementList() instead.
|
int |
historySize()
Return the number of objects in the history.
|
boolean |
isFull()
Return true if the number of objects in the queue equals the
queue capacity.
|
boolean |
put(java.lang.Object element)
Put an object in the queue and return true if this will not
cause the capacity to be exceeded.
|
void |
setCapacity(int capacity)
Set queue capacity.
|
void |
setContainer(Nameable container)
Set the container of the queue.
|
void |
setHistoryCapacity(int capacity)
Set the capacity of the history queue.
|
int |
size()
Return the number of objects in the queue.
|
java.lang.Object |
take()
Remove the oldest object from the queue and return it.
|
public static final int INFINITE_CAPACITY
public FIFOQueue()
public FIFOQueue(Nameable container)
container
- The container of the queue.public FIFOQueue(FIFOQueue model)
model
- The queue to be copied.public void clear()
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
- If thrown by object.clone().Fpublic java.util.List elementList()
@Deprecated public java.util.Enumeration elements()
public java.lang.Object get(int offset) throws java.util.NoSuchElementException
offset
- The position of the desired object.java.util.NoSuchElementException
- If the offset is out of range.public int getCapacity()
setCapacity(int)
public Nameable getContainer()
setContainer(ptolemy.kernel.util.Nameable)
public int getHistoryCapacity()
setHistoryCapacity(int)
public java.util.List historyElementList()
@Deprecated public java.util.Enumeration historyElements()
public int historySize()
public boolean isFull()
public boolean put(java.lang.Object element)
element
- An object to be put in the queue.public void setCapacity(int capacity) throws IllegalActionException
capacity
- The desired capacity.IllegalActionException
- If the queue contains more
objects than the proposed capacity or the proposed capacity
is illegal.getCapacity()
public void setContainer(Nameable container)
container
- The container of this queue.getContainer()
public void setHistoryCapacity(int capacity) throws IllegalActionException
capacity
- The desired capacity of the history queue.IllegalActionException
- If the desired capacity
is illegal.getHistoryCapacity()
public int size()
public java.lang.Object take() throws java.util.NoSuchElementException
java.util.NoSuchElementException
- If the queue is empty.