org.sat4j.core
Class ReadOnlyVecInt

java.lang.Object
  extended by org.sat4j.core.ReadOnlyVecInt
All Implemented Interfaces:
Serializable, IVecInt

public final class ReadOnlyVecInt
extends Object
implements IVecInt

Utility class to allow Read Only access only to an IVecInt.

Author:
daniel
See Also:
Serialized Form

Constructor Summary
ReadOnlyVecInt(IVecInt vec)
           
 
Method Summary
 void clear()
           
 boolean contains(int e)
           
 int containsAt(int e)
          returns the index of the first occurrence of e, else -1.
 int containsAt(int e, int from)
          returns the index of the first occurence of e occurring after from (excluded), else -1.
 void copyTo(int[] is)
           
 void copyTo(IVecInt copy)
          C'est operations devraient se faire en temps constant.
 int delete(int i)
          Delete the ith element of the vector.
 void ensure(int nsize)
           
 int get(int i)
           
 void growTo(int newsize, int pad)
           
 int indexOf(int e)
           
 void insertFirst(int elem)
          Insert an element at the very begining of the vector.
 boolean isEmpty()
          To know if a vector is empty
 IteratorInt iterator()
           
 int last()
           
 void moveTo(int[] dest)
           
 void moveTo(int dest, int source)
          Move elements inside the vector.
 void moveTo(int sourceStartingIndex, int[] dest)
           
 void moveTo(IVecInt dest)
           
 void moveTo2(IVecInt dest)
           
 IVecInt pop()
          depile le dernier element du vecteur.
 IVecInt push(int elem)
           
 void remove(int elem)
          Enleve un element qui se trouve dans le vecteur!!!
 void set(int i, int o)
           
 void shrink(int nofelems)
          Remove the latest nofelems elements from the vector
 void shrinkTo(int newsize)
           
 int size()
           
 void sort()
           
 void sortUnique()
           
 VecInt[] subset(int cardinal)
          Compute all subsets of cardinal k of the vector.
 int[] toArray()
          Allow to access the internal representation of the vector as an array.
 String toString()
           
 int unsafeGet(int eleem)
           
 void unsafePush(int elem)
          Push the element in the Vector without verifying if there is room for it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReadOnlyVecInt

public ReadOnlyVecInt(IVecInt vec)
Method Detail

clear

public void clear()
Specified by:
clear in interface IVecInt

contains

public boolean contains(int e)
Specified by:
contains in interface IVecInt

containsAt

public int containsAt(int e)
Description copied from interface: IVecInt
returns the index of the first occurrence of e, else -1.

Specified by:
containsAt in interface IVecInt
Parameters:
e - an integer
Returns:
the index i such that get(i)==e, else -1.

containsAt

public int containsAt(int e,
                      int from)
Description copied from interface: IVecInt
returns the index of the first occurence of e occurring after from (excluded), else -1.

Specified by:
containsAt in interface IVecInt
Parameters:
e - an integer
from - the index to start from (excluded).
Returns:
the index i such that i>from and get(i)==e, else -1

copyTo

public void copyTo(IVecInt copy)
Description copied from interface: IVecInt
C'est operations devraient se faire en temps constant. Ce n'est pas le cas ici.

Specified by:
copyTo in interface IVecInt

copyTo

public void copyTo(int[] is)
Specified by:
copyTo in interface IVecInt

delete

public int delete(int i)
Description copied from interface: IVecInt
Delete the ith element of the vector. The latest element of the vector replaces the removed element at the ith indexer.

Specified by:
delete in interface IVecInt
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

ensure

public void ensure(int nsize)
Specified by:
ensure in interface IVecInt

get

public int get(int i)
Specified by:
get in interface IVecInt

growTo

public void growTo(int newsize,
                   int pad)
Specified by:
growTo in interface IVecInt

insertFirst

public void insertFirst(int elem)
Description copied from interface: IVecInt
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.

Specified by:
insertFirst in interface IVecInt
Parameters:
elem - the element to put first in the vector.

isEmpty

public boolean isEmpty()
Description copied from interface: IVecInt
To know if a vector is empty

Specified by:
isEmpty in interface IVecInt
Returns:
true iff the vector is empty.

iterator

public IteratorInt iterator()
Specified by:
iterator in interface IVecInt

last

public int last()
Specified by:
last in interface IVecInt

moveTo

public void moveTo(IVecInt dest)
Specified by:
moveTo in interface IVecInt

moveTo

public void moveTo(int[] dest)
Specified by:
moveTo in interface IVecInt

moveTo

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

Specified by:
moveTo in interface IVecInt
Parameters:
dest - the index of the destination
source - the index of the source

moveTo2

public void moveTo2(IVecInt dest)
Specified by:
moveTo2 in interface IVecInt

pop

public IVecInt pop()
Description copied from interface: IVecInt
depile le dernier element du vecteur. Si le vecteur est vide, ne fait rien.

Specified by:
pop in interface IVecInt

push

public IVecInt push(int elem)
Specified by:
push in interface IVecInt

remove

public void remove(int elem)
Description copied from interface: IVecInt
Enleve un element qui se trouve dans le vecteur!!!

Specified by:
remove in interface IVecInt
Parameters:
elem - un element du vecteur

set

public void set(int i,
                int o)
Specified by:
set in interface IVecInt

shrink

public void shrink(int nofelems)
Description copied from interface: IVecInt
Remove the latest nofelems elements from the vector

Specified by:
shrink in interface IVecInt

shrinkTo

public void shrinkTo(int newsize)
Specified by:
shrinkTo in interface IVecInt

size

public int size()
Specified by:
size in interface IVecInt

sort

public void sort()
Specified by:
sort in interface IVecInt

sortUnique

public void sortUnique()
Specified by:
sortUnique in interface IVecInt

unsafeGet

public int unsafeGet(int eleem)
Specified by:
unsafeGet in interface IVecInt

unsafePush

public void unsafePush(int elem)
Description copied from interface: IVecInt
Push the element in the Vector without verifying if there is room for it. USE WITH CAUTION!

Specified by:
unsafePush in interface IVecInt

toArray

public int[] toArray()
Description copied from interface: IVecInt
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

Specified by:
toArray in interface IVecInt
Returns:
the internal representation of the Vector as an array.
Since:
2.1

indexOf

public int indexOf(int e)
Specified by:
indexOf in interface IVecInt
Returns:
Since:
2.2

toString

public String toString()
Overrides:
toString in class Object

moveTo

public void moveTo(int sourceStartingIndex,
                   int[] dest)
Specified by:
moveTo in interface IVecInt

subset

public VecInt[] subset(int cardinal)
Description copied from interface: IVecInt
Compute all subsets of cardinal k of the vector.

Specified by:
subset in interface IVecInt
Parameters:
cardinal - a cardinal (k<= vec.size())
Returns:
an array of IVectInt representing each a k-subset of this vector.
Since:
2.3.1


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