Page 29 - Fister jr., Iztok, and Andrej Brodnik (eds.). StuCoSReC. Proceedings of the 2016 3rd Student Computer Science Research Conference. Koper: University of Primorska Press, 2016
P. 29
Race
Events Transition Control Begin Measuring End Agents
area points time
swimming cycling running start number finish update decrement automatic manual
time laps
of laps
Figure 1: Concept diagram of measuring time domain.
Table 1: Translation of the application domain features to graphical elements.
Application domain features Graphical elements
Begin race Ibegin
Events (Swimming, Cycling, Running) Iswim, Ibike, Irun
Transition area Ita
End race Iend
Measuring time Imd0 , Imd1 , Imd2
Control points (start, number of laps, finish) square dots (control points)
Agents (automatic, manual) square dots (measuring points)
Algorithm 1 Definition of object ’Event’ Note that the other objects are represented and implemented
in a similar manner.
1: class Event {
2: int type; // type of events Swim, Run, Bike 2.3 Code generation
3: int laps; // number of laps
4: int lc; // index of generated variables Code generation is divided into:
5:
6: Event(int Type, int Laps, int Lc); • the source code generation,
7: void initialize();
8: void generate(); • the object code generation.
9: }
In the first phase, a visual representation of a real race
generate). The variable type determines the type of event, using the graphical elements (also user model) is mapped
i.e., Swim, Run, Bike, variable laps the number of laps that into the EasyTime DSL source code while, in the second
the competitor needs to accomplish a specific discipline, and phase, this source code is compiled into object code using
variable lc determines the instance of a specific variable. The the LISA [18] compiler/generator. Semantic domains need
variable laps is a context information which is obtained by to be defined for translating the graphical elements into the
the user. The method Event constructs the object with ap- EasyTime DSL source code. In EasyTime III, two semantic
propriate parameters, method initialize generates the spe- domains are defined (Table 3). Both domains are used for
cific EasyTime DSL code necessary to initialize the variables a proper calling of the objects represented in the Table 4 in
within the scope, and the method generate generates the the translation phase. The former (i.e., DEvent ) defines sub-
specific EasyTime DSL code appropriate for this event. A features of the feature Event, while the latter (i.e., DEvent )
detailed implementation of the mentioned methods can be sub-features of the feature Md. All the other parameters of
seen in Algorithm 2. the corresponding objects are of integer type. In the sec-
Algorithm 2 Implementation of object ’Event’ Table 3: Semantic domains in EasyTime III.
DEvent = {Swim, Bike, Run} Event Type ∈ DEvent
1: Event::Event(int Type, int Laps, int Lc) DMd = {Md0 , Md1 , Md2 } Md Type ∈ DMd
2: type = Type; laps = Laps;
3: lc = Lc; ond phase, the EasyTime DSL source code translated from
4: } the corresponding user visual model is generated into virtual
5: void Event::initialize() { machine object code. The readers can obtain more informa-
6: gen(op init, var round, lc, laps); tion about this process in [8].
7: gen(op init, var inter, lc, 0);
8: }
9: void Event::generate() {
10: gen(op dec, var round, lc);
11: gen(op upd, var inter, lc);
12: }
StuCoSReC Proceedings of the 2016 3rd Student Computer Science Research Conference 29
Ljubljana, Slovenia, 12 October
Events Transition Control Begin Measuring End Agents
area points time
swimming cycling running start number finish update decrement automatic manual
time laps
of laps
Figure 1: Concept diagram of measuring time domain.
Table 1: Translation of the application domain features to graphical elements.
Application domain features Graphical elements
Begin race Ibegin
Events (Swimming, Cycling, Running) Iswim, Ibike, Irun
Transition area Ita
End race Iend
Measuring time Imd0 , Imd1 , Imd2
Control points (start, number of laps, finish) square dots (control points)
Agents (automatic, manual) square dots (measuring points)
Algorithm 1 Definition of object ’Event’ Note that the other objects are represented and implemented
in a similar manner.
1: class Event {
2: int type; // type of events Swim, Run, Bike 2.3 Code generation
3: int laps; // number of laps
4: int lc; // index of generated variables Code generation is divided into:
5:
6: Event(int Type, int Laps, int Lc); • the source code generation,
7: void initialize();
8: void generate(); • the object code generation.
9: }
In the first phase, a visual representation of a real race
generate). The variable type determines the type of event, using the graphical elements (also user model) is mapped
i.e., Swim, Run, Bike, variable laps the number of laps that into the EasyTime DSL source code while, in the second
the competitor needs to accomplish a specific discipline, and phase, this source code is compiled into object code using
variable lc determines the instance of a specific variable. The the LISA [18] compiler/generator. Semantic domains need
variable laps is a context information which is obtained by to be defined for translating the graphical elements into the
the user. The method Event constructs the object with ap- EasyTime DSL source code. In EasyTime III, two semantic
propriate parameters, method initialize generates the spe- domains are defined (Table 3). Both domains are used for
cific EasyTime DSL code necessary to initialize the variables a proper calling of the objects represented in the Table 4 in
within the scope, and the method generate generates the the translation phase. The former (i.e., DEvent ) defines sub-
specific EasyTime DSL code appropriate for this event. A features of the feature Event, while the latter (i.e., DEvent )
detailed implementation of the mentioned methods can be sub-features of the feature Md. All the other parameters of
seen in Algorithm 2. the corresponding objects are of integer type. In the sec-
Algorithm 2 Implementation of object ’Event’ Table 3: Semantic domains in EasyTime III.
DEvent = {Swim, Bike, Run} Event Type ∈ DEvent
1: Event::Event(int Type, int Laps, int Lc) DMd = {Md0 , Md1 , Md2 } Md Type ∈ DMd
2: type = Type; laps = Laps;
3: lc = Lc; ond phase, the EasyTime DSL source code translated from
4: } the corresponding user visual model is generated into virtual
5: void Event::initialize() { machine object code. The readers can obtain more informa-
6: gen(op init, var round, lc, laps); tion about this process in [8].
7: gen(op init, var inter, lc, 0);
8: }
9: void Event::generate() {
10: gen(op dec, var round, lc);
11: gen(op upd, var inter, lc);
12: }
StuCoSReC Proceedings of the 2016 3rd Student Computer Science Research Conference 29
Ljubljana, Slovenia, 12 October