Difference between revisions of "Wristwatch Example"
(→Download the Wrist Watch Example) |
|||
Line 103: | Line 103: | ||
===Wristwatch final application (runnable jar)=== | ===Wristwatch final application (runnable jar)=== | ||
[[Media:WristWatchExampleSwingGUI.zip|Runnable Wrist Watch with Swing GUI]] <br> [[Media:WristWatchExampleSystemModelGUI.zip|Runnable Wrist Watch with the auto generated System Model GUI]] <br> | [[Media:WristWatchExampleSwingGUI.zip|Runnable Wrist Watch with Swing GUI]] <br> [[Media:WristWatchExampleSystemModelGUI.zip|Runnable Wrist Watch with the auto generated System Model GUI]] <br> | ||
− | + | ||
To run the wristwatch, simply extract the downloaded zip and double click the jar file. | To run the wristwatch, simply extract the downloaded zip and double click the jar file. | ||
Revision as of 08:09, 20 February 2013
The wristwatch example is originally from [1]. Generally, the watch displays the time and can switch between different displays that show (and allow changes to) the alarm, date, time and stopwatch. It has an option for turning on the light, and an alarm that beeps when the set time is reached. The following examples demonstrate many constructs in the LSC language and the way they are created in natural lanague play-in, it was originally created in [2]
Contents
Requirements
Watch Modes
when the user clicks the d_button, if the display mode is time, the display mode changes to date, otherwise if the display mode is date, the display mode changes to time. (demonstrates if-else). | |
when the user clicks the a_button, if the display mode is time, the display mode changes to alarm, otherwise if the display mode is alarm, the display mode changes to chime, otherwise if the display mode is chime, the display mode changes to stopwatch, otherwise if the display mode is stopwatch, the display mode changes to time. | |
when the user clicks the c_button , if the display mode is alarm then the display mode changes to "alarm minutes" , otherwise if the display mode is "alarm minutes" then the display mode changes to "alarm hours" , otherwise if the display mode is "alarm hours" then the display mode changes to alarm. | |
when the user clicks the b_button, if the display mode is “alarm minutes”, the display mode changes to alarm. | |
when the user clicks the b_button, if the display mode is “alarm hours” , the display mode changes to alarm. | |
when the user clicks the a_button , if the display mode is "alarm minutes" , the alarm increases in one minute , otherwise if the display mode is "alarm hours" , the alarm increases by one hour. | |
when the user clicks the c_button , if the display mode is time , the display mode changes to update and the update type changes to seconds. |
Updates
when the user clicks the c_button , if the update type is seconds , the update type changes to minutes otherwise if the update type is minutes , the update type changes to hours otherwise if the update type is hours , the update type changes to date otherwise if the update type is date, the display mode changes to time and the update type changes to none. | |
when the update type changes , if the update type equals seconds , the display blinks seconds , otherwise if the update type equals minutes , the display blinks minutes , otherwise the display blinks none. | |
when the update type changes, the display mode changes to update. |
Time
when the clock ticks, the time increases by one second. | |
when the time value changes, if the display mode is time, the display text changes to time value. (demonstrates a property change as a trigger). |
Light
when the user clicks the b_button, if the light state is on , the light state turns to off , otherwise if the light state is off , the light state turns to on. |
Alarm
when the time value changes , if the time value equals the alarm value and the alarm state is enabled then the beeper state turns to on. | |
when the user clicks the d_button , if the display mode is alarm , if the alarm state is enabled , the alarm state changes to disabled otherwise the alarm state changes to enabled. | |
when the display mode changes , if the display mode equals "alarm minutes" , the display blinks in minutes , otherwise if the display mode equals "alarm hours" , the display blinks in hours , otherwise the display blinks in none. | |
when the beeper state changes to on, as long as the beeper state is on and two seconds elapse, the beeper beeps, the display mode may not change. (demonstrates loop and forbidden element). | |
when the user clicks any WButton , the beeper state turns to off. (demonstrates symbolic \ non-deterministic objects). | |
when the display mode changes to alarm, the display text changes to the alarm value. |
Date
when the display mode changes to date, the display text changes to the date value . |
Download the Wrist Watch Example
Below are downloads of the wrist watch final application, as well as of the LSC project that can be opened and modified in PlayGo.
Wristwatch final application (runnable jar)
Runnable Wrist Watch with Swing GUI
Runnable Wrist Watch with the auto generated System Model GUI
To run the wristwatch, simply extract the downloaded zip and double click the jar file.
Wristwatch LSC project
The Wrist Watch LSC Project (for development purposes)
Installation Instructions
- Extract the downloaded zip.
- Download PlayGo.
- Import the downloaded project to your workspace:
- From the File menu choose Import-->General-->Existing Projects into Workspace
- Click the 'Next' button
- When prompted, select the directory to which you extracted the downloaded wrist watch example
- Click finish
- The wrist watch example project is now part of your workspace. You can start playing with it. For details refer to how to play out.
Installation Instructions
- For the Runnable Wrist Watch downloads, simply extract the downloaded zip and double click the jar file.
- For the PlayGo project, follow these instructions:
- Extract the downloaded zip.
- Download PlayGo.
- Import the downloaded project to your workspace:
- From the File menu choose Import-->General-->Existing Projects into Workspace
- Click the 'Next' button
- When prompted, select the directory to which you extracted the downloaded wrist watch example
- Click finish
- The wrist watch example project is now part of your workspace. You can start playing with it. For details refer to how to play out.