Initializing help system before first use

Example

In its present version, Mosel does not allow the user to define data structures with entries of different types. In certain cases it may nevertheless be useful to organize data in such a way. Taking the example of scheduling problems, a typical group of inhomogeneous data are those related to a task. In our example, we shall define a structure task that holds the following pieces of information:

  • task name (a string)
  • duration (real value)
  • a special flag (Boolean)
  • due date (integer value)

The following model may give an overview on the types of operations and specific access functions that we have to define in order to be able to work satisfactorily with this new type:

model "test task module"
 uses "task"

 declarations
  R:set of integer
  t:array(R) of task
  s:task
 end-declarations

! Assigning a task
 s:=task("zero",1.5,true,3)

! Initializing a task array from file
 initializations from "testtask.dat"
  t
 end-initializations

! Reassigning the same task
 t(1):=task("one",1,true,3)
 t(1):=task("two",1,true,3)

! Various ways of creating tasks
 t(3):=task("three",10)
 t(7):=task(7)
 t(6):=task("six")
 t(9):=task(3,false,9)

! Writing a task array to file
 initializations to "testtask.dat"
  t as 't2'
 end-initializations

! Printout
 writeln("s:", s)
 writeln("t:", t)

! Accessing (and changing) detailed task information
 forall(i in R)
  writeln(i," Task ",strfmt(t(i).name,-5),": duration:", t(i).duration,
          ", flag:", t(i).aflag, ", due date:", t(i).duedate )
 t(7).name:="seven"
 t(6).duration:=4.3
 t(9).aflag:=true
 t(7).duedate:=10

! Comparing tasks
 if t(1)<>s then
  writeln("Tasks are different.")
 end-if
 t(0):=task("zero",1,true,3)
 if t(0)=s then
  writeln("Tasks are the same.")
 end-if

end-model  

© 2001-2020 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.