simulink

edu.tum.cs.simulink.model
Class SimulinkModel

java.lang.Object
  extended by edu.tum.cs.simulink.model.ParameterizedElement
      extended by edu.tum.cs.simulink.model.SimulinkElementBase
          extended by edu.tum.cs.simulink.model.SimulinkBlock
              extended by edu.tum.cs.simulink.model.SimulinkModel

public class SimulinkModel
extends SimulinkBlock

A Simulink model a specialized Simulink block that primarily maintains the default parameters of blocks, annotations and lines. See the package documentation for details on the parameter mechanism.

Version:
$Rev: 26285 $
Author:
hummelb, $Author: juergens $
Rating:
GREEN Hash: 3CF95158690744EE5981BAF8E395EE3F

Constructor Summary
  SimulinkModel(java.io.File file, boolean isLibrary)
          Create new model.
protected SimulinkModel(SimulinkModel origModel)
          This copy constructor clones the whole model.
 
Method Summary
 SimulinkModel deepClone()
          Deep clone this model.
 java.lang.String getAnnotationDefaultParameter(java.lang.String name)
          Get default annotation parameter.
  getAnnotationDefaultParameterNames()
          Get names of annotation default parameters.
 SimulinkBlock getBlock(java.lang.String id)
          Get a block specified by its full qualified name.
 java.lang.String getBlockDefaultParameter(java.lang.String name)
          Get block default parameter.
  getBlockDefaultParameterNames()
          Get names of block default parameters.
 java.util.Set<java.lang.String> getBlockDefaultParameterNames(java.lang.String type)
          Get all default parameter names for a given type.
 java.lang.String getId()
          Returns the name of the model.
 java.lang.String getLineDefaultParameter(java.lang.String name)
          Get default line parameter.
  getLineDefaultParameterNames()
          Get default line parameter names.
 SimulinkModel getModel()
          Returns itself.
 StateflowMachine getStateflowMachine()
          Get Stateflow machine of this model (may be null).
 java.lang.String getType()
          Returns SimulinkConstants.TYPE_Model.
 java.lang.String getTypeBlockDefaultParameter(java.lang.String type, java.lang.String name)
          Get named default parameter for a given type.
 boolean isLibrary()
          Is this model a library?
 void setAnnotationDefaultParameter(java.lang.String name, java.lang.String value)
          Set annotation default parameter.
 void setBlockDefaultParameter(java.lang.String name, java.lang.String value)
          Set a default parameter for all blocks.
 void setBlockTypeDefaultParameter(java.lang.String type, java.lang.String name, java.lang.String value)
          Set default parameter for blocks of a specified type.
 void setLineDefaultParameter(java.lang.String name, java.lang.String value)
          Set default parameter for lines.
protected  void setParent(SimulinkBlock parent)
          This throws a UnsupportedOperationException as models cannot have parents.
 void setStateflowMachine(StateflowMachine machine)
          Set Stateflow machine.
 
Methods inherited from class edu.tum.cs.simulink.model.SimulinkBlock
addAnnotation, addSubBlock, getAnnotations, getInLines, getInPort, getInPorts, getOutLines, getOutPort, getOutPorts, getResolvedType, getSubBlock, getSubBlocks, hasSubBlocks, remove, toString
 
Methods inherited from class edu.tum.cs.simulink.model.SimulinkElementBase
getName, getParent
 
Methods inherited from class edu.tum.cs.simulink.model.ParameterizedElement
getDeclaredParameter, getDeclaredParameterNames, getParameter, getParameterNames, setParameter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimulinkModel

public SimulinkModel(java.io.File file,
                     boolean isLibrary)
Create new model.

Parameters:
file - the file this model is stored in

SimulinkModel

protected SimulinkModel(SimulinkModel origModel)
                 throws DeepCloneException
This copy constructor clones the whole model.

Throws:
DeepCloneException
Method Detail

setAnnotationDefaultParameter

public void setAnnotationDefaultParameter(java.lang.String name,
                                          java.lang.String value)
Set annotation default parameter.


setBlockDefaultParameter

public void setBlockDefaultParameter(java.lang.String name,
                                     java.lang.String value)
Set a default parameter for all blocks.


setBlockTypeDefaultParameter

public void setBlockTypeDefaultParameter(java.lang.String type,
                                         java.lang.String name,
                                         java.lang.String value)
Set default parameter for blocks of a specified type.


setLineDefaultParameter

public void setLineDefaultParameter(java.lang.String name,
                                    java.lang.String value)
Set default parameter for lines.


deepClone

public SimulinkModel deepClone()
                        throws DeepCloneException
Deep clone this model.

Overrides:
deepClone in class SimulinkBlock
Throws:
DeepCloneException

getAnnotationDefaultParameter

public java.lang.String getAnnotationDefaultParameter(java.lang.String name)
Get default annotation parameter.


getAnnotationDefaultParameterNames

public  getAnnotationDefaultParameterNames()
Get names of annotation default parameters.


getBlock

public SimulinkBlock getBlock(java.lang.String id)
Get a block specified by its full qualified name. The name must start with the models name. This returns null if the block was not found.


getBlockDefaultParameter

public java.lang.String getBlockDefaultParameter(java.lang.String name)
Get block default parameter.


getTypeBlockDefaultParameter

public java.lang.String getTypeBlockDefaultParameter(java.lang.String type,
                                                     java.lang.String name)
Get named default parameter for a given type. If a type-specific parameter is defined, it is returned. Otherwise the block default (getBlockDefaultParameter(String)) is returned.


getBlockDefaultParameterNames

public  getBlockDefaultParameterNames()
Get names of block default parameters.


getBlockDefaultParameterNames

public java.util.Set<java.lang.String> getBlockDefaultParameterNames(java.lang.String type)
Get all default parameter names for a given type. This includes the block defaults (getBlockDefaultParameterNames()).


getId

public java.lang.String getId()
Returns the name of the model.

Overrides:
getId in class SimulinkElementBase

getLineDefaultParameter

public java.lang.String getLineDefaultParameter(java.lang.String name)
Get default line parameter.


getLineDefaultParameterNames

public  getLineDefaultParameterNames()
Get default line parameter names.


getModel

public SimulinkModel getModel()
Returns itself.

Overrides:
getModel in class SimulinkElementBase

getStateflowMachine

public StateflowMachine getStateflowMachine()
Get Stateflow machine of this model (may be null).


getType

public java.lang.String getType()
Returns SimulinkConstants.TYPE_Model.

Overrides:
getType in class SimulinkBlock

isLibrary

public boolean isLibrary()
Is this model a library?


setStateflowMachine

public void setStateflowMachine(StateflowMachine machine)
Set Stateflow machine. This is not expected to be called by the user, but only by the constructors of StateflowMachine.

Throws:
PreconditionException - if this model already has a machine of if the machine does not belong to this model.

setParent

protected void setParent(SimulinkBlock parent)
This throws a UnsupportedOperationException as models cannot have parents.

Overrides:
setParent in class SimulinkElementBase

simulink

simulink - 2.7