Class JavaVector

java.lang.Object
  |
  +--JavaVector
All Implemented Interfaces:
IVector

public class JavaVector
extends Object
implements IVector

Java Vector IVector implementation.


Field Summary
protected  Vector elements
          Java Vector used to store the elements of this.
 
Constructor Summary
JavaVector()
          Constructs a new Java vector.
 
Method Summary
 void add(Object anObject)
          Adds the given object to the end of this, increasing the size of this by 1.
 Object elementAtRank(int aRank)
          Returns the object at the given rank.
 void insertAtRank(int aRank, Object anObject)
          Inserts the given object into this at the given rank, increasing the size of this by 1.
 boolean isEmpty()
          Returns whether or not this is empty.
 Object removeAtRank(int aRank)
          Removes and returns the object at the given rank, reducing the size of this by 1.
 Object replaceElement(int aRank, Object anObject)
          Sets this to store the given object at the given rank, and returns the object that was replaced at that rank.
 int size()
          Returns the number of elements in this.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

elements

protected Vector elements
Java Vector used to store the elements of this.

Constructor Detail

JavaVector

public JavaVector()
Constructs a new Java vector.

Method Detail

add

public void add(Object anObject)
Adds the given object to the end of this, increasing the size of this by 1.

Specified by:
add in interface IVector
Parameters:
anObject - object to add

insertAtRank

public void insertAtRank(int aRank,
                         Object anObject)
Inserts the given object into this at the given rank, increasing the size of this by 1.

Specified by:
insertAtRank in interface IVector
Parameters:
aRank - rank at which to insert object
anObject - object to insert

removeAtRank

public Object removeAtRank(int aRank)
Removes and returns the object at the given rank, reducing the size of this by 1.

Specified by:
removeAtRank in interface IVector
Parameters:
aRank - rank from which to remove object

elementAtRank

public Object elementAtRank(int aRank)
Returns the object at the given rank.

Specified by:
elementAtRank in interface IVector
Parameters:
aRank - rank of object to return

replaceElement

public Object replaceElement(int aRank,
                             Object anObject)
Sets this to store the given object at the given rank, and returns the object that was replaced at that rank.

Specified by:
replaceElement in interface IVector
Parameters:
aRank - rank of object to store
anObject - object to store

size

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

Specified by:
size in interface IVector

isEmpty

public boolean isEmpty()
Returns whether or not this is empty.

Specified by:
isEmpty in interface IVector