ptolemy.verification.kernel
Class MathematicalModelConverter

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.util.Attribute
          extended by ptolemy.verification.kernel.MathematicalModelConverter
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

public class MathematicalModelConverter
extends Attribute

Since:
Ptolemy II 8.0
Version:
$Id: MathematicalModelConverter.java,v 1.5 2008/03/06 09:16:22 patrickj Exp $
Author:
Chihhong Patrick Cheng (modified by: Kyungmin Bae) Contributors: Edward A. Lee , Christopher Brooks,
See Also:
Serialized Form
Accepted Rating:
Red (patrickj)
Proposed Rating:
Red (patrickj)

Nested Class Summary
static class MathematicalModelConverter.FormulaType
           
static class MathematicalModelConverter.ModelType
           
static class MathematicalModelConverter.OutputType
           
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
protected  java.io.File _codeFile
          The name of the file that was written.
protected  java.io.File _directory
           
protected  CompositeEntity _model
          The model we for which we are generating code.
 Parameter buffer
           
 StringParameter formula
           
 ChoiceParameter formulaType
           
 ChoiceParameter modelType
           
 ChoiceParameter outputType
           
 Parameter span
           
 FileParameter target
           
 FileParameter template
           
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Constructor Summary
MathematicalModelConverter(NamedObj container, java.lang.String name)
          Create a new instance of the code generator.
 
Method Summary
private  void _deleteFolder(java.io.File folder)
          This is used to delete recursively the folder and files within.
 java.lang.StringBuffer generateCode(MathematicalModelConverter.ModelType modelType, java.lang.String inputTemporalFormula, MathematicalModelConverter.FormulaType formulaType, int variableSpanSize, int delayActorBufferSize)
           
 java.lang.StringBuffer generateFile(java.io.File file, MathematicalModelConverter.ModelType modelType, java.lang.String inputTemporalFormula, MathematicalModelConverter.FormulaType formulaType, int variableSpanSize, MathematicalModelConverter.OutputType outputChoice, int FSMBufferSize)
          Generate the model description for the system.
 java.lang.String generateGraphicalSpec(MathematicalModelConverter.FormulaType formulaType)
          This is the main entry point to generate the graphical specification of the system.
 java.io.File getCodeFile()
           
 
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, clone, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setContainer, setName, updateContent
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _description, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_codeFile

protected java.io.File _codeFile
The name of the file that was written. If no file was written, then the value is null.


_directory

protected java.io.File _directory

_model

protected CompositeEntity _model
The model we for which we are generating code.


target

public FileParameter target

template

public FileParameter template

modelType

public ChoiceParameter modelType

formulaType

public ChoiceParameter formulaType

outputType

public ChoiceParameter outputType

formula

public StringParameter formula

span

public Parameter span

buffer

public Parameter buffer
Constructor Detail

MathematicalModelConverter

public MathematicalModelConverter(NamedObj container,
                                  java.lang.String name)
                           throws IllegalActionException,
                                  NameDuplicationException
Create a new instance of the code generator.

Parameters:
container - The container.
name - The name of the code generator.
Throws:
IllegalActionException - If the super class throws the exception or error occurs when setting the file path.
NameDuplicationException - If the super class throws the exception or an error occurs when setting the file path.
Method Detail

generateCode

public java.lang.StringBuffer generateCode(MathematicalModelConverter.ModelType modelType,
                                           java.lang.String inputTemporalFormula,
                                           MathematicalModelConverter.FormulaType formulaType,
                                           int variableSpanSize,
                                           int delayActorBufferSize)
                                    throws IllegalActionException,
                                           NameDuplicationException,
                                           java.lang.CloneNotSupportedException
Throws:
IllegalActionException
NameDuplicationException
java.lang.CloneNotSupportedException

generateFile

public java.lang.StringBuffer generateFile(java.io.File file,
                                           MathematicalModelConverter.ModelType modelType,
                                           java.lang.String inputTemporalFormula,
                                           MathematicalModelConverter.FormulaType formulaType,
                                           int variableSpanSize,
                                           MathematicalModelConverter.OutputType outputChoice,
                                           int FSMBufferSize)
                                    throws IllegalActionException,
                                           NameDuplicationException,
                                           java.lang.CloneNotSupportedException,
                                           java.io.IOException
Generate the model description for the system. This is the main entry point.

Returns:
Textual format of the converted model based on the specification given.
Throws:
IllegalActionException
NameDuplicationException
java.lang.CloneNotSupportedException
java.io.IOException

generateGraphicalSpec

public java.lang.String generateGraphicalSpec(MathematicalModelConverter.FormulaType formulaType)
                                       throws IllegalActionException
This is the main entry point to generate the graphical specification of the system. It would invoke SMVUtility.generateGraphicalSpecification and return the specification.

Parameters:
formulaType - The type of the graphical specification. It may be either "Risk" or "Reachability".
Returns:
The textual format of the graphical specification.
Throws:
IllegalActionException

getCodeFile

public java.io.File getCodeFile()

_deleteFolder

private void _deleteFolder(java.io.File folder)
                    throws IllegalActionException,
                           java.io.IOException
This is used to delete recursively the folder and files within.

Throws:
IllegalActionException
java.io.IOException