de.cau.cs.kieler.synccharts.s
Class Helper

java.lang.Object
  extended by de.cau.cs.kieler.synccharts.s.Helper

public final class Helper
extends Object

The Helper class provides some helping functions for the generation of code.

Rating proposed yellow
(2010-06-14)

Method Summary
static List<Signal> allSignals(State state)
          Computes a list of all signals (global and local) that are used in the state and his child-states.
static List<StatePlusTransition> computeThreadPriorities(State state)
          Computes a list with all states in the right order of their priority.
static void debug(String s)
          A simple method to print debug information.
static void error(String s)
          A method to throw an error.
static int getMaxPriority()
          Returns the number of computed Threads without optimization of priorities.
static int getOptimizedWeakThreadPriority(State state)
          Computes the weak optimized priority of the given state.
static int getRealOptimizedThreadPriority(State state)
          Computes the real optimized priority of the given state.
static int getRealThreadPriority(State state)
          Computes the real priority of the given state.
static int getSmallestThreadPriority(State state)
          Computes the real priority of the given state.
static String getStateNameByFlag(State state, Integer flag)
          Returns unique a label for a state independent on the flag.
static List<StateAndSignals> getStateSignals(State state)
          Not used?
static int getWeakThreadPriority(State state)
          Computes the weak priority of the given state.
static boolean hasDependentState(Transition transition)
          Computes if the given state has signal dependent states.
static boolean isSignalDependent(Transition transition)
          Computes if the given state has signal dependent states.
static List<State> sortStateControlFlow(State state)
          Computes a sorted list with states.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

computeThreadPriorities

public static List<StatePlusTransition> computeThreadPriorities(State state)
Computes a list with all states in the right order of their priority.

Parameters:
state - the root state to start with
Returns:
a sorted list (by priority) of states

getRealThreadPriority

public static int getRealThreadPriority(State state)
Computes the real priority of the given state.

Parameters:
state - the state you want to get the priority
Returns:
priority of the state

getRealOptimizedThreadPriority

public static int getRealOptimizedThreadPriority(State state)
Computes the real optimized priority of the given state.

Parameters:
state - the state you want to get the priority
Returns:
priority of the state

getSmallestThreadPriority

public static int getSmallestThreadPriority(State state)
Computes the real priority of the given state.

Parameters:
state - the state you want to get the priority
Returns:
priority of the state

getWeakThreadPriority

public static int getWeakThreadPriority(State state)
Computes the weak priority of the given state.

Parameters:
state - the state you want to get the priority
Returns:
priority of the state

getOptimizedWeakThreadPriority

public static int getOptimizedWeakThreadPriority(State state)
Computes the weak optimized priority of the given state.

Parameters:
state - the state you want to get the priority
Returns:
priority of the state

debug

public static void debug(String s)
A simple method to print debug information.

Parameters:
s - debug information

error

public static void error(String s)
                  throws KiemInitializationException
A method to throw an error.

Parameters:
s - error information
Throws:
KiemInitializationException - for error handling

sortStateControlFlow

public static List<State> sortStateControlFlow(State state)
Computes a sorted list with states. The order of the list is the control flow of all states in a region beginning with the initial one.

Parameters:
state - the initial state to start with
Returns:
a list, sorted by the control flow in the SyncChart

allSignals

public static List<Signal> allSignals(State state)
Computes a list of all signals (global and local) that are used in the state and his child-states.

Parameters:
state - the state in which signals should be listed
Returns:
a list of all signals in the states and child-states

getStateNameByFlag

public static String getStateNameByFlag(State state,
                                        Integer flag)
Returns unique a label for a state independent on the flag.

Parameters:
state - the state for which a label should be generated
flag - what kind of label is desired
Returns:
unique label for a state TODO: Implement the cases LABEL_ANY_ID and LABEL_SHORTEST_HIERARCHIE

getStateSignals

public static List<StateAndSignals> getStateSignals(State state)
Not used?

Parameters:
state - nut used?
Returns:
not used?

hasDependentState

public static boolean hasDependentState(Transition transition)
Computes if the given state has signal dependent states.

Parameters:
transition - transition to search for dependencies
Returns:
true if the state has signal dependencies otherwise false

isSignalDependent

public static boolean isSignalDependent(Transition transition)
Computes if the given state has signal dependent states.

Parameters:
transition - transition to search for dependencies
Returns:
true if the transition is signal dependent otherwise false

getMaxPriority

public static int getMaxPriority()
Returns the number of computed Threads without optimization of priorities.

Returns:
max threads