MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich

ch.ethz.mxquery.util
Class IntegerList

java.lang.Object
  extended by ch.ethz.mxquery.util.IntegerList

public class IntegerList
extends java.lang.Object


Constructor Summary
IntegerList()
           
IntegerList(int capacity)
           
 
Method Summary
 boolean add(int e)
          Appends the supplied element to the end of this list.
 void add(int index, int e)
          Adds the supplied element at the specified index, shifting all elements currently at that index or higher one to the right.
 void addAll(int[] all)
           
 void addAll(IntegerList all)
           
 void clear()
          Removes all elements from this List
 boolean contains(int e)
          Returns true iff element is in this ArrayList.
 IntegerList copy()
          Creates a shallow copy of this ArrayList (elements are not cloned).
 void ensureCapacity(int minCapacity)
          Guarantees a minimum size
 int get(int index)
          Retrieves the element at the user-supplied index.
 int indexOf(int e)
          Returns the lowest index at which element appears in this List, or -1 if it does not appear.
 boolean isEmpty()
          Checks if the list is empty.
 int lastIndexOf(int e)
          Returns the highest index at which element appears in this List, or -1 if it does not appear.
 int remove(int index)
          Removes the element at the user-supplied index.
 void remove(IntegerList e)
          Removes the item positions in integerList from this list
 void removeRange(int fromIndex, int toIndex)
          Removes all elements in the half-open interval [fromIndex, toIndex).
 void removeValue(int value)
           
 int set(int index, int e)
           
 int size()
          Returns the number of elements in this list.
 int[] toArray()
          Returns an Object array containing all of the elements in this ArrayList.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntegerList

public IntegerList(int capacity)

IntegerList

public IntegerList()
Method Detail

ensureCapacity

public void ensureCapacity(int minCapacity)
Guarantees a minimum size


size

public int size()
Returns the number of elements in this list.

Returns:
the list size

isEmpty

public boolean isEmpty()
Checks if the list is empty.

Returns:
true if there are no elements

contains

public boolean contains(int e)
Returns true iff element is in this ArrayList.

Parameters:
e - the element whose inclusion in the List is being tested
Returns:
true if the list contains e

indexOf

public int indexOf(int e)
Returns the lowest index at which element appears in this List, or -1 if it does not appear.

Parameters:
e - the element whose inclusion in the List is being tested
Returns:
the index where e was found

lastIndexOf

public int lastIndexOf(int e)
Returns the highest index at which element appears in this List, or -1 if it does not appear.

Parameters:
e - the element whose inclusion in the List is being tested
Returns:
the index where e was found

copy

public IntegerList copy()
Creates a shallow copy of this ArrayList (elements are not cloned).

Returns:
the cloned object

toArray

public int[] toArray()
Returns an Object array containing all of the elements in this ArrayList. The array is independent of this list.

Returns:
an array representation of this list

addAll

public void addAll(int[] all)

addAll

public void addAll(IntegerList all)

get

public int get(int index)
Retrieves the element at the user-supplied index.

Parameters:
index - the index of the element we are fetching
Throws:
java.lang.IndexOutOfBoundsException - if index < 0 || index >= size()

set

public int set(int index,
               int e)

remove

public void remove(IntegerList e)
Removes the item positions in integerList from this list

Parameters:
e -

add

public boolean add(int e)
Appends the supplied element to the end of this list. The element, e, can be an object of any type or null.

Parameters:
e - the element to be appended to this list
Returns:
true, the add will always succeed

add

public void add(int index,
                int e)
Adds the supplied element at the specified index, shifting all elements currently at that index or higher one to the right. The element, e, can be an object of any type or null.

Parameters:
index - the index at which the element is being added
e - the item being added
Throws:
java.lang.IndexOutOfBoundsException - if index < 0 || index > size()

remove

public int remove(int index)
Removes the element at the user-supplied index.

Parameters:
index - the index of the element to be removed
Returns:
the removed Object
Throws:
java.lang.IndexOutOfBoundsException - if index < 0 || index >= size()

clear

public void clear()
Removes all elements from this List


removeRange

public void removeRange(int fromIndex,
                        int toIndex)
Removes all elements in the half-open interval [fromIndex, toIndex). Does nothing when toIndex is equal to fromIndex.

Parameters:
fromIndex - the first index which will be removed
toIndex - one greater than the last index which will be removed
Throws:
java.lang.IndexOutOfBoundsException - if fromIndex > toIndex

removeValue

public void removeValue(int value)

MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich

MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich