module LectureOperations; from Lecture import all; export all; object MaxSlideNumber is int; description: (* The number of a slides in a LectureElement. *); end MaxSlideNumber; object ToSlideNumber is int; description: (* The slide number to advance to. *); end MaxSlideNumber; operation nextSlide is inputs: sn : SlideNumber, msn: MaxSlideNumber; output: sn': SlideNumber; description: (* The next slide is advanced to using the page toolbar. *); precondition: (* cannot advance to the next slide if at the end *) #sn < msn; postcondition: (* The slide number increments by 1 *) #sn' = #sn + 1; end nextSlide; operation prevSlide is inputs: sn : SlideNumber; output: sn': SlideNumber; description: (* The previous slide is advanced to using the page toolbar. *); precondition: (* cannot advance to the previous slide if at the first slide *) #sn > 1; postcondition: (* The slide number decreases by 1 *) #sn' = #sn + 1; end nextSlide; operation lastSlide is inputs: sn : SlideNumber, msn: MaxSlideNumber; output: sn': SlideNumber; description: (* The last slide is advanced to using the page toolbar. *); precondition: (* none *); postcondition: (* The slide number increases to the maximum slide number *) #sn = msn; end lastSlide; operation firstSlide is inputs: sn : SlideNumber; output: sn': SlideNumber; description: (* The first slide is advanced to using the page toolbar. *); precondition: (* none *); postcondition: (* The slide number is 1. *) #sn = 1; end firstSlide; operation toSlide is inputs: sn : SlideNumber, msn: MaxSlideNumber, tsn: ToSlideNumber; output: sn': SlideNumber; description: (* The slide is advanced to the number entered using the page toolbar. *); precondition: (* slide number entered is within range *) (tsn >=1) and (tsn <= msn); postcondition: (* The slide number is advanced to the entered number. *) #sn = tsn; end toSlide; end LectureOperations;