// ******************************************************************************* // Interface SortedListInterface // ******************************************************************************* public interface SortedListInterface { public int size( ); // Description: Determines the length of a list (number of elements stored in the list). // Precondition: None. // Postcondition: Returns the number of elements that are currently stored in the list. // Throws: None. public void removeAll( ); // Description: Deletes all the elements from the list. // Precondition: None. // Postcondition: The list is empty. // Throws: None. public void insert( Object thisElement ) throws ListException; // Description: Adds an element to the list. // Precondition: "thisElement" is not null (?) // Postcondition: If insertion is successful, "thisElement" has been inserted at the proper // location based on the sorting order(s) of the list. // Throws: ListException if "thisElement" cannot be placed in the list for whathever reason. public Object retrieve( Object criteria ) throws ElementNotFoundException; // Description: Retrieves a list element that matches "criteria". // Precondition: Since "criteria" is the criteria to utilise when searching the list, // "criteria" must not be null. // Postcondition: If "criteria" is found, the corresponding object in the list is returned. // The list is unchanged. // Throws: ElementNotFoundException if "criteria" is not found in the list. public Object remove( Object criteria ) throws ElementNotFoundException; // Description: Removes the element that matches "criteria" from the list. // Precondition: Since "criteria" is the criteria to utilise when searching the list, // "criteria" must not be null. // Postcondition: If "criteria" is found, the corresponding object is removed from the list. // Throws: ElementNotFoundException if "criteria" is not found in the list. } // end SortedListInterface