CIS 700 Project : ACSR Code Generation |
Taehyun Kim, Su-Ting Chuang |
STOPWATCH = (SWATCH || FRACT(0) || SEC(0) || MIN(0) || HR(0)) \ {incrementFract, incrementSec, incrementMin, incrementHr} |
FRACT(f) = (incrementFract?, 1). ((f < 9) -> FRACT(f+1) + (f = 9) -> (incrementSec!, 1). FRACT(0)) SEC(s) = (incrementSec?, 1). ((s < 59) -> SEC(s + 1) + (s = 59) -> (incrementMin!, 1). SEC(0)) MIN(m) = (incrementMin?, 1). ((m < 59) -> MIN(m + 1) + (m = 59) -> (incrementHr!, 1). MIN(0)) HR(h) = (incrementHr?, 1). ((h < 23) -> HR(h + 1) + (h = 23) -> HR(0)) |
SWATCH = READY READY = (start, 1). RUNNING RUNNING = {{timer, 2}}: (incrementFract!, 1). RUNNING + (pause, 1). PAUSED + (stop, 1). STOPPED PAUSED = (resume, 1). RUNNING + (stop, 1). STOPPED STOPPED = (reset, 1). READY |
Description : acsr.pdf |
Source code (JavaAppVersion) : Stopwatch StopwatchDisplay |
JavaDoc : StopwatchDoc |
CIS • University of Pennsylvania |