org.sat4j.specs
Interface IVec<T>

All Superinterfaces:
java.lang.Iterable<T>
All Known Implementing Classes:
Vec

public interface IVec<T>
extends java.lang.Iterable<T>

An abstraction on the type of vector used in the library.

Author:
leberre

Method Summary
 void clear()
           
<E> void
copyTo(E[] dest)
           
 void copyTo(IVec<T> copy)
          Ces operations devraient se faire en temps constant.
 T delete(int i)
          Delete the ith element of the vector.
 void ensure(int nsize)
           
 T get(int i)
           
 void growTo(int newsize, T pad)
           
 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
 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)
          Enleve un element qui se trouve dans le vecteur!!!
 void set(int i, T o)
           
 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> comparator)
           
 T[] toArray()
          Allow to access the internal representation of the vector as an array.
 void unsafePush(T elem)
          To push an element in the vector when you know you have space for it.
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

size

int size()
Returns:
the number of elements contained in the vector

shrink

void shrink(int nofelems)
Remove nofelems from the Vector. It is assumed that the number of elements to remove is smaller or equals to the current number of elements in the vector

Parameters:
nofelems - the number of elements to remove.

shrinkTo

void shrinkTo(int newsize)
reduce the Vector to exactly newsize elements

Parameters:
newsize - the new size of the vector.

pop

void pop()
Pop the last element on the stack. It is assumed that the stack is not empty!


growTo

void growTo(int newsize,
            T pad)

ensure

void ensure(int nsize)

push

IVec<T> push(T elem)

unsafePush

void unsafePush(T elem)
To push an element in the vector when you know you have space for it.

Parameters:
elem -

insertFirst

void insertFirst(T elem)
Insert an element at the very begining of the vector. The former first element is appended to the end of the vector in order to have a constant time operation.

Parameters:
elem - the element to put first in the vector.

insertFirstWithShifting

void insertFirstWithShifting(T elem)

clear

void clear()

last

T last()
return the latest element on the stack. It is assumed that the stack is not empty!

Returns:
the last (top) element on the stack

get

T get(int i)

set

void set(int i,
         T o)

remove

void remove(T elem)
Enleve un element qui se trouve dans le vecteur!!!

Parameters:
elem - un element du vecteur

delete

T delete(int i)
Delete the ith element of the vector. The latest element of the vector replaces the removed element at the ith indexer.

Parameters:
i - the indexer of the element in the vector
Returns:
the former ith element of the vector that is now removed from the vector

copyTo

void copyTo(IVec<T> copy)
Ces operations devraient se faire en temps constant. Ce n'est pas le cas ici.

Parameters:
copy -

copyTo

<E> void copyTo(E[] dest)

toArray

T[] toArray()
Allow to access the internal representation of the vector as an array. Note that only the content of index 0 to size() should be taken into account. USE WITH CAUTION

Returns:
the internal represnetation of the Vector as an array.

moveTo

void moveTo(IVec<T> dest)
Move the content of the vector into dest. Note that the vector become empty. The content of the vector is appended to dest.

Parameters:
dest - the vector where top put the content of this vector

moveTo

void moveTo(int dest,
            int source)
Move elements inside the vector. The content of the method is equivalent to: vec[dest] = vec[source]

Parameters:
dest - the index of the destination
source - the index of the source

sort

void sort(java.util.Comparator<T> comparator)

sortUnique

void sortUnique(java.util.Comparator<T> comparator)

isEmpty

boolean isEmpty()
To know if a vector is empty

Returns:
true iff the vector is empty.
Since:
1.6


Copyright © 2007 Centre de Recherche en Informatique de Lens (CRIL). All Rights Reserved.