public class IterativeParameter extends Parameter implements MatchCallback, ValueIterator
initial()
and next()
, until either the latter method throws an IllegalActionException
or the pattern matching terminates. With this
parameter, it is possible to define a pattern with variable structures, which
depend on the values of this parameter.Modifier and Type | Class and Description |
---|---|
class |
IterativeParameter.ConstraintViolationException
The exception to denote that the constraint is violated and no more values
are available.
|
static class |
IterativeParameter.Mode
The modes of this parameter.
|
Variable.CircularDependencyError, Variable.VariableScope
NamedObj.ContainedObjectsIterator
Settable.Visibility
Modifier and Type | Field and Description |
---|---|
Parameter |
constraint
The constraint that all values must satisfy.
|
Parameter |
initial
The initial value.
|
ChoiceParameter |
mode
The mode of this parameter.
|
Parameter |
next
The next value (computed based on the current value).
|
_currentExpression, _needsEvaluation, _parserScope, _parseTreeValid, _suppressVariableSubstitution, _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 |
---|
IterativeParameter(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 |
_validateConstraint()
Validate the constraint.
|
void |
attributeChanged(Attribute attribute)
React to a change in an attribute.
|
java.lang.Object |
clone(Workspace workspace)
Clone the variable.
|
boolean |
foundMatch(GraphMatcher matcher)
A routine to be called when a match is found in the graph matching.
|
Token |
initial()
Set the value of this parameter to be the initial value, and return that
initial value.
|
Token |
next()
Set the value of this parameter to be the next acceptable value, and
return that value.
|
java.util.Collection<?> |
validate()
If this variable is not lazy (the default) then evaluate
the expression contained in this variable, and notify any
value dependents.
|
addChoice, exportMoML, getChoices, removeAllChoices, removeChoice
_description, _evaluate, _getCurrentExpression, _notifyValueListeners, _parseIfNecessary, _propagate, _propagateToValueListeners, _propagateValue, _setToken, _setTokenAndNotify, addValueListener, getDeclaredType, getExpression, getFreeIdentifiers, getParserScope, getScope, getScope, getToken, getType, getTypeTerm, getValueAsString, getVariable, getVisibility, invalidate, isKnown, isLazy, isStringMode, isSuppressVariableSubstitution, isTypeAcceptable, removeValueListener, reset, setContainer, setExpression, setLazy, setName, setParseTreeEvaluator, setStringMode, setSuppressVariableSubstitution, setToken, setToken, setTypeAtLeast, setTypeAtLeast, setTypeAtMost, setTypeEquals, setTypeSameAs, setUnknown, setValueListenerAsWeakDependency, setVisibility, stringRepresentation, toString, typeConstraintList, typeConstraints, 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, 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
getToken, setToken
addValueListener, getDefaultExpression, getDisplayName, getExpression, getValueAsString, getVisibility, removeValueListener, setExpression, setVisibility
description, getContainer, getFullName, getName, getName, setName
public Parameter constraint
public Parameter initial
public ChoiceParameter mode
IterativeParameter.Mode
public Parameter next
public IterativeParameter(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.public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged
in class Variable
attribute
- The attribute that changed.IllegalActionException
- If the change is not acceptable
to this container (not thrown in this base class).public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
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 Token initial() throws IllegalActionException
initial
in interface ValueIterator
IllegalActionException
- If the initial value cannot be set.public Token next() throws IllegalActionException
next
in interface ValueIterator
IllegalActionException
- If the next value cannot be set.public java.util.Collection<?> validate() throws IllegalActionException
If this variable is lazy, then mark this variable and any of its value dependents as needing evaluation and for any value dependents that are not lazy, evaluate them. Note that if there are no value dependents, or if they are all lazy, then this will not result in evaluation of this variable, and hence will not ensure that the expression giving its value is valid. Call getToken() or getType() to accomplish that.
validate
in interface Settable
validate
in class Variable
IllegalActionException
- If this variable or a
variable dependent on this variable cannot be evaluated (and is
not lazy) and the model error handler throws an exception.
Also thrown if the change is not acceptable to the container.protected void _validateConstraint() throws IllegalActionException
IllegalActionException
- If the constraint is violated, or if
the current value of the parameter cannot be retrieved.