//****************************************************************** // SPECIFICATION FILE (Hybred.h) // This file gives the specification of a sorted list abstract data // type. The list components are maintained in ascending order of // value //****************************************************************** typedef int ComponentType; // Type of each component // (a simple type or the string type) struct NodeType; // Forward declaration // (Complete declaration is // hidden in implementation file) class HybridList { public: bool IsEmpty() const; // Postcondition: // Function value == true, if list is empty // == false, otherwise void Print() const; // Postcondition: // All components (if any) in list have been output void InsertAsFirst( /* in */ ComponentType item ); // Precondition: // item < first component in list // Postcondition: // item is first component in list // && List components are in ascending order void Insert( /* in */ ComponentType item ); // Precondition: // item is assigned // Postcondition: // item is in list // && List components are in ascending order void RemoveFirst( /* out */ ComponentType& item ); // Precondition: // NOT IsEmpty() // Postcondition: // item == first component in list at entry // && item is no longer in list // && List components are in ascending order void Delete( /* in */ ComponentType item ); // Precondition: // item is somewhere in list // Postcondition: // First occurrence of item is no longer in list // && List components are in ascending order HybridList(); // Constructor // Postcondition: // Empty list is created HybridList( const HybridList& otherList ); // Copy-constructor // Postcondition: // List is created as a duplicate of otherList ~HybridList(); // Destructor // Postcondition: // List is destroyed private: NodeType* head; };