chord.util
Class IntArraySet

java.lang.Object
  extended by chord.util.IntArraySet

public class IntArraySet
extends java.lang.Object

A resizable, array-backed list of int primitives. Created: Sat Dec 29 14:21:12 2001

Author:
Eric D. Friedman, Rob Eden

Field Summary
protected  int[] _data
          the data of the set
protected  int _pos
          the index after the last entry in the set
protected static int DEFAULT_CAPACITY
          the default capacity for new sets
 
Constructor Summary
IntArraySet()
           
IntArraySet(int capacity)
           
IntArraySet(IntArraySet that)
           
 
Method Summary
 boolean add(int val)
          Adds val to the end of the list, growing as needed.
 boolean addAll(IntArraySet that)
           
 void addForcibly(int val)
           
 void clear()
           
 boolean contains(int value)
          Searches the set for value
 boolean equals(java.lang.Object o)
           
 int get(int idx)
           
 void grow()
          Double the capacity of the internal array.
 int hashCode()
           
 boolean isEmpty()
          Tests whether this list contains any values.
 boolean overlaps(IntArraySet c)
           
 void setReadOnly()
           
 int size()
          Returns the number of values in the list.
 boolean subset(IntArraySet that)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_data

protected int[] _data
the data of the set


_pos

protected int _pos
the index after the last entry in the set


DEFAULT_CAPACITY

protected static final int DEFAULT_CAPACITY
the default capacity for new sets

See Also:
Constant Field Values
Constructor Detail

IntArraySet

public IntArraySet()

IntArraySet

public IntArraySet(int capacity)

IntArraySet

public IntArraySet(IntArraySet that)
Method Detail

setReadOnly

public void setReadOnly()

grow

public void grow()
Double the capacity of the internal array. Must be called only when _pos == _data.length


size

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

Returns:
the number of values in the list.

isEmpty

public boolean isEmpty()
Tests whether this list contains any values.

Returns:
true if the list is empty.

contains

public boolean contains(int value)
Searches the set for value

Parameters:
value - an int value

get

public int get(int idx)

clear

public void clear()

add

public boolean add(int val)
Adds val to the end of the list, growing as needed.

Parameters:
val - an int value

addForcibly

public void addForcibly(int val)

addAll

public boolean addAll(IntArraySet that)

overlaps

public boolean overlaps(IntArraySet c)

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

subset

public boolean subset(IntArraySet that)