#**#### TypeOf[ ${elem} ] := de.uni_paderborn.fujaba.uml.behavior.UMLStatechart
#**#### TypeOf[ ${children} ] := java.lang.String
#**#### TypeOf[ ${transitions} ] := java.lang.String
#**#### TypeOf[ ${methods} ] := java.lang.String
#**#### TypeOf[ ${utility} ] := de.uni_kassel.fujaba.codegen.Utility
#**##set( $statechart = $elem )
#**##set( $name = $statechart.Name )
#**##set( $theClass = $statechart.ParentElement )
#**#### TypeOf[ ${theClass} ] := de.uni_paderborn.fujaba.metamodel.structure.FClass
#**##set( $className = $theClass.Name )
#**##set( $statechartVars = $utility.getStatechartVars() )
#**##set( $statechartClassConstructor = $theClass.getFromMethodsByShortName($className) )
#**##set( $return = $imports.addToImports("de.upb.tools.sdm.*") )
#**##set( $children = $utility.indent("   ",$!children) )
#**##set( $transitions = $utility.indent("   ",$!transitions) )
#**#
#**#// create attributes for all objects in all states of this statechart
#**##foreach( $stateVar in $statechartVars.keySet() )
#*   *#private $statechartVars.get($stateVar) $stateVar;
#**##end

public void start()
{
   initStateChart();
   // call doAction on initial state
   ${utility.downFirstChar("$statechart.getInitialState()")}.doAction();
}

public void start(FAction parent)
{
   initStateChart();
   //set parent of rootState
   ${utility.downFirstChar("$statechart.getInitialState()")}.setToParent(parent);
   // call doAction on rootState
   ${utility.downFirstChar("$statechart.getInitialState()")}.doAction();
}

// GWT statechart code
public void initStateChart()
{
   if(${utility.downFirstChar("$statechart.getInitialState()")} != null)
      return;

$!children##
$!transitions##
}

$!methods##
