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 class
IntQueue.QueueIterator
-
Field Summary
Fields Modifier and Type Field Description int[]
array
MemoryPool
pool
int
start
int
stop
-
Constructor Summary
Constructors Constructor Description IntQueue(MemoryPool pool)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int element)
adds an int at the end of the FIFOvoid
clear()
boolean
isEmpty()
java.util.Iterator<java.lang.Integer>
iterator()
int
peek()
inspection of the first element, without removalint
pop()
takes the first element, removes it from the FIFO and returns itprivate void
resize()
increase the size of the queueint
size()
java.lang.String
toString()
-
-
-
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:
toString
in classjava.lang.Object
-
iterator
public java.util.Iterator<java.lang.Integer> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<java.lang.Integer>
-
-