2010 FRC Java API


com.sun.squawk.util
Class IntSet

java.lang.Object
  extended by com.sun.squawk.util.IntSet

public final class IntSet
extends Object

The IntSet class is an unsynchronized set of integers. The main operations are add, remove, size, and getInts.


Field Summary
protected  int elementCount
          The number of valid components in the vector.
protected  int[] elementData
          The array buffer into which the components of the vector are stored.
 
Constructor Summary
IntSet()
          Constructs an empty vector.
IntSet(int initialCapacity)
          Constructs an empty vector with the specified initial capacity and capacity increment.
 
Method Summary
 void add(int val)
          Adds the specified int to this set,, increasing its size by one.
 boolean contains(int elem)
          Tests if the specified object is a component in this vector.
 int[] getElements()
          Returns the underlying int array.
 boolean remove(int val)
          Removes the first occurrence of the argument from this set.
 void removeAll()
          Removes all components from this vector and sets its size to zero.
 int size()
          Returns the number of components in this set.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

elementCount

protected int elementCount
The number of valid components in the vector.


elementData

protected int[] elementData
The array buffer into which the components of the vector are stored. The capacity of the vector is the length of this array buffer.

Constructor Detail

IntSet

public IntSet()
Constructs an empty vector.


IntSet

public IntSet(int initialCapacity)
Constructs an empty vector with the specified initial capacity and capacity increment.

Parameters:
initialCapacity - the initial capacity of the vector.
Throws:
IllegalArgumentException - if the specified initial capacity is negative
Method Detail

add

public void add(int val)
Adds the specified int to this set,, increasing its size by one.

Parameters:
val - the component to be added.

contains

public final boolean contains(int elem)
Tests if the specified object is a component in this vector.

Parameters:
elem - an object.
Returns:
true if the specified object is a component in this vector; false otherwise.

getElements

public int[] getElements()
Returns the underlying int array. Only iterate over first size() elements.

Returns:
underlying int array

remove

public boolean remove(int val)
Removes the first occurrence of the argument from this set.

Parameters:
val - the component to be removed.
Returns:
true if the argument was a component of this set; false otherwise.

removeAll

public void removeAll()
Removes all components from this vector and sets its size to zero.


size

public final int size()
Returns the number of components in this set.

Returns:
the number of components in this set.

2010 FRC Java API


Copyright © 2006-2009 Sun Microsystems, Inc. All Rights Reserved.