org.malai.interaction
Class TimeoutTransition

java.lang.Object
  extended by org.malai.interaction.Transition
      extended by org.malai.interaction.TimeoutTransition
All Implemented Interfaces:
ITransition

public class TimeoutTransition
extends Transition

This transition defines a timeout: when the user does nothing during a given duration, the timeout transition is executed.

This file is part of Malai.
Copyright (c) 2009-2012 Arnaud BLOUIN

Malai is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
Malai is distributed without any warranty; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

11/01/2011

Since:
0.2
Author:
Arnaud BLOUIN

Nested Class Summary
(package private)  class TimeoutTransition.TimeoutRunnable
          A TimeoutRunnable defines the executable part of the thread which is thrown when the chronometre of the transition is launched.
 
Field Summary
protected  int timeout
          The timeout in ms.
private  java.lang.Thread timeoutThread
          The current thread in progress.
 
Fields inherited from class org.malai.interaction.Transition
hid, inputState, outputState
 
Constructor Summary
TimeoutTransition(SourceableState inputState, TargetableState outputState, int timeout)
          Creates the transition.
 
Method Summary
 int getTimeout()
           
 void setTimeout(int timeout)
           
 void startTimeout()
          Launches the chronometre (and its thread).
 void stopTimeout()
          Stops the chronometre (and its thread).
 
Methods inherited from class org.malai.interaction.Transition
action, getHid, getInputState, getOutputState, isGuardRespected, setHid, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

timeout

protected int timeout
The timeout in ms.


timeoutThread

private java.lang.Thread timeoutThread
The current thread in progress.

Constructor Detail

TimeoutTransition

public TimeoutTransition(SourceableState inputState,
                         TargetableState outputState,
                         int timeout)
Creates the transition.

Parameters:
inputState - The source state of the transition.
outputState - The target state of the transition.
timeout - The timeout in ms. Must be greater than 0.
Throws:
java.lang.IllegalArgumentException - If one of the given parameters is null or not valid.
Since:
0.2
Method Detail

startTimeout

public void startTimeout()
Launches the chronometre (and its thread).

Since:
0.2

stopTimeout

public void stopTimeout()
Stops the chronometre (and its thread).

Since:
0.2

setTimeout

public void setTimeout(int timeout)
Parameters:
timeout - The timeout in ms. Must be greater than 0.
Since:
0.2

getTimeout

public int getTimeout()
Returns:
The timeout in ms.
Since:
0.2