waba.util
Class IntVector

java.lang.Object
  |
  +--waba.util.IntVector

public class IntVector
extends java.lang.Object

A int vector is an array of int's. The vector grows and shrinks dynamically as objects are added and removed.

Here is an example showing a vector being used:

 ...
 IntVector vec = new IntVector();
 vec.add(int1);
 vec.add(int22);
 ...
 vec.insert(3, int3);
 vec.del(2);
 if (vec.getCount() > 5)
 ...
 

for efficiency, get and set is made directly through the public array. please use add and del to insert and remove elements
created by guich from waba.util.Vector.


Field Summary
 int[] items
           
 
Constructor Summary
IntVector()
          Constructs an empty vector.
IntVector(DataStream in)
          Constructs an vector readen from the stream
IntVector(int size)
          Constructs an empty vector with a given initial size.
 
Method Summary
 void add(int obj)
          Adds an object to the end of the vector.
 void del(int index)
          Deletes the object reference at the given index.
 int find(int obj)
          Finds the index of the given object.
 int getCount()
          Returns the number of objects in the vector.
 void insert(int index, int obj)
          Inserts an object at the given index.
 boolean isBitSet(short index)
          used to let this int vector act like a bit vector. returns true if the bit specified is set. you must guarantee that the index exists in the vector. guich@102
 void setBit(short index, boolean on)
          used to let this int vector act like a bit vector. returns true if the bit specified is set. you must guarantee that the index exists in the vector. guich@102
 void writeTo(DataStream out)
          writes this int vector to the stream
 
Methods inherited from class java.lang.Object
hashCode, toString
 

Field Detail

items

public int[] items
Constructor Detail

IntVector

public IntVector()
Constructs an empty vector.

IntVector

public IntVector(DataStream in)
Constructs an vector readen from the stream

IntVector

public IntVector(int size)
Constructs an empty vector with a given initial size. The size is the initial size of the vector's internal object array. The vector will grow as needed when objects are added.
Method Detail

add

public void add(int obj)
Adds an object to the end of the vector.

insert

public void insert(int index,
                   int obj)
Inserts an object at the given index.

del

public void del(int index)
Deletes the object reference at the given index.

find

public int find(int obj)
Finds the index of the given object. The list is searched using a O(n) linear search through all the objects in the vector.

getCount

public int getCount()
Returns the number of objects in the vector.

writeTo

public void writeTo(DataStream out)
writes this int vector to the stream

isBitSet

public boolean isBitSet(short index)
used to let this int vector act like a bit vector. returns true if the bit specified is set. you must guarantee that the index exists in the vector. guich@102

setBit

public void setBit(short index,
                   boolean on)
used to let this int vector act like a bit vector. returns true if the bit specified is set. you must guarantee that the index exists in the vector. guich@102