All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class structure.OrderedVector

java.lang.Object
   |
   +----structure.OrderedVector

public class OrderedVector
extends Object
implements OrderedStructure
Implementation of an ordered structure implemented using a vector.

See Also:
Vector

Constructor Index

 o OrderedVector()
Construct an empty ordered vector.

Method Index

 o add(Object)
Add a comparable value to an ordered vector.
 o clear()
Removes all the values from a an ordered vector.
 o contains(Object)
Determine if a comparable value is a member of the ordered vector.
 o elements()
Construct an iterator to traverse the ordered vector in ascending order.
 o isEmpty()
Determine if the ordered vector is empty.
 o remove(Object)
Remove a comparable value from an ordered vector.
 o size()
Determine the number of elements within the ordered vector.
 o toString()
Construct a string representation of an ordered vector.

Constructors

 o OrderedVector
 public OrderedVector()
Construct an empty ordered vector.

Postcondition:
constructs an empty, ordered vector.

Methods

 o add
 public void add(Object value)
Add a comparable value to an ordered vector.

Precondition:
value is non-null
Postcondition:
inserts value, leaves vector in order

Parameters:
value - The comparable value to be added to the ordered vector.
 o contains
 public boolean contains(Object value)
Determine if a comparable value is a member of the ordered vector.

Precondition:
value is non-null
Postcondition:
returns true if the value is in the vector

Parameters:
value - The comparable value sought.
Returns:
True if the value is found within the ordered vector.
 o remove
 public Object remove(Object value)
Remove a comparable value from an ordered vector. At most one value is removed.

Precondition:
value is non-null
Postcondition:
removes one instance of value, if found in vector.

Parameters:
value - The comparable value to be removed.
Returns:
The actual comparable removed.
 o isEmpty
 public boolean isEmpty()
Determine if the ordered vector is empty.

Postcondition:
returns true if the vector is empty.

Returns:
True iff the ordered vector is empty.
 o clear
 public void clear()
Removes all the values from a an ordered vector.

Postcondition:
vector is emptied.

 o size
 public int size()
Determine the number of elements within the ordered vector.

Postcondition:
returns the number of elements in vector

Returns:
The number of elements within the ordered vector.
 o elements
 public Iterator elements()
Construct an iterator to traverse the ordered vector in ascending order.

Postcondition:
returns an iterator for traversing vector

Returns:
An iterator to traverse the ordered vector.
 o toString
 public String toString()
Construct a string representation of an ordered vector.

Precondition:
returns string representation of ordered vector

Returns:
The string representing the ordered vector.
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index