// ******************************************************************************* // Constraints for the public methods of the SortedList (expressed in UML) // ******************************************************************************* +size():integer // 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. +removeAll() // Description: Deletes all the elements from the list. // Precondition: None. // Postcondition: The list is empty. // Throws: None. +insert(thisElement:genericType*) // 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. +retrieve(criteria:someType**):genericType* // 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. +remove(criteria:someType**):genericType* // 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. Notes: * "genericType" must not be Resource class type. Use a template-defined type. ** "someType" must not be Resource class type. It can however be the same type as the template-defined type.