All Packages  Class Hierarchy  This Package  Previous  Next  Index  
Class structure.OrderedList
java.lang.Object
    |
    +----structure.OrderedList
- public class OrderedList
- extends Object- implements OrderedStructure
A class that implements a collection of values that are kept in order.
Base values must be comparable.  Unlike Lists there is no notion of head
or tail.
 
 OrderedList() OrderedList()
- Construct an empty ordered list.
 
 add(Object) add(Object)
- Add a value to the ordered list, keeping values in order.
 clear() clear()
- Remove all the elements from the ordered list.
 contains(Object) contains(Object)
- Determine if the ordered list contains a value.
 elements() elements()
- Construct an iterator for traversing elements of ordered list
in ascending order.
 isEmpty() isEmpty()
- Determine if the list is empty.
 remove(Object) remove(Object)
- Remove a value from the ordered list.
 size() size()
- Determine the number of elements in the list.
 toString() toString()
- Generate string representation of the ordered list.
 
 OrderedList
OrderedList
public OrderedList()
- Construct an empty ordered list.
 
- Postcondition:
-  constructs an empty ordered list.
 
 
 
 clear
clear
public void clear()
- Remove all the elements from the ordered list.
 
- Postcondition:
-  the ordered list is empty
 
 
 add
add
public void add(Object value)
- Add a value to the ordered list, keeping values in order.
 
- Precondition:
-  value is non-null
- Postcondition:
-  value is added to the list, leaving it in order
 
 
- 
- Parameters:
- value - The value to be added to the list.
 
 contains
contains
public boolean contains(Object value)
- Determine if the ordered list contains a value.
 
- Precondition:
-  value is non-null comparable object
- Postcondition:
-  returns true iff contains value
 
 
- 
- Parameters:
- value - The value sought in the list.
- Returns:
- The actual value found, or null, if not.
 
 remove
remove
public Object remove(Object value)
- Remove a value from the ordered list.  At most one value
is removed.
 
- Precondition:
-  value is non-null
- Postcondition:
-  an instance of value is removed, if in list.
 
 
- 
- Parameters:
- value - The value to be removed.
- Returns:
- The actual value removed from the list.
 
 size
size
public int size()
- Determine the number of elements in the list.
 
- Precondition:
-  returns the number of elements in the ordered list
 
 
- 
- Returns:
- The number of elements in the list.
 
 isEmpty
isEmpty
public boolean isEmpty()
- Determine if the list is empty.
 
- Postcondition:
-  returns true iff the size is non-zero
 
 
- 
- Returns:
- True if the ordered list is empty.
 
 elements
elements
public Iterator elements()
- Construct an iterator for traversing elements of ordered list
in ascending order.
 
- Postcondition:
-  returns an iterator over ordered list
 
 
- 
- Returns:
- An iterator traversing elements in ascending order.
 
 toString
toString
public String toString()
- Generate string representation of the ordered list.
 
- Postcondition:
-  returns string representation of list
 
 
- 
- Returns:
- String representing ordered list.
- Overrides:
- toString in class Object
 
All Packages  Class Hierarchy  This Package  Previous  Next  Index