Part X -- Modules and Raptor ANIMATION_SHOW Events
Michael Chen
August 29, 1996
Rewritten: H. Hildreth, 10-2-96
PART X: MODULES AND RAPTOR ANIMATION_SHOW EVENTS
Objective: Although we created multiple users in the previous example, each
of them exhibited the same behavior. This is because each of the users were
defined by "user_interface" and its associated behavior rulesof them. The
objective of this example is to specify modules of the "user_interface" type
that have different behaviors.
Rapide Concepts Introduced: Modules
Procedure:
STEP 1.
The first step was to remove the behavior rules from the user_interface type
(defined in uil-col.rpd). The entire definition of the new user_interface
appears below:
type user_interface is interface
service UIL : User_Interface_Layer;
service COL : dual Concepts_Of_Operation_Layer;
service PB : dual Pass_Back;
action out Animation_Show(T : string; M : integer; C : string);
end user_interface;
To see the changes in context, see uil-col.rpd.
STEP 2.
The second step was to translate the old user_interface behavior rules into
executable module syntax. Examples are shown below.
Old behavior rules:
begin
start ||>
UIL.start_java();;
PB.JavaStartup() ||>
UIL.join_discussion_session_1();;
New module syntax:
parallel
when start() do
UIL.start_java(default_id);
end;
||
when PB.JavaStartup() do
UIL.join_discussion_session_1(default_id);
end;
||
...
This new module syntax appears in module1.rpd
and module2.rpd. The modules
themselves are defined similarly to architectures in that they are declared
to be of a particular interface type as shown below.
module User_Module_1() return user_interface is
Two user modules were created. The only difference between the two is that
they pass different diagram ID's when they open an inquiry diagram (this
primarily tests the diagram-ID logic of Part 9). (Note that we are still
working on this model, and the primary purpose of this exercise was to
create a framework for different module behaviors (i.e., modules); it was
not so important to make them actually behave differently.)
STEP 3.
The third step was to change the user array in lrdc_arch (lrdc.rpd) to
use the newly defined modules rather than the default user_interface.
Differences between the old and new user-array declarations are shown below.
Old Array Declaration:
UI : array [integer] of user_interface is
(1..Num_Clients, default is New(user_interface));
New Array Declaration:
UI : array [integer] of user_interface is
(1..Num_Clients, User_Module_1(), User_Module_2(), User_Module_1(),
default is User_Module_2());
Note: The number of clients, Num_Clients, is three, but only two modules
were defined (for no good reason--we are still working on this model).
ADDITION: Animation_Show events
We decided to incorporate another advanced Raptor animation feature,
the Animation_Show event. Animation_Show events allow the display of
highlighted text within a particular module. Normally this is used to
describe the internal state of the module. In this case, we decided it
would be helpful to display which action a particular user is performing.
Unlike the .arch code required to set event colors or make modules invisible,
Animation_Show events are incorporated into the Rapide code itself.
The syntax is simple, parameters include a string, length of display time,
and color of highlighted box; e.g.,
Animation_Show("Join Discussion 2", 2, "black");
To view the effect of Animation_Show events, type the command:
raptor -a threeclient.arch lrdc.log
[
Back to the Index |
Prev]