Interface IVector

All Known Implementing Classes:
JavaVector

public interface IVector

Required methods for the Vector ADT.


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.
 

Method Detail

add

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

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.

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.

Parameters:
aRank - rank from which to remove object

elementAtRank

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

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.

Parameters:
aRank - rank of object to store
anObject - object to store

size

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


isEmpty

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