Previous | Table of Contents | Next |
5.5.1.1 ConstantNode
Instances of the ConstantNode class are ExpressionNodes that represent constant values within expressions. Appropriate uses
of the ConstantNode class place the values of constants in the value attribute, rather than in the expression::body attribute
inherited from ExpressionNode. The latter attribute is intended for a different purpose; see the description of the ExpressionNode
class for details.
Superclasses
ExpressionNode
Attributes
value
The value of a constant in an expression tree.type:multiplicity: |
|||||
Any | |||||
exactly one |
5.5.1.2 ElementNode
An ElementNode is a node in an expression that references some ModelElement instance. This subclass of ExpressionNode allows
an expression to reference any CWM model element that is not a Feature and cannot, therefore, be represented as a FeatureNode.
Typically, use of this subclass of ExpressionNode implies that a tool attempting to evaluate the expression will be able to
determine if the referenced ModelElement instance is also an instance of some interesting subclass of ModelElement that contains
a value of interest in the expression.
Superclasses
ExpressionNode
References
modelElement
Identifies the ModelElement instance that this ElementNode references.class:defined by:multiplicity: |
|||||
ModelElement | |||||
ReferencedElement::modelElement | |||||
exactly one |
5.5.1.3 ExpressionNode
All node types within an expression are derived from the ExpressionNode type.
An expression is stored as a collection of instances of the subtypes of ExpressionNode arranged in a hierarchical fashion.
The ExpressionNode instance at the top (or “root?) of the hierarchy represents the value of the expression and serves as a
starting point for expression evaluation. Refer to the descriptions of the subtypes of ExpressionNode (ElementNode, ConstantNode,
and FeatureNode) for additional information about the representation of expressions.
One important purpose for providing storage of expressions as a general feature of the CWM is to promote sharing them between
tools and to provide a means for recording lineage relationships between components within expressions. Specific details of
the implementation of expression operators are left to the implementing tools.
When ExpressionNode is used as the type of an Attribute, an instance of the Attribute can contain either an expression tree
as described here or a textual representation of the expression in body and language values in an attribute of type Expression
(defined ObjectModel). The expression attribute is provided for the latter usage. To obtain CWM’s sharing and lineage tracking
features for elements within an expression, the expression must be represented as an expression hierarcy.
Superclasses
Element
Attributes
expression
Contains a textual representation of the expression relevant for this ExpressionNode instance.type:multiplicity: |
|||||
Expression | |||||
zero or one |
References
featureNode
Identifies the FeatureNode for which this ExpressionNode instance represents the value of an argument. Because arguments can themselves represent entire expression sub-trees, this reference is used to create hierarchies of expression nodes, permitting representation of entire expression trees within the CWM.class:defined by:multiplicity:inverse: |
|||||
FeatureNode | |||||
OperationArgument::featureNode | |||||
zero or one | |||||
FeatureNode::argument |
type
Identifies the Classifier instance that represents the type of the expression at this level in the expression hierarchy. Although, formally, each node within an expression tree is capable of having a value and therefore, a data type, this reference is optional because modeling the data type of intermediate nodes in an expression tree is not always interesting, thereby reducing the effort required to create expression trees.class:defined by:multiplicity: |
|||||
Classifier | |||||
ExpressionNodeClassifier::type | |||||
zero or one |
5.5.1.4 FeatureNode
The FeatureNode class represents ExpressionNode instances that are features; that is, attributes or operations of some Classifier
instance within the CWM.
A FeatureNode with a null OperationArgument association represents either a parameter-less operation or an attribute value
obtained from some StructuralFeature instance.
Superclasses
ExpressionNode
Contained Elements
ExpressionNode
References
argument
Identifies the ExpressionNode instances that represent the actual arguments for this FeatureNode. By convention, the first actual argument is a reference to the object itself. If the argument reference is null, the FeatureNode is an attribute or parameter-less function or operation.class:defined by:multiplicity:inverse: |
|||||
ExpressionNode | |||||
OperationArgument::argument | |||||
zero or more; ordered | |||||
ExpressionNode::featureNode |
feature
Identifies the Feature (attribute or operation) that this FeatureNode instance represents.class:defined by:multiplicity: |
|||||
Feature | |||||
NodeFeature::feature | |||||
exactly one |
Constraints
A FeatureNode that has parameters other than the “this? parameter represents a Feature that is also an Operation. [C-5-1]
If the FeatureNode represents an instance-scope feature, the first argument is a “this? or “self? argument; that is, the object
invoking the feature. The convention is enforced by checking that the type of the first argument is the same as the type of
the feature. [C-5-2] If the FeatureNode represents a BehavioralFeature, the number of arguments must be equal to the number
of the BehavioralFeature’s parameters, plus one for the “this? parameter if the BehavioralFeature is of instance scope. [C-5-3]
If the FeatureNode represents a BehavioralFeature, the types of the arguments must match, in order, the types of the parameters,
allowing for the optional presence of a leading “this? parameter. [C-5-4]