module Student; from Login import LoginCookie; from Data import all; export all; (*****************************************************************************) object TutorialViewerWorkSpace is components: tutorialViews:TutorialView*; description: (* The TutorialViewerWorkSpace contains all items opened by the user in the Tutorial Viewer application, including tutorials, chats, message boards, etc. *); end TutorialViewerWorkSpace; object TutorialView inherits from TutorialRecord is components: currentPageIndex:PageIndex; description: (* The TutorialView is simply a tutorial in progress and contains the index (in pageIDs) of the currently open page. *); end TutorialView; object PageIndex is integer description: (* This integer holds the index of the currently open page in a tutorial. *); end PageIndex; (*****************************************************************************) operation ViewFirst is inputs: cookie:LoginCookie and tip:TutorialView and pdb:PageDB; outputs: tip':TutorialView; precondition: cookie.isConnected and tip.currentPageIndex != 1; postcondition: tip'.currentPageIndex = 1; description: (* Changes curTutorial's currentPageIndex to 1, the index of the first page in said tutorial, if it is not already there. *); end ViewFirst; operation ViewPrevious is inputs: cookie:LoginCookie and tip:TutorialView and pdb:PageDB; outputs: tip':TutorialView; precondition: cookie.isConnected and tip.currentPageIndex != 1; postcondition: tip'.currentPageIndex = (tip.currentPageIndex - 1); description: (* Changes curTutorial's currentPageIndex to the index of the previous page in said tutorial, if it is not already at the first page. *); end ViewPrevious; operation ViewNext is inputs: cookie:LoginCookie and tip:TutorialView and pdb:PageDB; outputs: tip':TutorialView; precondition: cookie.isConnected and tip.currentPageIndex != #(tip.pageIDs); postcondition: tip'.currentPageIndex = (tip.currentPageIndex + 1); description: (* Changes curTutorial's currentPageIndex to the index of the next page in said tutorial, if it is not already at the last page. *); end ViewNext; operation ViewLast is inputs: cookie:LoginCookie and tip:TutorialView and pdb:PageDB; outputs: tip':TutorialView; precondition: cookie.isConnected and tip.currentPageIndex != #(tip.pageIDs); postcondition: tip'.currentPageIndex = #(tip.pageIDs); description: (* Changes curTutorial's curPageID to the index of the last page in said tutorial, if it is not already there. *); end ViewLast; (*****************************************************************************) end Student;