Modifier and Type | Field and Description |
---|---|
int[] |
array |
int |
numElem |
MemoryPool |
pool |
Constructor and Description |
---|
IntVec(MemoryPool pool)
initializes the array with a memory pool
|
IntVec(MemoryPool pool,
Iterable<Integer> clause)
initialize from pool and some integers
|
Modifier and Type | Method and Description |
---|---|
void |
add(int i)
add an element at the end of the array
|
void |
clear()
clears all elements in the array
|
int |
get(int index) |
boolean |
isEmpty()
checks if the array contains elements
|
Iterator<Integer> |
iterator() |
void |
remove(int index)
remove the element at index index
|
void |
removeFast(int index)
this removes the element at given index.
|
void |
set(int index,
int i)
set the element at index index to i
|
int |
size()
number of elements
|
int[] |
toArray()
get a new array from the clause
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public int[] array
public int numElem
public MemoryPool pool
public IntVec(MemoryPool pool)
pool
- the pool to use for memory allocationpublic IntVec(MemoryPool pool, Iterable<Integer> clause)
pool
- the pool to useclause
- the elements to addpublic void add(int i)
i
- the element to addpublic void clear()
public boolean isEmpty()
public int get(int index)
public void set(int index, int i)
index
- the index to modifyi
- the new valuepublic int size()
public void remove(int index)
index
- the index of the element to removepublic void removeFast(int index)
index
- the index to removepublic int[] toArray()
Copyright © 2022. All rights reserved.