SMC
6_0_1

net.sf.smc.model
Class SmcFSM

java.lang.Object
  extended by net.sf.smc.model.SmcElement
      extended by net.sf.smc.model.SmcFSM

public final class SmcFSM
extends SmcElement

The top-level element for a finite state machine model. Contains the global state machine data:


Nested Class Summary
 
Nested classes/interfaces inherited from class net.sf.smc.model.SmcElement
SmcElement.TransType
 
Field Summary
 
Fields inherited from class net.sf.smc.model.SmcElement
_lineNumber, _name, NIL_STATE
 
Constructor Summary
SmcFSM(java.lang.String name, java.lang.String sourceFile)
          Creates a finite state machine of the given name.
 
Method Summary
 void accept(SmcVisitor visitor)
          Calls the visitor's visit method for this finite state machine element.
 void addDeclare(java.lang.String name)
          Adds a forward declaration name.
 void addImport(java.lang.String name)
          Adds an import to the list.
 void addInclude(java.lang.String includeFile)
          Adds an include file name to the list.
 void addMap(SmcMap map)
          Adds a state machine map to the list.
 void dump(java.io.PrintStream stream)
          Writes this state machine configuration to the given stream.
 SmcMap findMap(java.lang.String name)
          Returns the named map.
 java.lang.String getAccessLevel()
          Returns the generated FSM class access level.
 java.lang.String getContext()
          Returns the context class name.
 java.util.List<java.lang.String> getDeclarations()
          Returns the forward declarations list.
 int getDeclareCount()
          Returns the number of forward declarations.
 java.lang.String getFsmClassName()
          Returns the fsm class name.
 java.lang.String getHeader()
          Returns the context class header file name.
 int getHeaderLine()
          Returns the current .sm header line being processed.
 int getImportCount()
          Returns the number of imports.
 java.util.List<java.lang.String> getImports()
          Returns the imported package and/or class list.
 java.util.List<java.lang.String> getIncludes()
          Returns the included header file list.
 java.util.List<SmcMap> getMaps()
          Returns the map list.
 java.lang.String getPackage()
          Returns the package/namespace name.
 java.lang.String getSource()
          Returns the raw %{, %} source code.
 java.lang.String getSourceFileName()
          Returns the source file name.
 java.lang.String getStartState()
          Returns the start state name.
 java.util.List<SmcTransition> getTransitions()
          Returns the list of all known transitions for all maps.
 boolean hasEntryActions()
           
 boolean hasExitActions()
          Returns true if there is at least one state in the state machine which has an exit action; false otherwise.
 void setAccessLevel(java.lang.String accessLevel)
          Sets the FSM class access level.
 void setContext(java.lang.String context)
          Set sthe context class name.
 void setFsmClassName(java.lang.String fsmName)
          Set sthe fsm class name and source file name.
 void setHeader(java.lang.String header)
          Sets the context class header file name.
 void setHeaderLine(int lineNumber)
          Set the .sm source file line being processed.
 void setPackage(java.lang.String pkg)
          Sets the package/namespace name.
 void setSource(java.lang.String source)
          Sets the raw source to be placed at the start of the generated target code source file.
 void setStartState(java.lang.String state)
          Sets the FSM start state name.
 
Methods inherited from class net.sf.smc.model.SmcElement
getLineNumber, getName, merge
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SmcFSM

public SmcFSM(java.lang.String name,
              java.lang.String sourceFile)
Creates a finite state machine of the given name. Data members are set to default values.

Parameters:
name - The finite state machine name.
Method Detail

accept

public void accept(SmcVisitor visitor)
Calls the visitor's visit method for this finite state machine element.

Specified by:
accept in class SmcElement
Parameters:
visitor - The visitor instance.
See Also:
SmcVisitor

getSource

public java.lang.String getSource()
Returns the raw %{, %} source code.

Returns:
the raw %{, %} source code.

getHeaderLine

public int getHeaderLine()
Returns the current .sm header line being processed.

Returns:
the current .sm header line being processed.

getStartState

public java.lang.String getStartState()
Returns the start state name.

Returns:
the start state name.

getContext

public java.lang.String getContext()
Returns the context class name.

Returns:
the context class name.

getSourceFileName

public java.lang.String getSourceFileName()
Returns the source file name.

Returns:
the source file name.

getFsmClassName

public java.lang.String getFsmClassName()
Returns the fsm class name.

Returns:
the fsm class name.

getHeader

public java.lang.String getHeader()
Returns the context class header file name.

Returns:
the context class header file name.

getIncludes

public java.util.List<java.lang.String> getIncludes()
Returns the included header file list.

Returns:
the included header file list.

getPackage

public java.lang.String getPackage()
Returns the package/namespace name.

Returns:
the package/namespace name.

getImports

public java.util.List<java.lang.String> getImports()
Returns the imported package and/or class list.

Returns:
the imported package and/or class list.

getImportCount

public int getImportCount()
Returns the number of imports.

Returns:
the number of imports.

getDeclareCount

public int getDeclareCount()
Returns the number of forward declarations.

Returns:
the number of forward declarations.

getDeclarations

public java.util.List<java.lang.String> getDeclarations()
Returns the forward declarations list.

Returns:
the forward declarations list.

getAccessLevel

public java.lang.String getAccessLevel()
Returns the generated FSM class access level. Used for Java and C#.

Returns:
the generated FSM class access level.

findMap

public SmcMap findMap(java.lang.String name)
Returns the named map. May return null.

Returns:
the named map.

getMaps

public java.util.List<SmcMap> getMaps()
Returns the map list.

Returns:
the map list.

getTransitions

public java.util.List<SmcTransition> getTransitions()
Returns the list of all known transitions for all maps.

Returns:
the list of all known transitions for all maps.

hasEntryActions

public boolean hasEntryActions()

hasExitActions

public boolean hasExitActions()
Returns true if there is at least one state in the state machine which has an exit action; false otherwise.

Returns:
true if there is at least one state in the state machine which has an exit action; false otherwise.

setSource

public void setSource(java.lang.String source)
Sets the raw source to be placed at the start of the generated target code source file.

Parameters:
source - the raw target source code.

setHeaderLine

public void setHeaderLine(int lineNumber)
Set the .sm source file line being processed.

Parameters:
lineNumber - the .sm source file line.

setStartState

public void setStartState(java.lang.String state)
Sets the FSM start state name.

Parameters:
state - start state name.

setContext

public void setContext(java.lang.String context)
Set sthe context class name.

Parameters:
context - class name.

setFsmClassName

public void setFsmClassName(java.lang.String fsmName)
Set sthe fsm class name and source file name.

Parameters:
fsmName - The finite state machine's class name.

setHeader

public void setHeader(java.lang.String header)
Sets the context class header file name.

Parameters:
header - header file name.

addInclude

public void addInclude(java.lang.String includeFile)
Adds an include file name to the list.

Parameters:
includeFile - an include file name.

setPackage

public void setPackage(java.lang.String pkg)
Sets the package/namespace name.

Parameters:
pkg - package/namespace name.

addImport

public void addImport(java.lang.String name)
Adds an import to the list.

Parameters:
name - an imported name.

addDeclare

public void addDeclare(java.lang.String name)
Adds a forward declaration name.

Parameters:
name - a forward declared name.

setAccessLevel

public void setAccessLevel(java.lang.String accessLevel)
Sets the FSM class access level.

Parameters:
accessLevel - a Java and or C# access level.

addMap

public void addMap(SmcMap map)
Adds a state machine map to the list.

Parameters:
map - a finite state machine map.

dump

public void dump(java.io.PrintStream stream)
Writes this state machine configuration to the given stream.

Parameters:
stream - write this state machine to this stream.

SMC
6_0_1

Copyright © 2009. Charles W. Rapp. All Rights Reserved. Use is subject to license terms.