public class GTParameter extends Parameter
Red (tfeng) |
Yellow (tfeng) |
Modifier and Type | Class and Description |
---|---|
static class |
GTParameter.Evaluator
The evaluator used in a transformation rule.
|
static class |
GTParameter.Scope
A scope to be used in
GTParameter.Evaluator to resolve names with a pattern and
a match result. |
static class |
GTParameter.TypeInference
The type inference used to infer types of names in the host model and in
the pattern, which is used in
GTParameter.Evaluator . |
Variable.CircularDependencyError, Variable.VariableScope
NamedObj.ContainedObjectsIterator
Settable.Visibility
_currentExpression, _needsEvaluation, _parserScope, _parseTreeValid, _valueListeners
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
EXPERT, FULL, NONE, NOT_EDITABLE
Constructor and Description |
---|
GTParameter(NamedObj container,
java.lang.String name)
Construct a parameter with the given name contained by the specified
entity.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_evaluate(Pattern pattern,
MatchResult matchResult)
Evaluate the current expression to a token with the given pattern and
match result using
GTParameter.Evaluator . |
addChoice, clone, exportMoML, getChoices, removeAllChoices, removeChoice
_description, _evaluate, _notifyValueListeners, _parseIfNecessary, _propagate, _propagateToValueListeners, _propagateValue, _setToken, _setTokenAndNotify, addValueListener, getDeclaredType, getExpression, getFreeIdentifiers, getParserScope, getScope, getScope, getToken, getType, getTypeTerm, getValueAsString, getVariable, getVisibility, invalidate, isKnown, isLazy, isStringMode, isTypeAcceptable, removeValueListener, reset, setContainer, setExpression, setLazy, setName, setParseTreeEvaluator, setStringMode, setToken, setToken, setTypeAtLeast, setTypeAtLeast, setTypeAtMost, setTypeEquals, setTypeSameAs, setUnknown, setVisibility, stringRepresentation, toString, typeConstraintList, typeConstraints, validate, valueChanged
getDefaultExpression
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, updateContent
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, 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, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, uniqueName, validateSettables, workspace
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getDisplayName
description, getContainer, getFullName, getName, getName
public GTParameter(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.protected void _evaluate(Pattern pattern, MatchResult matchResult) throws IllegalActionException
GTParameter.Evaluator
. If this variable
was last set directly with a token, then do nothing. In other words,
the expression is evaluated only if the value of the token was most
recently given by an expression. The expression is also evaluated
if any of the variables it refers to have changed since the last
evaluation. If the value of this variable
changes due to this evaluation, then notify all
value dependents and notify the container (if there is one) by
calling its attributeChanged() and attributeTypeChanged() methods,
as appropriate. An exception is thrown
if the expression is illegal, for example if a parse error occurs
or if there is a dependency loop.
If evaluation results in a token that is not of the same type as the current type of the variable, then the type of the variable is changed, unless the new type is incompatible with statically specified types (setTypeEquals() and setTypeAtMost()). If the type is changed, the attributeTypeChanged() method of the container is called. The container can reject the change by throwing an exception.
This method may trigger a model error, which is delegated up the container hierarchy until an error handler is found, and is ignored if no error handler is found. A model error occurs if the expression cannot be parsed or cannot be evaluated.
Part of this method is read-synchronized on the workspace.
pattern
- The pattern.matchResult
- The match result for the match between the pattern
and a host model.IllegalActionException
- If the expression cannot
be parsed or cannot be evaluated, or if a dependency loop is found.