|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.kernel.util.Attribute
ptolemy.kernel.util.AbstractSettableAttribute
ptolemy.data.expr.Variable
ptolemy.data.expr.Parameter
ptolemy.data.expr.StringParameter
ptolemy.data.expr.ChoiceParameter
ptolemy.actor.gt.TransformationMode
public class TransformationMode
A parameter that determines the transformation mode. It also provides functions to perform transformation according to the chosen mode.
Red (tfeng) |
Yellow (tfeng) |
Nested Class Summary | |
---|---|
static class |
TransformationMode.Mode
The enumeration of accepted modes. |
private static class |
TransformationMode.WorkingCopyScopeExtender
A scope extender to resolve names in the scope of the master transformation rule even though the expression is specified in a working copy. |
Nested classes/interfaces inherited from class ptolemy.data.expr.Variable |
---|
Variable.VariableScope |
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj |
---|
NamedObj.ContainedObjectsIterator |
Nested classes/interfaces inherited from interface ptolemy.kernel.util.Settable |
---|
Settable.Visibility |
Field Summary | |
---|---|
private boolean |
_collectAllMatches
Whether all matches should be collected in a list. |
private TransformationRule |
_masterRule
The master transformation rule (not the working copy). |
private GraphMatcher |
_matcher
The graph matcher. |
private java.util.LinkedList<MatchResult> |
_matchResults
The collected matches. |
private java.util.Random |
_random
The random number generator. |
private TransformationRule |
_workingCopy
The current working copy. |
private long |
_workingCopyVersion
Version of the current working copy. |
private Workspace |
_workspace
A new workspace for working copies. |
Fields inherited from class ptolemy.data.expr.Variable |
---|
_currentExpression, _needsEvaluation, _parserScope, _parseTreeValid, _valueListeners |
Fields inherited from class ptolemy.kernel.util.NamedObj |
---|
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
Fields inherited from interface ptolemy.kernel.util.Settable |
---|
EXPERT, FULL, NONE, NOT_EDITABLE |
Constructor Summary | |
---|---|
TransformationMode(NamedObj container,
java.lang.String name)
Construct a parameter with the given name contained by the specified entity. |
Method Summary | |
---|---|
java.lang.Object |
clone(Workspace workspace)
Clone the variable. |
java.util.List<MatchResult> |
findAllMatches(TransformationRule workingCopy,
CompositeEntity model)
Find all the matches to the pattern in the workingCopy and return those matches in a list. |
boolean |
foundMatch(GraphMatcher matcher)
A routine to be called when a match is found in the graph matching. |
TransformationRule |
getWorkingCopy(TransformationRule masterRule)
Get a working copy for the transformation rule, which can be modified in pattern matching and transformation without affecting the original rule. |
boolean |
isMatchOnly()
Whether the transformation mode is match only. |
boolean |
transform(TransformationRule workingCopy,
CompositeEntity model)
Transform the model with the working copy. |
boolean |
transform(TransformationRule workingCopy,
CompositeEntity model,
TransformationListener listener,
boolean defer)
Transform the model with the working copy. |
Methods inherited from class ptolemy.data.expr.ChoiceParameter |
---|
getChosenValue |
Methods inherited from class ptolemy.data.expr.StringParameter |
---|
stringValue |
Methods inherited from class ptolemy.data.expr.Parameter |
---|
addChoice, exportMoML, getChoices, removeAllChoices, removeChoice |
Methods inherited from class ptolemy.kernel.util.AbstractSettableAttribute |
---|
getDefaultExpression |
Methods inherited from class ptolemy.kernel.util.Attribute |
---|
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, updateContent |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface ptolemy.kernel.util.Settable |
---|
getDisplayName |
Methods inherited from interface ptolemy.kernel.util.Nameable |
---|
description, getContainer, getFullName, getName, getName |
Field Detail |
---|
private boolean _collectAllMatches
private TransformationRule _masterRule
private java.util.LinkedList<MatchResult> _matchResults
private GraphMatcher _matcher
private java.util.Random _random
private TransformationRule _workingCopy
private long _workingCopyVersion
private Workspace _workspace
Constructor Detail |
---|
public TransformationMode(NamedObj container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The container.name
- The name of the parameter.
IllegalActionException
- If the parameter is not of an
acceptable class for the container.
NameDuplicationException
- If the name coincides with
a parameter already in the container.Method Detail |
---|
public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class Variable
workspace
- The workspace in which to place the cloned variable.
java.lang.CloneNotSupportedException
- Not thrown in this base class.Object.clone()
public java.util.List<MatchResult> findAllMatches(TransformationRule workingCopy, CompositeEntity model)
workingCopy
- The transformation rule that can be modified.model
- The model for pattern matching.
public boolean foundMatch(GraphMatcher matcher)
GraphMatcher.getMatchResult()
.
This match result should not be kept, however, because it may be changed
by future matching operations. To keep a copy of this result, invoke
MatchResult.clone()
and keep the cloned copy. The return value
indicates whether the match is the one looked for. If it is
true, the matching will terminate after this routine returns,
and no more match result will be reported.
foundMatch
in interface MatchCallback
matcher
- The graph matcher.
public TransformationRule getWorkingCopy(TransformationRule masterRule) throws IllegalActionException
masterRule
- The transformation rule.
IllegalActionException
- If a working copy cannot be obtained.public boolean isMatchOnly()
public boolean transform(TransformationRule workingCopy, CompositeEntity model) throws IllegalActionException
workingCopy
- The working copy.model
- The model to be transformed.
IllegalActionException
- If thrown in pattern matching or
transformation.transform(TransformationRule, CompositeEntity,
TransformationListener, boolean)
public boolean transform(TransformationRule workingCopy, CompositeEntity model, TransformationListener listener, boolean defer) throws IllegalActionException
workingCopy
- The working copy.model
- The model to be transformed.listener
- The listener to be invoked during transformation.defer
- Whether the change should be deferred if necessary with a
change request.
IllegalActionException
- If thrown in pattern matching or
transformation.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |