| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sat4j.core.Vec<T>
public 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()
 | 
|
 | 
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(java.lang.Object obj)
 | 
|
 T | 
get(int index)
 | 
|
 void | 
growTo(int newsize,
       T pad)
 | 
|
 int | 
hashCode()
 | 
|
 void | 
insertFirst(T elem)
Insert an element at the very begining of the vector.  | 
|
 void | 
insertFirstWithShifting(T elem)
 | 
|
 boolean | 
isEmpty()
To know if a vector is empty  | 
|
 java.util.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(java.util.Comparator<T> comparator)
 | 
|
 void | 
sortUnique(java.util.Comparator<T> cmp)
 | 
|
 T[] | 
toArray()
Allow to access the internal representation of the vector as an array.  | 
|
 java.lang.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 | 
|---|
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 vecteur| Method 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 final 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 vector
public void moveTo(int dest,
                   int source)
IVecvec[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 java.lang.String toString()
toString in class java.lang.Objectpublic void sort(java.util.Comparator<T> comparator)
sort in interface IVec<T>comparator - public void sortUnique(java.util.Comparator<T> cmp)
sortUnique in interface IVec<T>public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.util.Iterator<T> iterator()
iterator in interface java.lang.Iterable<T>public boolean isEmpty()
IVec
isEmpty in interface IVec<T>
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||