5.7. Lesson Database (LessonDB.rsl)

(*
 *
 * LessonDB defines the major Lesson objects of the CSTutor application for use
 * by other modules.
 *
 *)

-- this file is not a Module. To compile our .rsl files properly. Do the following:
-- BE SURE that your .rsl file is not a Module, and remove all imports/exports.
-- at the command prompt then issue the following command:
--
--   rsl LessonDB.rsl                        compiles LessonDB.rsl   ...duh
--   rsl Edit.rsl LessonDB.rsl               compiles Edit.rsl with LessonDB.rsl
--   rsl File.rsl LessonDB.rsl               compiles File.rsl with LessonDB.rsl
--   rsl View.rsl LessonDB.rsl               compiles View.rsl with LessonDB.rsl
--   rsl Admin.rsl LessonDB.rsl              compiles Admin.rsl with LessonDB.rsl
--   rsl Messaging.rsl LessonDB.rsl          compiles Messaging.rsl with LessonDB.rsl
--   rsl Authoring.rsl LessonDB.rsl          compiles Authoring.rsl with LessonDB.rsl
--
--
--   rsl Edit.rsl File.rsl LessonDB.rsl Admin.rsl View.rsl Messaging.rsl Authoring.rsl    compiles ALL our stuff together.
-- once we can do this last execution in the command prompt with 0 errors. we can:
-- rsldoc Edit.rsl File.rsl LessonDB.rsl Admin.rsl View.rsl Messaging.rsl Authoring.rsl   and get our rsldoc.

  object LessonDB is
    components: class_title:ClassTitle and Class*;
    description: (*
        A LessonDB is the underlying abstract object that contains all
        created lessons and class hierarchy.
    *);
  end LessonDB;

  object ClassTitle is
    components: string;
    description: (*
        A Classtitle is the string of class name
    *);
  end ClassTitle;

  object Class is
    components: instructor:Instructor*;
    description: (*
        A class contains references to all instructors currently teaching the
        class.
    *);
  end Class;

  object Instructor is
     components: title:InstructorTitle and section:Section*;
     description: (*
         An Instructor has sections that he/she is teaching.
     *);
  end Instructor;

  object InstructorTitle is
    components: string;
    description: (*
        The InstructorTitle is the name of the an instructor.
    *);
  end InstructorTitle;

  object Section is
    components: title:SectionTitle and lesson:Lesson*;
    description: (*
        A section contains a collection of Lessons.
    *);
  end Section;

  object SectionTitle is
    components: string;
    description: (*
        A SectionTitle is the name of the sections made available by the Admin for
        an instructor. They include: "01", "02", "03", "04","05" ... and "all".
    *);
  end SectionTitle;

  object Lesson is
    components: info_node:InfoNode* and quiz_node:QuizNode* and properties:LessonProperties and
                requires_saving:RequiresSaving and file:File and node_count:integer and node_limit:integer;
    description: (*
        A lesson contains nodes, and also the LessonInfo which is standard
        information of a lesson: creator, date made, Title, bool fixed, bool
        exploratory, section belong value.
    *);
  end Lesson;

  object LessonProperties is
    components: author:Author and made:DateMade and title:LessonTitle and (fixed:FixedMode or
                free:FreeMode) and section:SectionBelong;
    description: (*
        The perinent data fields for the information of a lesson. This info
        should be displayed in a tooltip when the LessonExplorer has a
        lesson moused over.
    *);
  end LessonProperties;

  object Author is
    components: string;
    description: (*
        The name of an author. Eg. "John Doe".
    *);
  end Author;

  object DateMade is
    components: string;
    description: (*
        DateMade is a string representation of a date. A default string of "no
        date entered" is inserted into this field. Examples of user input are:
        "10/02/02" "January 2, 2002" "03 January 02".  The format and content of
        the date is not checked by CSTutor.
    *);
  end DateMade;

  object LessonTitle is
    components: string;
    description: (*
        The LessonTitle is the title of the current Lesson being created.
        There is a default value of "no title given." entered by CSTutor so that
        a lesson is 'complete' with little or no user input. The author may enter
        any name for their lesson, however useful or not. Eg. "For Loops Lesson1"
        or "a stupid lesson".
    *);
  end LessonTitle;

  object FixedMode is
    components: boolean;
    description: (*
        The FixedMode boolean option allows an author to deem a lesson as fixed
        enforcement of node links and order. This means that a user viewing the
        lesson must view the lesson linearly from start to finish and
        furthermore when in a quiz they cannot 'go back' during the quiz to
        relearn material.
    *);
  end FixedMode;

  object FreeMode is
    components: boolean;
    description: (*
        The FreeMode boolean option allows an author to deem a lesson as free
        of enforcement of node links and order. This means a user viewing a
        lesson can click on any node at any time and view its' content.
    *);
  end FreeMode;

  object SectionBelong is
    components: integer* and string;
    description: (*
        The Section belong data defines the data values selectable by the
        author to set which section they believe this lesson to be in.
        options are either 01-06 or "all".
    *);
  end SectionBelong;

  object RequiresSaving is
    components: boolean;
    description: (*
        The boolean flag RequiresSaving deems whether or not the Lesson requires
        saving while creating a lesson. Doing any operation in the Editor that
        alters the lesson content should throw this flag to true.
    *);
  end RequiresSaving;

  object Node is
    components: properties:NodeProperties and nxt_node:NextNode and
                prev_node:PrevNode and canvas:Canvas and item:NodeItem* and
                bg:Background and item_count:integer and item_limit:integer;
    description: (*
        A Node is a base type used to make Authoring.rsl smaller. Using a "Node"
        as a parameter (parent type) allows us to only define 1 operation for
        say "addText" with input Node. As opposed to 2 operations "addText"
        whose inputs would be 'infonode' and 'quiznode' respectabely.
        A Node contains data describing itself, a reference to
        the node before it, a reference to the node after it and
        a collection of references to the item contained in it.
    *);
  end Node;

  object NodeProperties is
    components: title:NodeTitle and summary:NodeSummary and pos:NodePosition;
    description: (*
        NodeSummary contains the current nodes title, a brief description of
        the node and the nodes # in its place in the lesson. This data should
        be shown when a node is moused over in the LessonExplorer node level.
    *);
  end NodeProperties;

  object NodeTitle is
    components: string;
    description: (*
        The NodeTitle defines the string that allows the title of the node
        being edited. By default "Node#".
    *);
  end NodeTitle;

  object NodeSummary is
    components: string;
    description: (*
        The NodeSummary is a string which the author can edit to put a
        useful description of the current node in. by default "no node
        description entered".
    *);
  end NodeSummary;

  object NodePosition is
    components: integer;
    description: (*
        The NodePosition of a node the nodes current position within the
        lesson.  This should only be viewable by the user and not editable.
        The content of NodePosition is always a number between 1-max_node.
    *);
  end NodePosition;

  object NextNode is
    components: integer;
    description: (*
        The next node field is not visible to the user, but every node
        contains a reference to the node after and before it. This value
        cannot reach (max_node + 1).
    *);
  end NextNode;

  object PrevNode is
    components: integer;
    description: (*
        The prev node field is not visible to the user, but every node
        contains a reference to the node after and before it. This value
        cannot be 0.
    *);
  end PrevNode;

  object Canvas is
    components: integer and integer and integer and integer;
    description: (*
        A Canvas is the editable/drawable area within a node (node editor
       window).  It's origin is the lower-left corner of the screen (0,0,0,0) to
       infinity in the upper right hand corner of the window.
    *);
  end Canvas;

  object NodeItem is
    components: region:Region and (text:Text or image:Image or
                code:CodeSegment or oval:Oval or navlink:NavLink or
                line:StraightLine or curve:CurveLine or rect:Rectangle);
    description: (*
        A NodeItem is any of the items above and its related region.
    *);
  end NodeItem;

  object Region inherits from Canvas is
    components: (* none *);
    description: (*
        A Region is the (x1,y1,x2,y2) region of the given NodeItem.
    *);
  end Region;

  object Background is
    components: color:Color or image:Image;
    description: (* A background is either a Color or Image. by default Color
        white.
    *);
  end Background;


-- the File object is in File.rsl it has the following components in File.rsl:
-- name:FileName and permissions:FilePermissions and file_type:FileType and data:FileData
  object Image is
    components: file:File;
    description: (* An Image is essentially a file on the disk.
    *);
  end Image;

  object Text is
    components: string and nfo:FontInfo;
    description: (*
        A region of Text is the string data and font information
        of the text.
    *);
  end Text;

-- yes, this is a *horrible* way to model an oval...i'm tired.
  object Oval is
    components: origin:Origin and r:Radius and w:Width;
    description: (*
        An oval contains information of its dimensions.
    *);
  end Oval;

  object Origin is
    components: integer and integer;
    description: (*
        The origin is the center of the Oval. an (x,y) pair.
    *);
  end Origin;

  object Radius is integer;
  object Width  is integer;

  object CodeSegment is
    components: codebg:CodeBackground and codearea:CodeTextArea and runbtn:RunButton;
    description: (*
        A CodeSegment contains the unique background color (see further
        below), the text area (java look...standard box) and the OS run
        button.
    *);
  end CodeSegment;

  object CodeBackground is
    components: color:Color;
    description: (* This object defines the background color that
        is used (implicitally) within the Region that is the
        codesegment. It should be a light grey color.
    *);
  end CodeBackground;

  object CodeTextArea is
    components: string;
    description: (*
        This item is defined by the language/OS, and contains string.
    *);
  end CodeTextArea;

  object RunButton is
    components: (* none *);
    description: (*
        The Run Button is defined by the system (CSTutor) and cannot
        be altered by the user in any way. But the user must interact
        with this button eventually.
    *);
  end RunButton;

  object NavLink is
    components: (path:LinkPath and title:NodeTitle and btn:RunButton) or url:URL;
    description: (*
        A NavLink contains either a URL or a LinkPath to another
        Lesson/Node.
    *);
  end NavLink;

  object URL is
    components: string;
    description: (*
        A URL is a string not checked by CSTutor.
    *);
  end URL;

  object StraightLine is
    components: beginpt:BeginPoint and endpt:EndPoint and color:Color;
    description: (*
        A StraightLine is the data where it began and ended, and its
        current color.
    *);
  end StraightLine;

  object BeginPoint is
    components: x1:X1 and y1:Y1;
    description: (*
        The beggining point of the line is (x1, y1).
    *);
  end BeginPoint;

  object EndPoint is
    components: x2:X2 and y2:Y2;
    description: (*
        The ending point of the line is (x2, y2).
    *);
  end EndPoint;

  -- these are essentially indivual coordinate values used by CSTutor.
  object X1 is integer;
  object Y1 is integer;
  object X2 is integer;
  object Y2 is integer;

  object CurveLine inherits from StraightLine is
    components: distorion:Distortion*;
    description: (*
        As per Tommy's section a CurveLine is essentially a straight line
        that is tweaked has an added ability to be tweaked into a curved
        line (Eg. click a pixel on the line and morph it around that point).
        There can be more than one distortion per curveline. 
    *);
  end CurveLine;

  object Distortion is
    components: at:BeginPoint and morph_to:EndPoint;
    description: (*
        The distortion data needed by CSTutor to morph a straight line.
    *);
  end Distortion;

  object Rectangle is
    components: upper_leftpt:BeginPoint and lower_rightpt:EndPoint and color:Color;
    description: (*
        A rectangle contains it region and its color.
    *);
  end Rectangle;

  object Color is
    components: red:Red and green:Green and blue:Blue;
    description: (*
        A color is its Red, Green and Blue references.
    *);
  end Color;

  -- These colors are just numbers because they can be integer values,
  -- or hex values.
  object Red is
    components: number;
    description: (*
        Red is the number for the amount of red in the current color.
    *);
  end Red;

  object Green is
    components: number;
    description: (*
        Green is the number for the amount of green in the current color.
    *);
  end Green;

  object Blue is
    components: number;
    description: (*
        Blue is the number for the amount of green in the current color.
    *);
  end Blue;

  object FontInfo is
    components: ftype:FontType and fsize:FontSize and fstyle:FontStyle and fcolor:Color;
    description: (*
        The FontInfo is the data needed to edit font. Note that StyleOption
        is an object of FontStyle with only 3 options available.  These are the
        options available to the enduser.
    *);
  end FontInfo;

  object FontType is
    components: string;
    description: (*
        Any valid font name that is in the system can represent the font.
        Eg. "Times New Roman" "Tempus Sans" "Sans Serriff"
    *);
  end FontType;

  object FontSize is
    components: integer;
    description: (*
        The fontsize is an integer. Eg. 10 12 14 24.
    *);
  end FontSize;

  object FontStyle is
    components: string;
    description: (*
        This object defines the kind of FontStyle the current text is. Options are
        "Bold" "Italics" and "UnderLined".
    *);
  end FontStyle;

  object InfoNode inherits from Node is
    components: (* none *);
    description: (*
        An InfoNode contains data describing itself, a reference to
        the node before it, a reference to the node after it and
        a collection of references to the items contained in it.
    *);
  end InfoNode;

  object QuizNode inherits from InfoNode is
    components: table:ScoreTable and question:Question*;
    description: (*
        A quiz contains everything an InfoNode may contain, plus a score table
        and question(s).
    *);
  end QuizNode;

  object ScoreTable is
    components: style:GradingStyle and data:ScoreData*;
    description: (*
        A scoretable contains a percentage range to guide the user to some node
        or the raw score range to do the same. For each logical range the
        teacher sets up a SmartLink is associated with it, so that CSTutor can
        try to draw the arrows linking back and forward in the lesson, based on
        how well the student did on the quiz.
    *);
  end ScoreTable;

  object GradingStyle is
    components: percentages:Percent or rawscores:RawScore;
    description: (*
        The grading style of the quiz is deemed by the author as either by
        percent or by raw point value of the quiz.
    *);
  end GradingStyle;

  object Percent is
    components: boolean;
    description: (*
        The Percent boolean choice allows an author to set the grading style to
        evaluate the students score with the use of percentage values.
    *);
  end Percent;

  object RawScore is
    components: boolean;
    description: (*
        The RawScore boolean choice allows an author to set the grading style to
        evaluate the students score with raw point values used.
    *);
  end RawScore;

  object ScoreData is
    components: min:MinValue and max:MaxValue and linknfo:LinkPath;
    description: (*
        The scoring data consists of a collection of minimum values and maximum
        values that are beging represented as either raw points or as percentages.
        Each of these values is associated to a LinkPath which is a reference to
        a node, either in the current lesson or not.
    *);
  end ScoringData;

  object MinValue is
    components: integer;
    description: (*
        The minimum range value of 1 scoredata object used by CSTutor to evaluate
        where a student is directed upon their completion of a quiz.
    *);
  end MinValue;

  object MaxValue is
    components: integer;
    description: (*
        The maximum range value of 1 scoredata object used by CSTutor to evaluate
        where a student is directed upon their completion of a quiz.
    *);
  end MaxValue;

  object LinkPath is
    components: path:ServerLessonPath and npos:NodePosition;
    description: (*
        A LinkPath is a serverlessonpath (string) and nodeposition (#).
    *);
  end LinkPath;

  object ServerLessonPath is
    components: string;
    description: (*
        A server lesson path is a string to a server and dir.
        Eg. "server1/CSTutor/CSC/101/gfisher/01/ForLoops.cst"
    *);
  end ServerLessonPath;

  object Question is
    components: type:QuestionType and qtext:QuestionText and value:PointValue and
                num:QuestionNumber;
    description: (*
        A question is 1 of the accepted types and the text related to question.
    *);
  end Question;

  object QuestionType is
    components: multiple_choice:MultiChoice or torf:TrueFalse or fillin:FillIn or code:Code;
    description: (*
        A questiontype is 1 of these 4 types.
    *);
  end Question;

  object MultiChoice is
    components: choice:Choice* and correct_choice:CorrectChoice;
    description: (*
        A multipule choice question is a collection of choices (any amount) and
        also the correct choice.
    *);
  end MultiChoice;

  object Choice is
    components: num:ChoiceNumber and ans:string;
    description: (*
        A choice contains a reference to what choice it is (in english, "choice #1" or "choice #2" or
        "choice #50"...uggg that'd suck for a student to have a question with so many
        choices, but CSTutor can do it.  It also contains the string that is the answer
        associated with the choice radio button.
    *);
  end Choice;

  object ChoiceNumber is
    components: integer;
    description: (*
        A choice number is a reference to what number the choice is.
    *);
  end ChoiceNumber;

  object CorrectChoice is
    components: value:ChoiceNumber;
    description: (*
        A correct choice is merely a ChoiceNumber that has been defined by the user
        (radio button has been clicked on) and exists. This is not simply an 'integer'
        because an integer could be an undefined choice.
    *);
  end CorrectChoice;

  object TrueFalse is
    components: boolean;
    description: (*
        A T/F question is boolean...duh.
    *);
  end TrueFalse;
    
  object FillIn is
    components: string;
    description: (*
        A fill in question contains an answer that is a string. This string is
        used by CSTutor for parsing out the right answer from the students
        answer.
    *);
  end FillIn;

  object Code inherits from CodeSegment is
    components: ans:string;
    description: (*
        The string of a Code question is the correct answer supposidely read from
        from java.system.io() (standard output) from the students entered code
        segment.
    *);
  end Code;

  object QuestionText is
    components: string;
    description: (*
        The question text is a string.
    *);
  end QuestionText;

  object PointValue is
    components: integer;
    description: (*
        The point value for a question is an integer.
    *);
  end PointValue;

  object QuestionNumber is
    components: integer;
    description: (*
        A question # is the an integer. *IF* a quiz only contained question objects
        then a quiz _could_ hold up to max_items number of questions for a student
        to be tested on.
    *);
  end QuestionNumber;

  -- UserWorkSpace for other Modules if needed. I have defined evertying I need for
  object UserWorkSpace is
    components: uid:UserID and lesson:Lesson and
        previous_state:PreviousState and clipboard:Clipboard and
        selection:Selection and context:SelectionContext and controlling:IsInControl;
    description: (*
        The UserWorkSpace contains the active lesson upon which the
        author/student is working.  The first component is the UserId of the
        current user, which is used as necessary by operations that input the workspace to
        determine who the user is(such as Save).  The Lesson component is the
        active lesson.  The previous_state component is used to support one
        level of command undo.  The Clipboard is used with the Edit cut, copy,
        and paste operations. IsInControl is used by Messaging.rsl (remote
        assistance) to monitor if a user is remotely engaged at the moment.
    *);
  end UserWorkSpace;

  object PreviousState is
    components: lesson:Lesson;
    description: (*
        The previous state of the current lesson is the lesson prior to
        the current modification.
    *);
  end PreviousState;





Prev: Administration.rsl | Next: [none] | Up: spec | Top: index