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
OrderedVector()
- Construct an empty ordered vector.
add(Object)
- Add a comparable value to an ordered vector.
clear()
- Removes all the values from a an ordered vector.
contains(Object)
- Determine if a comparable value is a member of the ordered vector.
elements()
- Construct an iterator to traverse the ordered vector in ascending
order.
isEmpty()
- Determine if the ordered vector is empty.
remove(Object)
- Remove a comparable value from an ordered vector.
size()
- Determine the number of elements within the ordered vector.
toString()
- Construct a string representation of an ordered vector.
OrderedVector
public OrderedVector()
- Construct an empty ordered vector.
- Postcondition:
- constructs an empty, ordered vector.
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.
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.
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.
isEmpty
public boolean isEmpty()
- Determine if the ordered vector is empty.
- Postcondition:
- returns true if the OrderedVector is empty.
- Returns:
- True iff the ordered vector is empty.
clear
public void clear()
- Removes all the values from a an ordered vector.
- Postcondition:
- vector is emptied.
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.
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.
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