(**** * * Module Search is the window that comes up when some starts a new * search or redefines a search. * *) --module Search; --from Bank import QuestionBank; --from ManageQuestion import ClassName, Type, Difficulty, Time, QuestionText, Answer; operation FilterByClass is inputs: qb:QuestionBank, c:ClassName*; outputs: qb':QuestionBank; description: (* * Filters a question bank for the selected classes *); precondition: ; postcondition: (* * All questions that were in the question bank before and match any * of the Classes are still in the bank otherwise they aren't. *); end FilterByClass; operation FilterByType is inputs: qb:QuestionBank, t:Type*; outputs: qb':QuestionBank; description: (* * Filters a question bank for the selected Types *); precondition: ; postcondition: (* * All questions that were in the question bank before and match any * of the Types are still in the bank otherwise they aren't. *); end FilterByType; operation FilterByDifficulty is inputs: qb:QuestionBank, sd:StartDifficulty, ed:EndDifficulty; outputs: qb':QuestionBank; description: (* * Filters a question bank for questions between the difficulties *); precondition: ; postcondition: (* * All questions that were in the question bank before and are within * start and end difficulty inclusive are still in the bank otherwise * they aren't. *); end FilterByDifficulty; object StartDifficulty is Difficulty; object EndDifficulty is Difficulty; operation FilterByTime is inputs: qb:QuestionBank, st:StartTime, et:EndTime; outputs: qb':QuestionBank; description: (* * Filters a question bank for questions between the times *); precondition: ; postcondition: (* * All questions that were in the question bank before and are within * start and end time inclusive are still in the bank otherwise they * aren't. *); end FilterByTime; object StartTime is Time; object EndTime is Time; operation SearchForKeyword is inputs: qb:QuestionBank, k:Keyword*; outputs: qb':QuestionBank; description: (* * Searches a question bank for question, answer or topic fields that * match the given keywords *); precondition: ; postcondition: (* * All questions that were in the question bank before and match all * of the keywords in their QuestionText, Answer, or Topic are still * in the bank otherwise they aren't. *); end SearchForKeyword; object Keyword is string; --end Search;