|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.sat4j.core.Vec<T>
public final class Vec<T>
Simple but efficient vector implementation, based on the vector implementation available in MiniSAT. Note that the elements are compared using their references, not using the equals method.
Constructor Summary | |
---|---|
Vec()
Create a Vector with an initial capacity of 5 elements. |
|
Vec(int size)
Create a Vector with a given capacity. |
|
Vec(int size,
T pad)
Construit un vecteur contenant de taille size rempli a l'aide de size pad. |
|
Vec(T[] elts)
Adapter method to translate an array of int into an IVec. |
Method Summary | ||
---|---|---|
void |
clear()
|
|
boolean |
contains(T e)
|
|
|
copyTo(E[] dest)
|
|
void |
copyTo(IVec<T> copy)
Ces operations devraient se faire en temps constant. |
|
T |
delete(int index)
Delete the ith element of the vector. |
|
void |
ensure(int nsize)
|
|
boolean |
equals(Object obj)
|
|
T |
get(int index)
|
|
void |
growTo(int newsize,
T pad)
|
|
int |
hashCode()
|
|
int |
indexOf(T element)
|
|
void |
insertFirst(T elem)
Insert an element at the very beginning of the vector. |
|
void |
insertFirstWithShifting(T elem)
|
|
boolean |
isEmpty()
To know if a vector is empty |
|
Iterator<T> |
iterator()
|
|
T |
last()
return the latest element on the stack. |
|
void |
moveTo(int dest,
int source)
Move elements inside the vector. |
|
void |
moveTo(IVec<T> dest)
Move the content of the vector into dest. |
|
void |
pop()
Pop the last element on the stack. |
|
IVec<T> |
push(T elem)
|
|
void |
remove(T elem)
Remove an element that belongs to the Vector. |
|
void |
set(int index,
T elem)
|
|
void |
shrink(int nofelems)
Remove nofelems from the Vector. |
|
void |
shrinkTo(int newsize)
reduce the Vector to exactly newsize elements |
|
int |
size()
|
|
void |
sort(Comparator<T> comparator)
|
|
void |
sortUnique(Comparator<T> cmp)
|
|
T[] |
toArray()
Allow to access the internal representation of the vector as an array. |
|
String |
toString()
|
|
void |
unsafePush(T elem)
To push an element in the vector when you know you have space for it. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Vec()
public Vec(T[] elts)
elts
- a filled array of T.public Vec(int size)
size
- the capacity of the vector.public Vec(int size, T pad)
size
- la taille du vecteurpad
- l'objet servant a remplir le vecteurMethod Detail |
---|
public int size()
size
in interface IVec<T>
public void shrink(int nofelems)
shrink
in interface IVec<T>
nofelems
- the number of elements to remove.public void shrinkTo(int newsize)
shrinkTo
in interface IVec<T>
newsize
- the new size of the vector.public void pop()
pop
in interface IVec<T>
public void growTo(int newsize, T pad)
growTo
in interface IVec<T>
public void ensure(int nsize)
ensure
in interface IVec<T>
public IVec<T> push(T elem)
push
in interface IVec<T>
public void unsafePush(T elem)
IVec
unsafePush
in interface IVec<T>
public void insertFirst(T elem)
insertFirst
in interface IVec<T>
elem
- the element to put first in the vector.public void insertFirstWithShifting(T elem)
insertFirstWithShifting
in interface IVec<T>
public void clear()
clear
in interface IVec<T>
public T last()
last
in interface IVec<T>
public T get(int index)
get
in interface IVec<T>
public void set(int index, T elem)
set
in interface IVec<T>
public void remove(T elem)
remove
in interface IVec<T>
elem
- an element from the vector.public T delete(int index)
delete
in interface IVec<T>
index
- the indexer of the element in the vector
public void copyTo(IVec<T> copy)
copyTo
in interface IVec<T>
copy
- public <E> void copyTo(E[] dest)
copyTo
in interface IVec<T>
dest
- public void moveTo(IVec<T> dest)
IVec
moveTo
in interface IVec<T>
dest
- the vector where top put the content of this vectorpublic void moveTo(int dest, int source)
IVec
vec[dest] = vec[source]
moveTo
in interface IVec<T>
dest
- the index of the destinationsource
- the index of the sourcepublic T[] toArray()
IVec
toArray
in interface IVec<T>
public String toString()
toString
in class Object
public void sort(Comparator<T> comparator)
sort
in interface IVec<T>
comparator
- public void sortUnique(Comparator<T> cmp)
sortUnique
in interface IVec<T>
public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
public Iterator<T> iterator()
iterator
in interface IVec<T>
public boolean isEmpty()
IVec
isEmpty
in interface IVec<T>
public boolean contains(T e)
contains
in interface IVec<T>
e
- an object
public int indexOf(T element)
indexOf
in interface IVec<T>
element
- an object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |