public class ExecutionChoice extends Case implements ChangeListener, IOPortEventListener
Modifier and Type | Class and Description |
---|---|
static class |
ExecutionChoice.IOType
The types of input/outputs.
|
static class |
ExecutionChoice.ParameterType
The types of parameters.
|
CompositeEntity.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
StringParameter |
additionalOptions
Additional command line options.
|
static java.lang.String |
ALL_CHOICES_NAME
String constant to denote all execution choices.
|
static java.lang.String |
ARGUMENT_NAME
The name of the (optional) attribute contained in parameters.
|
Parameter |
checkOutputTimestamp
If true, verify the last modification timestamp for each
output file has increased after execution.
|
static java.lang.String |
COMMAND_LINE_NAME
The name of the command line parameter in each refinement.
|
static java.lang.String |
DEFAULT_INPUT_DIR_NAME
The name of the default input directory.
|
static java.lang.String |
DEFAULT_INPUT_FILE_NAME
The name of the default input file.
|
static java.lang.String |
DEFAULT_OUTPUT_DIR_NAME
The name of the default output directory.
|
static java.lang.String |
DEFAULT_OUTPUT_FILE_NAME
The name of the default output file.
|
static java.lang.String |
DEFAULT_TEMPLATE_NAME
The name of the default template.
|
StringParameter |
program
The command line program to execute.
|
_actorFiringListeners, _causalityInterface, _derivedPiggybacks, _initializables, _notifyingActorFiring, _piggybacks, _publishedPorts, _publisherRelations, _stopRequested, _subscribedPorts
_levelCrossingLinks
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
COMPLETED, NOT_READY, STOP_ITERATING
Constructor and Description |
---|
ExecutionChoice(CompositeEntity container,
java.lang.String name)
Create a new ExecutionChoice in a container with the
specified name.
|
ExecutionChoice(Workspace workspace)
Create a new ExecutionChoice in a workspace.
|
Modifier and Type | Method and Description |
---|---|
protected ExecutionChoiceDirector |
_createDirector()
Create a director.
|
protected void |
_setCurrentRefinement(Refinement refinement)
Set the refinement to execute.
|
void |
addDefaultExecutionChoice()
Add default execution choice if none are present.
|
boolean |
addDefaultInputsAndOutputs()
Add default inputs and outputs if none are present.
|
static boolean |
addDefaultInputsAndOutputs(ExecutionChoice choice)
Add default inputs and outputs if non are present for an ExecutionChoice.
|
void |
addDefaults() |
void |
attributeChanged(Attribute attribute)
React to a change in an attribute.
|
void |
changeExecuted(ChangeRequest change)
React to the fact that the change has been successfully executed
by doing nothing.
|
void |
changeFailed(ChangeRequest change,
java.lang.Exception exception)
React to the fact that the change has failed by reporting it.
|
java.lang.Object |
clone(Workspace workspace)
Override the base class to ensure that the member fields
are initialized.
|
void |
exportExecutionChoice(java.io.File saveFile,
java.lang.String name)
Export an execution choice to a file.
|
void |
fire()
Override the base class to not read inputs, since this has been
done in prefire().
|
static java.lang.String |
getArgument(NamedObj container,
java.lang.String name)
Get the command line argument for a parameter in a specific container
|
java.lang.String |
getArgument(java.lang.String name)
Get the command line argument for a parameter.
|
static StringParameter |
getArgumentParameter(NamedObj container,
java.lang.String name)
Get the parameter containing the command line argument for a parameter
in a specific container.
|
StringParameter |
getArgumentParameter(java.lang.String name)
Get the parameter containing the command line argument for a parameter.
|
java.util.List<java.lang.String> |
getExecutionChoiceNames()
Get a list of execution choice names.
|
java.util.List<java.lang.String> |
getInputNames()
Get a list of file input names.
|
java.util.List<java.lang.String> |
getInputNames(boolean includeData)
Get a list of input port names.
|
java.util.List<java.lang.String> |
getOutputNames()
Get a list of file output names.
|
java.util.List<java.lang.String> |
getOutputNames(boolean includeData)
Get a list of output port names.
|
java.util.List<java.lang.String> |
getParameterNames()
Get a list of parameter names.
|
static ExecutionChoice.ParameterType |
getParameterType(NamedObj container,
java.lang.String name)
Get the parameter type for a parameter in a container within this actor.
|
ExecutionChoice.ParameterType |
getParameterType(java.lang.String name)
Get the parameter type for a parameter.
|
static ExecutionChoice.IOType |
getPortIOType(Port port)
Get the IOType for a port.
|
java.util.Set<java.lang.String> |
getTemplateNames()
Get the available template names.
|
boolean |
hasInput(java.lang.String name)
Returns true if there is an input with the given name.
|
boolean |
hasOutput(java.lang.String name)
Returns true if there is an output with the given name.
|
Refinement |
newExecutionChoice(java.io.File templateFile,
java.lang.String refinementName)
Create a new execution choice from a file.
|
Refinement |
newExecutionChoice(java.lang.String templateName,
java.lang.String refinementName)
Create a new execution choice from a template.
|
void |
newInput(java.lang.String name,
ExecutionChoice.IOType type)
Create a new file input.
|
void |
newInput(java.lang.String name,
ExecutionChoice.IOType type,
java.lang.String argument)
Create a new file input.
|
void |
newOutput(java.lang.String name,
ExecutionChoice.IOType type)
Create a new file output.
|
void |
newOutput(java.lang.String name,
ExecutionChoice.IOType type,
java.lang.String argument)
Create a new file output.
|
void |
newParameter(java.lang.String name,
java.lang.String argument)
Add a new parameter.
|
void |
newParameter(java.lang.String name,
java.lang.String argument,
java.lang.String value)
Add a new parameter.
|
void |
newParameter(java.lang.String name,
java.lang.String argument,
java.lang.String value,
java.lang.String choice,
ExecutionChoice.ParameterType type)
Add a new parameter.
|
void |
portEvent(IOPortEvent event)
Receive a port event.
|
void |
preinitialize()
List to port events for File input ports so that when a token is read, we
can set the corresponding parameter.
|
void |
removeExecutionChoice(java.lang.String name)
Remove an execution choice.
|
void |
removeInput(java.lang.String name)
Remove a file input.
|
void |
removeOutput(java.lang.String name)
Remove a file output.
|
void |
removeParameter(java.lang.String name)
Remove a parameter.
|
void |
renameExecutionChoice(java.lang.String oldName,
java.lang.String newName)
Rename an execution choice.
|
void |
renameInput(java.lang.String oldName,
java.lang.String newName)
Rename an input.
|
void |
renameOutput(java.lang.String oldName,
java.lang.String newName)
Rename an output.
|
boolean |
renameParameter(java.lang.String oldName,
java.lang.String newName)
Rename a parameter.
|
boolean |
renameParameter(java.lang.String oldName,
java.lang.String newName,
NamedObj container)
Rename a parameter in the specified container.
|
static void |
setArgument(Parameter parameter,
java.lang.String argument)
Set the command line argument for a parameter.
|
static void |
setParameterType(NamedObj container,
java.lang.String name,
ExecutionChoice.ParameterType type)
Set the ParameterType for a parameter in contained in a sub-workflow.
|
void |
setParameterType(java.lang.String name,
ExecutionChoice.ParameterType type)
Set the ParameterType for a parameter contained by this actor.
|
void |
setPortIOType(TypedIOPort port,
ExecutionChoice.IOType type)
Set the PortType for a port.
|
void |
updateExecutionChoices()
Update the execution choices in the control parameter.
|
void |
wrapup()
Perform cleanup.
|
_addEntity, getCurrentRefinement, newRefinement, refinementClassName
mirrorContainerPortsInRefinement, newPort
_addPort, _addRelation, _checkTypesFromTo, _destinationTypeConstraints, attributeTypeChanged, isBackwardTypeInferenceEnabled, newRelation, resolveTypes, typeConstraintList, typeConstraints
_actorFiring, _actorFiring, _finishedAddEntity, _setDirector, _transferPortParameterInputs, addActorFiringListener, addInitializable, addPiggyback, connectionsChanged, createReceivers, createSchedule, getCausalityInterface, getDirector, getExecutiveDirector, getManager, getPublishedPort, getPublishedPortChannel, getPublishedPorts, getSubscribedPortChannel, inferringWidths, inferWidths, initialize, inputPortList, isFireFunctional, isOpaque, isPublishedPort, isStrict, iterate, linkToPublishedPort, linkToPublishedPort, linkToPublishedPort, linkToPublishedPort, needsWidthInference, newInsideReceiver, newReceiver, notifyConnectivityChange, outputPortList, postfire, prefire, recordFiring, registerPublisherPort, registerPublisherPort, removeActorFiringListener, removeInitializable, removePiggyback, requestChange, setContainer, setDirector, setManager, stop, stopFire, terminate, unlinkToPublishedPort, unlinkToPublishedPort, unlinkToPublishedPort, unlinkToPublishedPort, unregisterPublisherPort, unregisterPublisherPort
_adjustDeferrals, _containedDecorators, _deepOpaqueEntityList, _description, _exportMoMLContents, _removeEntity, _removeRelation, _validateSettables, allAtomicEntityList, allowLevelCrossingConnect, classDefinitionList, connect, connect, containedObjectsIterator, deepCompositeEntityList, deepEntityList, deepGetEntities, deepNamedObjList, deepOpaqueEntityList, deepRelationSet, entityList, entityList, exportLinks, exportMoML, getAttribute, getEntities, getEntity, getPort, getRelation, getRelations, isAtomic, lazyAllAtomicEntityList, lazyAllCompositeEntityList, lazyAllCompositeTransparentAndOpaqueEntityList, lazyClassDefinitionList, lazyDeepEntityList, lazyEntityList, lazyRelationList, numberOfEntities, numberOfRelations, numEntities, numRelations, relationList, removeAllEntities, removeAllRelations, setClassDefinition, statistics, uniqueName
_checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
_removePort, connectedPortList, connectedPorts, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts
_setParent, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, clone, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
isFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminate
addInitializable, initialize, removeInitializable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
getDerivedLevel, getDerivedList, propagateValue
public StringParameter program
public StringParameter additionalOptions
public Parameter checkOutputTimestamp
public static final java.lang.String DEFAULT_TEMPLATE_NAME
public static final java.lang.String DEFAULT_INPUT_DIR_NAME
public static final java.lang.String DEFAULT_OUTPUT_DIR_NAME
public static final java.lang.String DEFAULT_INPUT_FILE_NAME
public static final java.lang.String DEFAULT_OUTPUT_FILE_NAME
public static final java.lang.String ALL_CHOICES_NAME
public static final java.lang.String ARGUMENT_NAME
public static final java.lang.String COMMAND_LINE_NAME
public ExecutionChoice(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
public ExecutionChoice(Workspace workspace) throws IllegalActionException, NameDuplicationException
public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged
in class TypedCompositeActor
attribute
- The attribute that changed.IllegalActionException
- Not thrown in this base class.
Derived classes can throw this exception if type change is not allowed.public void changeExecuted(ChangeRequest change)
changeExecuted
in interface ChangeListener
change
- The change that has been executed.public void changeFailed(ChangeRequest change, java.lang.Exception exception)
changeFailed
in interface ChangeListener
change
- The change that was attempted.exception
- The exception that resulted.public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class Case
workspace
- The workspace for the new object.java.lang.CloneNotSupportedException
- If any of the attributes
cannot be cloned.NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public void exportExecutionChoice(java.io.File saveFile, java.lang.String name) throws IllegalActionException, NameDuplicationException
saveFile
- the file to write the execution choice as a MoML XML.name
- the name of the execution choice to save.IllegalActionException
NameDuplicationException
public void fire() throws IllegalActionException
Case
fire
in interface Executable
fire
in class Case
IllegalActionException
- If there is no director, or if
the director's fire() method throws it, or if the actor is not
opaque.public java.lang.String getArgument(java.lang.String name) throws IllegalActionException
name
- the name of the parameterIllegalActionException
public static java.lang.String getArgument(NamedObj container, java.lang.String name) throws IllegalActionException
container
- the containername
- the name of the parameterIllegalActionException
public StringParameter getArgumentParameter(java.lang.String name) throws IllegalActionException
name
- the name of the parameterIllegalActionException
public static StringParameter getArgumentParameter(NamedObj container, java.lang.String name) throws IllegalActionException
container
- the containername
- the name of the parameterIllegalActionException
public java.util.List<java.lang.String> getExecutionChoiceNames()
public java.util.List<java.lang.String> getInputNames() throws IllegalActionException
IllegalActionException
public java.util.List<java.lang.String> getInputNames(boolean includeData) throws IllegalActionException
IllegalActionException
public java.util.List<java.lang.String> getOutputNames() throws IllegalActionException
IllegalActionException
public java.util.List<java.lang.String> getOutputNames(boolean includeData) throws IllegalActionException
IllegalActionException
public java.util.List<java.lang.String> getParameterNames() throws IllegalActionException
IllegalActionException
public ExecutionChoice.ParameterType getParameterType(java.lang.String name) throws IllegalActionException
IllegalActionException
public static ExecutionChoice.ParameterType getParameterType(NamedObj container, java.lang.String name) throws IllegalActionException
IllegalActionException
public static ExecutionChoice.IOType getPortIOType(Port port) throws IllegalActionException
IllegalActionException
public java.util.Set<java.lang.String> getTemplateNames() throws IllegalActionException
IllegalActionException
public boolean hasInput(java.lang.String name)
public boolean hasOutput(java.lang.String name)
public Refinement newExecutionChoice(java.lang.String templateName, java.lang.String refinementName) throws IllegalActionException
templateName
- the name of the template. The
template name must be contained in the set of names
return by getTemplateNames().name
- the name to give the new refinementIllegalActionException
public Refinement newExecutionChoice(java.io.File templateFile, java.lang.String refinementName) throws IllegalActionException
templateFile
- the containing the MoML of the execution choice.name
- the name to give the new refinement.IllegalActionException
public void newInput(java.lang.String name, ExecutionChoice.IOType type) throws NameDuplicationException, IllegalActionException
public void newInput(java.lang.String name, ExecutionChoice.IOType type, java.lang.String argument) throws NameDuplicationException, IllegalActionException
public void newOutput(java.lang.String name, ExecutionChoice.IOType type) throws IllegalActionException, NameDuplicationException
public void newOutput(java.lang.String name, ExecutionChoice.IOType type, java.lang.String argument) throws IllegalActionException, NameDuplicationException
public void newParameter(java.lang.String name, java.lang.String argument) throws IllegalActionException, NameDuplicationException
name
- the parameter nameargument
- the command line argument for this parameter. this can be null.IllegalActionException
NameDuplicationException
public void newParameter(java.lang.String name, java.lang.String argument, java.lang.String value) throws IllegalActionException, NameDuplicationException
name
- the parameter nameargument
- the command line argument for this parameter. this can be null.value
- the default value for the paramete. this can be null.IllegalActionException
NameDuplicationException
public void newParameter(java.lang.String name, java.lang.String argument, java.lang.String value, java.lang.String choice, ExecutionChoice.ParameterType type) throws IllegalActionException, NameDuplicationException
name
- the parameter nameargument
- the command line argument for this parameter. this can be null.value
- the default value for the paramete. this can be null.choice
- the refinement in which to add the parameter. if null or
set to ALL_CHOICES_NAME, the parameter is added to this actor.IllegalActionException
NameDuplicationException
public void portEvent(IOPortEvent event) throws IllegalActionException
portEvent
in interface IOPortEventListener
event
- The event to report.IllegalActionException
- If thrown by the implementation.public void preinitialize() throws IllegalActionException
preinitialize
in interface Initializable
preinitialize
in class CompositeActor
IllegalActionException
- If there is no director, or if
the director's preinitialize() method throws it, or if this actor
is not opaque.#portEvent()
public void removeExecutionChoice(java.lang.String name) throws IllegalActionException, NameDuplicationException
public void removeInput(java.lang.String name) throws java.lang.Exception
java.lang.Exception
public void removeOutput(java.lang.String name) throws java.lang.Exception
java.lang.Exception
public void removeParameter(java.lang.String name) throws java.lang.Exception
java.lang.Exception
public void renameExecutionChoice(java.lang.String oldName, java.lang.String newName)
public void renameInput(java.lang.String oldName, java.lang.String newName)
public boolean renameParameter(java.lang.String oldName, java.lang.String newName)
public boolean renameParameter(java.lang.String oldName, java.lang.String newName, NamedObj container)
public void renameOutput(java.lang.String oldName, java.lang.String newName)
public static void setArgument(Parameter parameter, java.lang.String argument) throws IllegalActionException, NameDuplicationException
public void setParameterType(java.lang.String name, ExecutionChoice.ParameterType type) throws IllegalActionException, NameDuplicationException
public static void setParameterType(NamedObj container, java.lang.String name, ExecutionChoice.ParameterType type) throws IllegalActionException, NameDuplicationException
public void setPortIOType(TypedIOPort port, ExecutionChoice.IOType type) throws IllegalActionException, NameDuplicationException
public void updateExecutionChoices() throws IllegalActionException
IllegalActionException
public void wrapup() throws IllegalActionException
wrapup
in interface Initializable
wrapup
in class CompositeActor
IllegalActionException
- If there is no director,
or if the director's wrapup() method throws it, or if this
actor is not opaque.protected ExecutionChoiceDirector _createDirector() throws IllegalActionException, NameDuplicationException
_createDirector
in class Case
IllegalActionException
- If the director cannot be created.NameDuplicationException
- If there is already an
attribute with the name "_director".protected void _setCurrentRefinement(Refinement refinement)
public void addDefaults() throws IllegalActionException, NameDuplicationException
public void addDefaultExecutionChoice() throws IllegalActionException
IllegalActionException
public boolean addDefaultInputsAndOutputs() throws NameDuplicationException, IllegalActionException
NameDuplicationException
IllegalActionException
public static boolean addDefaultInputsAndOutputs(ExecutionChoice choice) throws IllegalActionException, NameDuplicationException
IllegalActionException
NameDuplicationException