5.3. View Menu (view.rsl)

(* Chris Noe  *)
(* describe the objects and operations associated with the View menu *)
module View;
	from Test import Test;
	from Question import QuestionDB, Question, Type, Class, Time, Difficulty, Keywords, LastUsed, QuestionText, CorrectAnswer, Author;

	(* a row of the question db view shows most of the properties of a question *)
	obj QuestionDBTable is qdbrows:QuestionDBRow*;
	obj QuestionDBRow is type:Type and class:Class and time:Time and difficulty:Difficulty
		and lastused:LastUsed and keywords:Keywords and questiontext:QuestionText and
		correctanswer:CorrectAnswer and author:Author;

	(* View > Question Database *)
	operation ViewQuestionDB is
		inputs: qdb:QuestionDB, cl:ColumnsList;
		outputs: qdbt:QuestionDBTable;
		pre: (* Ensure that the question DB exists *);
		post: (* Ensure that the question db is properly displayed *)
			(forall (i:integer | (i >= 1) and (i < #qdb))
				(qdb[i].type = qdbt[i].type) and
				(qdb[i].class = qdbt[i].class) and
				(qdb[i].time = qdbt[i].time ) and
				(qdb[i].difficulty = qdbt[i].difficulty) and
				(qdb[i].keywords = qdbt[i].keywords) and
				(qdb[i].lastused = qdbt[i].lastused) and
				(qdb[i].questiontext = qdbt[i].questiontext) and
				(qdb[i].author= qdbt[i].author) and
				(qdb[i].correctanswer = qdbt[i].correctanswer));
	end ViewQuestionDB;

	(* View > Current Test *)
	operation ViewCurrentTest is
		inputs: t:Test;
		outputs: (* None *);
		pre: (* None *);
		post: (* None *);
	end ViewCurrentTest;

	(* View > Columns ... *)
	obj ShowType is boolean;
	obj ShowClass is boolean;
	obj ShowTime is boolean;
	obj ShowDifficulty is boolean;
	obj ShowLastUsed is boolean;
	obj ShowKeywords is boolean;
	obj ShowQuestionText is boolean;
	obj ShowCorrectAnswer is boolean;
	obj ShowAuthor is boolean;

	obj ColumnsList is ShowType and ShowClass and ShowTime and ShowDifficulty
		and ShowLastUsed and ShowKeywords and ShowQuestionText and
		ShowCorrectAnswer and ShowAuthor;

	operation ViewColumns is
		inputs: c:ColumnsList;
		outputs: c':ColumnsList;
		pre: (* None *);
		post: (* Modified ColumnsList shows which columns to display *);
	end ViewColumns;

	(* View > Font Editor ... *)
	operation ViewFontEditor is
		inputs: (* None *);
		outputs: (* None *);
		pre: (* None *);
		post: (* None *);
	end ViewFontEditor;
end View;

Prev: edit.rsl | Next: question.rsl | Up: formal specification | Top: index