public final class VecInt extends Object implements IVecInt
Constructor and Description |
---|
VecInt() |
VecInt(int size) |
VecInt(int[] lits)
Adapter method to translate an array of int into an IVecInt.
|
VecInt(int size,
int pad)
Build a vector of a given initial size filled with an integer.
|
Modifier and Type | Method and Description |
---|---|
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)
Copy the content of this vector into an array of integer.
|
void |
copyTo(IVecInt copy)
Copy the content of this vector into another one.
|
int |
delete(int i)
Delete the ith element of the vector.
|
void |
ensure(int nsize) |
boolean |
equals(Object obj)
Two vectors are equals iff they have the very same elements in the order.
|
int |
get(int i) |
void |
growTo(int newsize,
int pad) |
int |
hashCode() |
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
|
boolean |
isSubsetOf(VecInt vec)
to detect that the vector is a subset of another one.
|
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 |
pushAll(IVecInt vec) |
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()
sort the vector using a custom quicksort.
|
void |
sortUnique() |
IVecInt[] |
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 i) |
void |
unsafePush(int elem)
Push the element in the Vector without verifying if there is room for it.
|
public static final IVecInt EMPTY
public VecInt()
public VecInt(int size)
public VecInt(int[] lits)
lits
- a filled array of int.public VecInt(int size, int pad)
size
- the initial size of the vectorpad
- the integer to fill the vector withpublic void shrink(int nofelems)
public IVecInt pop()
public void unsafePush(int elem)
IVecInt
unsafePush
in interface IVecInt
public int containsAt(int e)
IVecInt
containsAt
in interface IVecInt
e
- an integerpublic int containsAt(int e, int from)
IVecInt
containsAt
in interface IVecInt
e
- an integerfrom
- the index to start from (excluded).public void copyTo(IVecInt copy)
public void copyTo(int[] is)
public void moveTo(int dest, int source)
IVecInt
vec[dest] = vec[source]
public void moveTo(int sourceStartingIndex, int[] dest)
public void insertFirst(int elem)
insertFirst
in interface IVecInt
elem
- the element to put first in the vector.public void remove(int elem)
public int delete(int i)
public void sort()
public void sortUnique()
sortUnique
in interface IVecInt
public boolean equals(Object obj)
equals
in class Object
obj
- an objectObject.equals(java.lang.Object)
public void pushAll(IVecInt vec)
public boolean isSubsetOf(VecInt vec)
vec
- a vectorpublic IteratorInt iterator()
public boolean isEmpty()
IVecInt
public int[] toArray()
IVecInt
Copyright © 2013 Centre de Recherche en Informatique de Lens (CRIL). All Rights Reserved.