|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectchoco.kernel.common.util.disposable.Disposable
choco.kernel.common.util.iterators.DisposableIntIterator
choco.kernel.common.util.objects.DoubleLinkedList
public class DoubleLinkedList
A double linked list with constant time access, addition and deletion in o(1) The list is encoded by two tables of integers. Efficient implementation regarding time but very poor for memory.
Field Summary | |
---|---|
protected int |
currentT
util for iteration |
protected int |
listSize
maximum size of the list |
protected int[] |
nextT
Successors table |
protected int[] |
prevT
Predecessors table |
protected int |
size
Current number of elements |
Constructor Summary | |
---|---|
DoubleLinkedList(DoubleLinkedList origin)
Constructor (copy) |
|
DoubleLinkedList(int listSize)
build a list of maximum size "listSize" |
Method Summary | |
---|---|
void |
addVal(int val)
Add an element "val" |
boolean |
contains(int val)
|
void |
dispose()
This method allows to declare that an object is not used anymore. |
int |
getFirst()
|
int |
getLast()
|
int |
getSize()
Get current number of element |
boolean |
hasNext()
|
boolean |
hasNextTo(int val)
|
boolean |
isIn(int val)
|
int |
next()
return the next element |
int |
read()
return the current iterated element |
void |
remove()
remove the current iterated element |
void |
removeVal(int val)
Remove an element "val" |
void |
reset()
reset |
void |
restart()
Initialize the iterator |
void |
restartFrom(int val)
Set the iterator from val |
void |
restrict(int val)
Restrict the domain to the element val |
int[] |
toArray()
|
String |
toString()
|
Methods inherited from class choco.kernel.common.util.disposable.Disposable |
---|
init, reusable |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final int[] nextT
protected final int[] prevT
protected int size
protected int currentT
protected final int listSize
Constructor Detail |
---|
public DoubleLinkedList(int listSize)
listSize
- public DoubleLinkedList(DoubleLinkedList origin)
Method Detail |
---|
public void addVal(int val)
public void removeVal(int val)
public final boolean contains(int val)
public final int getSize()
public void reset()
public final void restart()
public final void restartFrom(int val)
val
- public boolean hasNext()
public boolean hasNextTo(int val)
public int next()
public int read()
public final int getFirst()
public final int getLast()
public final boolean isIn(int val)
public final void restrict(int val)
val
- public final int[] toArray()
public void remove()
remove
in class DisposableIntIterator
public String toString()
toString
in class Object
public void dispose()
Disposable
dispose
in class Disposable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |