public final class SmcFSM extends SmcElement
SmcElement.TransType
_lineNumber, _name, NIL_STATE
Constructor and Description |
---|
SmcFSM(java.lang.String name,
java.lang.String targetFile)
Creates a finite state machine of the given name.
|
Modifier and Type | Method and Description |
---|---|
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.lang.String |
getTargetFileName()
Returns the target file 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)
Sets the fsm class name.
|
void |
setFsmTargetFile(java.lang.String fileName)
Sets the FSM 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.
|
getLineNumber, getName, merge
public SmcFSM(java.lang.String name, java.lang.String targetFile)
name
- The finite state machine name.targetFile
- The target filename with suffix.public void accept(SmcVisitor visitor)
accept
in class SmcElement
visitor
- The visitor instance.SmcVisitor
public java.lang.String getSource()
public int getHeaderLine()
public java.lang.String getStartState()
public java.lang.String getContext()
public java.lang.String getSourceFileName()
public java.lang.String getTargetFileName()
public java.lang.String getFsmClassName()
public java.lang.String getHeader()
public java.util.List<java.lang.String> getIncludes()
public java.lang.String getPackage()
public java.util.List<java.lang.String> getImports()
public int getImportCount()
public int getDeclareCount()
public java.util.List<java.lang.String> getDeclarations()
public java.lang.String getAccessLevel()
public SmcMap findMap(java.lang.String name)
null
.name
- map name.public java.util.List<SmcMap> getMaps()
public java.util.List<SmcTransition> getTransitions()
public boolean hasEntryActions()
public boolean hasExitActions()
true
if there is at least one state in the
state machine which has an exit action; false
otherwise.true
if there is at least one state in the
state machine which has an exit action; false
otherwise.public void setSource(java.lang.String source)
source
- the raw target source code.public void setHeaderLine(int lineNumber)
lineNumber
- the .sm source file line.public void setStartState(java.lang.String state)
state
- start state name.public void setContext(java.lang.String context)
context
- class name.public void setFsmClassName(java.lang.String fsmName)
fsmName
- The finite state machine's class name.public void setFsmTargetFile(java.lang.String fileName)
fileName
- the finite state machine file name.public void setHeader(java.lang.String header)
header
- header file name.public void addInclude(java.lang.String includeFile)
includeFile
- an include file name.public void setPackage(java.lang.String pkg)
pkg
- package/namespace name.public void addImport(java.lang.String name)
name
- an imported name.public void addDeclare(java.lang.String name)
name
- a forward declared name.public void setAccessLevel(java.lang.String accessLevel)
accessLevel
- a Java and or C# access level.public void addMap(SmcMap map)
map
- a finite state machine map.public void dump(java.io.PrintStream stream)
stream
- write this state machine to this stream.Copyright © 2015. Charles W. Rapp. All Rights Reserved. Use is subject to license terms.