com.sun.kjava
Class IntVector

java.lang.Object
  |
  +--com.sun.kjava.IntVector

public class IntVector
extends java.lang.Object

A simple expandable vector of integers, similar to java.util.Vector.


Constructor Summary
IntVector()
          Create a new IntVector, and make it small to start.
IntVector(int initSize)
          Create a new IntVector.
 
Method Summary
 void append(int i)
          Append an integer to the end, expanding the vector if necessary.
 int capacity()
          What is the total capacity of this IntVector?
 void ensureCapacity(int newCap)
          Ensure there's room for some number of entries by any means necessary.
 void removeAllElements()
          Mark the vector as containing no integers.
 int size()
          What is the size of this IntVector?
 int valueAt(int i)
          What is the value at a given index? N.B.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntVector

public IntVector()
Create a new IntVector, and make it small to start.

IntVector

public IntVector(int initSize)
Create a new IntVector.
Parameters:
initSize - the number of initial elements to allocate
Method Detail

valueAt

public int valueAt(int i)
What is the value at a given index? N.B. This does no bounds checking.
Parameters:
i - the index of the entry
Returns:
the integer at that index.

size

public int size()
What is the size of this IntVector?
Returns:
the number of integers stored

append

public void append(int i)
Append an integer to the end, expanding the vector if necessary.
Parameters:
i - the value of the new datum

removeAllElements

public void removeAllElements()
Mark the vector as containing no integers.

capacity

public int capacity()
What is the total capacity of this IntVector?
Returns:
the number of entries currently allocated space, not all of which may be occupied.
See Also:
size()

ensureCapacity

public void ensureCapacity(int newCap)
Ensure there's room for some number of entries by any means necessary.
Parameters:
newCap - the desired new capacity