|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IntVector
A resizable array of integers.
length: int |
elements: [0..size) ->one int |
Method Summary | |
---|---|
boolean |
add(int element)
Adds the specified element to the end of this vector (optional operation), and returns true if this vector has changed as a result of the call. |
void |
add(int index,
int element)
Inserts the specified element at the specified position in this vector (optional operation), and returns true if this vector has changed as a result of the call. |
boolean |
addAll(IntCollection c)
Appends the specified elements to the end of this vector (optional operation), and returns true if this vector has changed as a result of the call. |
boolean |
addAll(int index,
IntCollection c)
Inserts the specified elements at the specified position in this vector (optional operation), and returns true if this vector has changed as a result of the call. |
void |
clear()
Removes all of the elements from this vector (optional operation). |
boolean |
contains(int element)
Returns true if this vector contains the specified element. |
boolean |
equals(java.lang.Object o)
Compares the specified object with this vector for equality. |
int |
get(int index)
Returns the element at the specified position in this vector. |
int |
hashCode()
Returns the hash code value for this vector. |
int |
indexOf(int element)
Returns the index in this vector of the first occurrence of the specified element, or -1 if this vector does not contain this element. |
boolean |
isEmpty()
Returns true if this vector contains no elements. |
IntIterator |
iterator()
Returns an iterator over the elements in this vector in proper sequence. |
IntIterator |
iterator(int fromIndex,
int toIndex)
Returns an iterator over the elements in this vector in proper sequence, starting fromIndex<\tt>, inclusive, and ending at toIndex<\tt>, exclusive. |
int |
lastIndexOf(int element)
Returns the index in this vector of the last occurrence of the specified element, or -1 if this vector does not contain this element. |
boolean |
remove(int i)
Removes the first occurrence of the given integer from this vector, and returns true if this vector has changed as a result of the call. |
boolean |
removeAll(IntCollection c)
Removes all of this vector's elements that are also contained in the specified collection. |
int |
removeAt(int index)
Removes the element at the specified position in this vector (optional operation). |
boolean |
retainAll(IntCollection c)
Retains only the elements in this vector that are contained in the specified collection. |
int |
set(int index,
int element)
Replaces the element at the specified position in this vector with the specified element, and returns the previous element (optional operation). |
int |
size()
Returns the number of elements in this vector. |
int[] |
toArray()
Returns an array containing all of the elements in this vector in proper sequence. |
int[] |
toArray(int[] array)
Copies the components of this vector into the specified array, provided that it is large enough, and returns it. |
Methods inherited from interface kodkod.util.ints.IntCollection |
---|
containsAll |
Method Detail |
---|
int size()
size
in interface IntCollection
boolean isEmpty()
isEmpty
in interface IntCollection
boolean contains(int element)
contains
in interface IntCollection
int get(int index)
java.lang.IndexOutOfBoundsException
- if the index is out of range (index
< 0 || index >= length()).IntIterator iterator()
iterator
in interface IntCollection
IntIterator iterator(int fromIndex, int toIndex)
java.lang.IndexOutOfBoundsException
- - fromIndex !in [0..this.length) || toIndex !in [-1..this.length]int set(int index, int element)
java.lang.UnsupportedOperationException
- if the set method is not
supported by this vector.
java.lang.IllegalArgumentException
- if some aspect of the specified
element prevents it from being added to this vector.
java.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index >= length()).this.elements' = this.elements' ++ index -> element |
void clear()
clear
in interface IntCollection
java.lang.UnsupportedOperationException
- if the clear method is
not supported by this vector.this.length' = 0 && no this.elements' |
int indexOf(int element)
int lastIndexOf(int element)
boolean add(int element)
add
in interface IntCollection
java.lang.UnsupportedOperationException
- if the add method is not supported by this vector.
java.lang.IllegalArgumentException
- if some aspect of this element prevents it from being added to this vector.this.length' = this.length + 1 && this.elements' = this.elements + this.length -> element |
void add(int index, int element)
java.lang.UnsupportedOperationException
- if the add method is not
supported by this vector.
java.lang.IllegalArgumentException
- if some aspect of the specified
element prevents it from being added to this vector.
java.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index > length()).this.length' = this.length + 1 &&
this.elements' = { i: [0..this.length'), e: int | i < index => e = this.elements[i],
i = index => e = element, e = this.elements[i-1] } |
boolean addAll(IntCollection c)
addAll
in interface IntCollection
java.lang.UnsupportedOperationException
- if the add method is not
supported by this vector.
java.lang.IllegalArgumentException
- if some aspect of an element in the given vector
prevents it from being added to this vector.appends the specified elements to the end of this vector |
boolean addAll(int index, IntCollection c)
java.lang.UnsupportedOperationException
- if the add method is not
supported by this vector.
java.lang.IllegalArgumentException
- if some aspect of an element in the specified
collection prevents it from being added to this vector.
java.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index > length()).inserts the specified elements at the specified position in this vector |
boolean remove(int i)
remove
in interface IntCollection
java.lang.UnsupportedOperationException
- - this is an unmodifiable collectionremoves the first occurrence of the given integer from this vector |
int removeAt(int index)
java.lang.UnsupportedOperationException
- if the remove method is
not supported by this vector.
java.lang.IndexOutOfBoundsException
- if the index is out of range (index
< 0 || index >= length()).this.length' = this.length - 1 &&
this.elements' = { i: [0..this.length'), e: int | i < index => e = this.elements[i],
e = this.elements[i+1] } |
boolean removeAll(IntCollection c)
removeAll
in interface IntCollection
java.lang.NullPointerException
- - c = null
java.lang.UnsupportedOperationException
- - this is an unmodifiable collectionremoves all of this vector's elements that are also contained in the specified
collection |
boolean retainAll(IntCollection c)
retainAll
in interface IntCollection
java.lang.NullPointerException
- - c = null
java.lang.UnsupportedOperationException
- - this is an unmodifiable collectionretains only the elements in this vector that are contained in the specified
collection |
boolean equals(java.lang.Object o)
equals
in class java.lang.Object
int hashCode()
Ints.superFastHash(int[])
of the elements in the vector,
taken in the ascending order of indices.
This ensures that v1.equals(v2) implies that v1.hashCode()==v2.hashCode()
for any two IntVectors v1 and v2, as required by the general contract of the Object.hashCode method.
hashCode
in class java.lang.Object
int[] toArray()
toArray
in interface IntCollection
int[] toArray(int[] array)
toArray
in interface IntCollection
java.lang.NullPointerException
- - array = nullarray.length>=this.length => all i: [0..this.length) | array'[i] = this.elements[i] |
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |