Package org.jacop.jasat.utils.structures
Class IntQueue
- java.lang.Object
-
- org.jacop.jasat.utils.structures.IntQueue
-
- All Implemented Interfaces:
java.lang.Iterable<java.lang.Integer>
public final class IntQueue extends java.lang.Object implements java.lang.Iterable<java.lang.Integer>Special class for unboxed int FIFO- Version:
- 4.8
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classIntQueue.QueueIterator
-
Field Summary
Fields Modifier and Type Field Description int[]arrayMemoryPoolpoolintstartintstop
-
Constructor Summary
Constructors Constructor Description IntQueue(MemoryPool pool)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int element)adds an int at the end of the FIFOvoidclear()booleanisEmpty()java.util.Iterator<java.lang.Integer>iterator()intpeek()inspection of the first element, without removalintpop()takes the first element, removes it from the FIFO and returns itprivate voidresize()increase the size of the queueintsize()java.lang.StringtoString()
-
-
-
Field Detail
-
array
public int[] array
-
start
public int start
-
stop
public int stop
-
pool
public MemoryPool pool
-
-
Constructor Detail
-
IntQueue
public IntQueue(MemoryPool pool)
-
-
Method Detail
-
clear
public void clear()
-
isEmpty
public boolean isEmpty()
-
add
public void add(int element)
adds an int at the end of the FIFO- Parameters:
element- the element to add
-
peek
public int peek()
inspection of the first element, without removal- Returns:
- the first element of the array
-
pop
public int pop()
takes the first element, removes it from the FIFO and returns it- Returns:
- the first element from the FIFO queue
-
size
public int size()
-
resize
private void resize()
increase the size of the queue
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
iterator
public java.util.Iterator<java.lang.Integer> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<java.lang.Integer>
-
-