Package ptolemy.actor.gt.controller
Class Transform
- java.lang.Object
-
- All Implemented Interfaces:
java.lang.Cloneable,TransformationListener,Initializable,ConfigurableEntity,Changeable,Configurable,Debuggable,DebugListener,Derivable,DropTargetHandler,Flowable,Instantiable,ModelErrorHandler,MoMLExportable,Moveable,Nameable
- Direct Known Subclasses:
Match
public class Transform extends GTEvent implements ConfigurableEntity, TransformationListener
An event to transform the model in the model parameter with the encapsulated transformation rule.- Since:
- Ptolemy II 8.0
- Version:
- $Id$
- Author:
- Thomas Huining Feng
- Pt.AcceptedRating:
- Red (tfeng)
- Pt.ProposedRating:
- Yellow (tfeng)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTransform.EmbeddedConfigurerThe configurer to be embedded in the transform event.-
Nested classes/interfaces inherited from class ptolemy.domains.ptera.kernel.Event
Event.EventParameter, Event.RefiringData
-
Nested classes/interfaces inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description protected TransformationRule_transformationThe encapsulated transformation rule.TransformEventController.FactorycontrollerFactoryThe controller factory for this event to specialize the popup menu.ParameterdeferWhether the transformation should be deferred with a change request.ParametermatchedWhether the last pattern matching was successful (read-only).TransformationModemodeThe transformation mode.-
Fields inherited from class ptolemy.actor.gt.controller.GTEvent
refinementExtender
-
Fields inherited from class ptolemy.domains.ptera.kernel.Event
actions, isEndingEvent, isFinalEvent, isInitialEvent, parameters
-
Fields inherited from class ptolemy.domains.modal.kernel.State
incomingPort, isFinalState, isInitialState, outgoingPort, refinementName, saveRefinementsInConfigurer
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
-
-
Constructor Summary
Constructors Constructor Description Transform(CompositeEntity container, java.lang.String name)Construct an event with the given name contained by the specified composite entity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void_exportMoMLContents(java.io.Writer output, int depth)Write a MoML description of the contents of this object, which in this class are the attributes plus the ports.protected boolean_isActiveRefinement(TypedActor refinement)Return whether the given refinement is active.voidaddObject(NamedObj object)Invoked when the specified object is added to a container.java.lang.Objectclone(Workspace workspace)Clone the event into the specified workspace.voidconfigure(java.net.URL base, java.lang.String source, java.lang.String text)Configure this event with a transformation rule (an instance ofTransformationRule) stored in the moml.Event.RefiringDatafire(Token arguments)Process this event and transform (or pattern-match) the model in the model parameter depending on the transformation modelmode.ConfigurergetConfigurer()Get theConfigurerobject for this entity.java.lang.StringgetConfigureSource()Return the input source that was specified the last time the configure method was called.java.lang.StringgetConfigureText()Return the text string that represents the current configuration of this object.TypedActor[]getRefinement()Get the refinement of this event, which is an instance ofTransformationRule.-
Methods inherited from class ptolemy.actor.gt.controller.GTEvent
getModelParameter, setContainer
-
Methods inherited from class ptolemy.domains.ptera.kernel.Event
_getParserScope, addInitializable, attributeChanged, getController, initialize, isEndingEvent, isFinalEvent, isInitialEvent, preinitialize, refire, removeInitializable, scheduleEvents, stop, wrapup
-
Methods inherited from class ptolemy.domains.modal.kernel.State
dropObject, errorTransitionList, getIncomingPort, getObjectInRefinement, getOutgoingPort, nonErrorNonTerminationTransitionList, nonpreemptiveTransitionList, preemptiveTransitionList, terminationTransitionList
-
Methods inherited from class ptolemy.kernel.ComponentEntity
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, newPort, propagateExistence, setName
-
Methods inherited from class ptolemy.kernel.Entity
_addPort, _description, _removePort, _validateSettables, connectedPortList, connectedPorts, connectionsChanged, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
-
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, attributeTypeChanged, 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, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getDisplayName, getFullName, getName, getName
-
-
-
-
Field Detail
-
controllerFactory
public TransformEventController.Factory controllerFactory
The controller factory for this event to specialize the popup menu.
-
defer
public Parameter defer
Whether the transformation should be deferred with a change request.
-
matched
public Parameter matched
Whether the last pattern matching was successful (read-only).
-
mode
public TransformationMode mode
The transformation mode.
-
_transformation
protected TransformationRule _transformation
The encapsulated transformation rule.
-
-
Constructor Detail
-
Transform
public Transform(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Construct an event with the given name contained by the specified composite entity. The container argument must not be null, or a NullPointerException will be thrown. This event will use the workspace of the container for synchronization and version counts. If the name argument is null, then the name is set to the empty string. Increment the version of the workspace. This constructor write-synchronizes on the workspace.- Parameters:
container- The container.name- The name of the state.- Throws:
IllegalActionException- If the state cannot be contained by the proposed container.NameDuplicationException- If the name coincides with that of an entity already in the container.
-
-
Method Detail
-
addObject
public void addObject(NamedObj object)
Invoked when the specified object is added to a container.- Specified by:
addObjectin interfaceTransformationListener- Parameters:
object- The added object.
-
clone
public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
Clone the event into the specified workspace. This calls the base class and then sets the attribute and port public members to refer to the attributes and ports of the new state.- Overrides:
clonein classEvent- Parameters:
workspace- The workspace for the new event.- Returns:
- A new event.
- Throws:
java.lang.CloneNotSupportedException- If a derived class contains an attribute that cannot be cloned.- See Also:
NamedObj.exportMoML(Writer, int, String),NamedObj.setDeferringChangeRequests(boolean)
-
configure
public void configure(java.net.URL base, java.lang.String source, java.lang.String text) throws java.lang.ExceptionConfigure this event with a transformation rule (an instance ofTransformationRule) stored in the moml.- Specified by:
configurein interfaceConfigurable- Overrides:
configurein classState- Parameters:
base- The base relative to which references within the input are found, or null if this is not known, or there is none.source- The input source, which specifies a URL, or null if none.text- Configuration information given as text, or null if none.- Throws:
java.lang.Exception- If something goes wrong.
-
fire
public Event.RefiringData fire(Token arguments) throws IllegalActionException
Process this event and transform (or pattern-match) the model in the model parameter depending on the transformation modelmode.- Overrides:
firein classEvent- Parameters:
arguments- The arguments used to process this event, which must be either an ArrayToken or a RecordToken.- Returns:
- A refiring data structure that contains a non-negative double number if refire() should be called after that amount of model time, or null if refire() need not be called.
- Throws:
IllegalActionException- If the model cannot be transformed, or if thrown by the superclass.- See Also:
TransformationMode
-
getConfigureSource
public java.lang.String getConfigureSource()
Return the input source that was specified the last time the configure method was called.- Specified by:
getConfigureSourcein interfaceConfigurable- Overrides:
getConfigureSourcein classState- Returns:
- The string representation of the input URL, or null if the no source has been used to configure this object, or null if no external source need be used to configure this object.
-
getConfigureText
public java.lang.String getConfigureText()
Return the text string that represents the current configuration of this object. Note that any configuration that was previously specified using the source attribute need not be represented here as well.- Specified by:
getConfigureTextin interfaceConfigurable- Overrides:
getConfigureTextin classState- Returns:
- A configuration string, or null if no configuration has been used to configure this object, or null if no configuration string need be used to configure this object.
-
getConfigurer
public Configurer getConfigurer()
Get theConfigurerobject for this entity.- Specified by:
getConfigurerin interfaceConfigurableEntity- Overrides:
getConfigurerin classState- Returns:
- the Configurer object for this entity.
-
getRefinement
public TypedActor[] getRefinement()
Get the refinement of this event, which is an instance ofTransformationRule.- Overrides:
getRefinementin classState- Returns:
- The refinement.
-
_exportMoMLContents
protected void _exportMoMLContents(java.io.Writer output, int depth) throws java.io.IOExceptionWrite a MoML description of the contents of this object, which in this class are the attributes plus the ports. This method is called by exportMoML(). Each description is indented according to the specified depth and terminated with a newline character.- Overrides:
_exportMoMLContentsin classState- Parameters:
output- The output to write to.depth- The depth in the hierarchy, to determine indenting.- Throws:
java.io.IOException- If an I/O error occurs.- See Also:
NamedObj.exportMoML(Writer, int)
-
_isActiveRefinement
protected boolean _isActiveRefinement(TypedActor refinement)
Return whether the given refinement is active. The result is false unless the refinement is not theTransformationRuleinstance.- Overrides:
_isActiveRefinementin classEvent- Parameters:
refinement- The refinement.- Returns:
- Whether the refinement is active.
-
-