|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnz.ac.waikato.modeljunit.examples.AlarmClock
public class AlarmClock
Field Summary | |
---|---|
int |
alarmTimer
The time that the alarm will go off. |
int |
currentTime
The current time of the clock |
Constructor Summary | |
---|---|
AlarmClock()
|
Method Summary | |
---|---|
void |
alarmOff()
|
boolean |
alarmOffGuard()
|
void |
alarmOn()
|
boolean |
alarmOnGuard()
|
void |
cancelAlarm()
|
boolean |
cancelAlarmGuard()
|
int |
getNextTimeIncrement()
Function used to get the amount of time to move forward the next time that the time is incremented. |
java.lang.Object |
getState()
Return the current state of the FSM model. |
static void |
main(java.lang.String[] args)
|
void |
printAction(java.lang.String action)
|
void |
reset(boolean testing)
Reset the model to its initial state. |
void |
setAlarm()
|
boolean |
setAlarmGuard()
Guard for the setAlarm action, only allows the action to occur if the alarm is not currently set |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public int alarmTimer
public int currentTime
Constructor Detail |
---|
public AlarmClock()
Method Detail |
---|
public java.lang.Object getState()
FsmModel
Advanced Feature: This method can be used to define
equivalence classes over the states, if you want to reduce
the number of states to keep the FSM small.
For example, if you have a integer state variable I that can
have a huge number of possible values, you could define your
getState() method to return new Integer(I % 10)
.
This would reduce the FSM to just 10 states, where FSM state 0
represents all the states where I=0 or I=10 or I=20 etc., and
FSM state 1 represents all the states where I=1 or I=11 or I=21 etc.
getState
in interface FsmModel
public void reset(boolean testing)
FsmModel
reset
in interface FsmModel
testing
- true means the SUT should be reset too.public boolean setAlarmGuard()
public void setAlarm()
public boolean cancelAlarmGuard()
public void cancelAlarm()
public boolean alarmOnGuard()
public void alarmOn()
public boolean alarmOffGuard()
public void alarmOff()
public int getNextTimeIncrement()
TimedFsmModel
getNextTimeIncrement
in interface TimedFsmModel
public void printAction(java.lang.String action)
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |