Site Menu Project Specification Implementation Recommendations Reference Needs Updating Work in Progress Wastebasket Wiki Manual |
OO StackDEFINITION MODULE Stack; (* Object oriented version of Stack *) FROM Collections IMPORT CollectionData, Status; CONST defaultSize = <implementation defined>; maximumSize = <implementation defined>; TYPE Stack = OPAQUE; (* or should this be something like ... Stack = RECORD (* field declarations *) END; or perhaps ... Stack = OPAQUE RECORD; *) PROCEDURE ( self : Stack ) New ( initialSize : LONGCARD; VAR status : Status ) : Stack; PROCEDURE ( self : Stack ) Push ( value : CollectionData; VAR status : Status ); PROCEDURE ( self : Stack ) Pop ( VAR status : Status ) : CollectionData; PROCEDURE ( self : Stack ) Capacity : LONGCARD; PROCEDURE ( self : Stack ) NumberOfEntries : LONGCARD; PROCEDURE ( self : Stack ) Dispose; END Stack. |