org.malai.interaction
Class Transition

java.lang.Object
  extended by org.malai.interaction.Transition
All Implemented Interfaces:
ITransition
Direct Known Subclasses:
ButtonPressedTransition, CheckBoxTransition, KeyboardTransition, ListTransition, MenuItemTransition, PointingDeviceTransition, SpinnerTransition, TabSelectedTransition, TextChangedTransition, TimeoutTransition, WindowClosedTransition

public abstract class Transition
extends java.lang.Object
implements ITransition

A transition links two states of a state machine if a given condition is respected. Actions can be performed when executing the transition.

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.

06/01/2010

Since:
0.1
Author:
Arnaud BLOUIN

Field Summary
protected  int hid
          The ID of the HID that produced the transition.
protected  SourceableState inputState
          The source state.
protected  TargetableState outputState
          The target state.
 
Constructor Summary
Transition(SourceableState inputState, TargetableState outputState)
          Defines a transition.
 
Method Summary
 void action()
          Performs the actions to do when the transition is executed.
 int getHid()
           
 SourceableState getInputState()
           
 TargetableState getOutputState()
           
 boolean isGuardRespected()
           
 void setHid(int hid)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

inputState

protected SourceableState inputState
The source state.


outputState

protected TargetableState outputState
The target state.


hid

protected int hid
The ID of the HID that produced the transition.

Constructor Detail

Transition

public Transition(SourceableState inputState,
                  TargetableState outputState)
Defines a transition.

Parameters:
inputState - The source state of the transition.
outputState - The target state of the transition.
Throws:
java.lang.IllegalArgumentException - If one of the given parameters is null or not valid.
Since:
0.1
Method Detail

action

public void action()
Description copied from interface: ITransition
Performs the actions to do when the transition is executed. Should be overridden.

Specified by:
action in interface ITransition

isGuardRespected

public boolean isGuardRespected()
Specified by:
isGuardRespected in interface ITransition
Returns:
True: the condition defining if the transition can be executed is correct. By default: true. Should be overridden.

getInputState

public SourceableState getInputState()
Specified by:
getInputState in interface ITransition
Returns:
The source state of the transition.

getOutputState

public TargetableState getOutputState()
Specified by:
getOutputState in interface ITransition
Returns:
The target state of the transition.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getHid

public int getHid()
Specified by:
getHid in interface ITransition
Returns:
The ID of the HID that produced the transition.

setHid

public void setHid(int hid)
Specified by:
setHid in interface ITransition
Parameters:
hid - The ID of the HID that produced the transition.