de.tuberlin.cs.cis.ocl.eval.instance
Class OclExpressionInstance

java.lang.Object
  |
  +--de.tuberlin.cs.cis.ocl.eval.instance.PredefinedInstance
        |
        +--de.tuberlin.cs.cis.ocl.eval.instance.OclExpressionInstance
All Implemented Interfaces:
Instance, OclExpression

public class OclExpressionInstance
extends PredefinedInstance
implements OclExpression

Represents an instance of the OCL type OclExpression.

Author:
fchabar

Constructor Summary
OclExpressionInstance(Type domain, java.util.Map evaluation, OclType scope)
          Constructs an instance of the OCL type OclExpression.
 
Method Summary
static Instance evaluate(Instance parameter, OclExpression expr)
          Evaluates the specified expression parameterized with the specified instance.
static Instance evaluate(java.util.Vector parameters, OclExpression expr)
          Evaluates the specified expression with the specified values as parameters.
static java.util.Set evaluationDomain(OclExpression expr)
          Returns the domain the specified expression can be evaluated for.
static java.util.Collection evaluationScope(OclExpression expr)
          Returns the scope of all possible evaluations of expression, regarding the domain of the expr.
 OclType evaluationType()
          Results in the type of the object that results from evaluating this expression.
 Type getDomain()
          Returns the domain this expression is parameterized with.
 Type getScope()
          Returns the codomain this expression evaluates to.
 
Methods inherited from class de.tuberlin.cs.cis.ocl.eval.instance.PredefinedInstance
getRepresentation, getRuntimeType, getValue, hashCode, invoke, navigate, toString
 
Methods inherited from class java.lang.Object
equals, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OclExpressionInstance

public OclExpressionInstance(Type domain,
                             java.util.Map evaluation,
                             OclType scope)
Constructs an instance of the OCL type OclExpression. The signature and the mapping this expression defines must be specified.

Parameters:
domain - the domain of this expression
evaluation - the mapping from collection elements to results this expression can be evaluated to
scope - the scope of this expression
Method Detail

evaluate

public static Instance evaluate(java.util.Vector parameters,
                                OclExpression expr)
Evaluates the specified expression with the specified values as parameters. The parameters will either be used for declared Variables (in the specified order) or for the implicit iterator variable.

Parameters:
parameters - Parameters used to evaluate expr. The parameters must be included in the domain of the evaluation of expr.
expr - the expression instance to evaluate. The instance will be included in the scope of the evaluation of expr.
Returns:
The result of the described evaluation.
See Also:
evaluationDomain(OclExpression), evaluationDomain(OclExpression)

evaluate

public static Instance evaluate(Instance parameter,
                                OclExpression expr)
Evaluates the specified expression parameterized with the specified instance.

Parameters:
parameter - the instance the expression is parameterized with
expr - an OclExpression
Returns:
the result obtained by evaluating the specified expression with the specified parameter

evaluationScope

public static java.util.Collection evaluationScope(OclExpression expr)
Returns the scope of all possible evaluations of expression, regarding the domain of the expr.

Parameters:
expr - the expression beeing evaluated.
Returns:
the scope of the evaluation of expr.

evaluationDomain

public static java.util.Set evaluationDomain(OclExpression expr)
Returns the domain the specified expression can be evaluated for. The contents of the returned set are vectors representing value combinations for the declarators of the expression. If the expression does not include declared variables, the entries in domain are vectors containing just one element. All elements of these combination vectors are of type Instance.

Parameters:
expr - the expression the evaluation process will be regarded for.
Returns:
the domain of values this expression can be evaluated for.

evaluationType

public OclType evaluationType()
Description copied from interface: OclExpression
Results in the type of the object that results from evaluating this expression.

Specified by:
evaluationType in interface OclExpression
Returns:
the type of the object that results from evaluating this expression.

getDomain

public Type getDomain()
Returns the domain this expression is parameterized with.

Returns:
the domain this expression is parameterized with

getScope

public Type getScope()
Returns the codomain this expression evaluates to.

Returns:
the codomain this expression evaluates to.