org.eclipse.emf.ocl.expressions.impl
Class ValidationVisitorImpl

java.lang.Object
  extended byorg.eclipse.emf.ocl.expressions.impl.ValidationVisitorImpl
All Implemented Interfaces:
Visitor

public class ValidationVisitorImpl
extends java.lang.Object
implements Visitor


Method Summary
protected  Environment getEnvironment(ASTNode node)
          Obtains the current environment, which may be inferred from the context of the constraint that we are validating.
static Visitor getInstance()
          Obtains an instance of the validation visitor that assumes an Ecore environment, inferred from the context of the constraint being validated.
static Visitor getInstance(Environment environment)
          Obtains an instance of the validation visitor that validates against the specified environment, which presumably was used in parsing the OCL in the first place.
 java.lang.Object visitAssociationClassCallExp(AssociationClassCallExp ae)
          Callback for an AssociationClassCallExp visit.
 java.lang.Object visitBooleanLiteralExp(BooleanLiteralExp bl)
          Callback for a BooleanLiteralExp visit.
 java.lang.Object visitCollectionLiteralExp(CollectionLiteralExp cl)
          Callback for a CollectionLiteralExp visit.
 java.lang.Object visitConstraint(Constraint constraint)
          Applies well-formedness rules to constraints.
 java.lang.Object visitEnumLiteralExp(EnumLiteralExp el)
          Callback for an EnumLiteralExp visit.
 java.lang.Object visitIfExp(IfExp i)
          Callback for an IfExp visit.
 java.lang.Object visitIntegerLiteralExp(IntegerLiteralExp il)
          Callback for an IntegerLiteralExp visit.
 java.lang.Object visitInvalidLiteralExp(InvalidLiteralExp il)
           
 java.lang.Object visitIterateExp(IterateExp ie)
          Callback for an IterateExp visit.
 java.lang.Object visitIteratorExp(IteratorExp ie)
          Callback for an IteratorExp visit.
 java.lang.Object visitLetExp(LetExp l)
          Callback for LetExp visit.
 java.lang.Object visitMessageExp(MessageExp m)
           
 java.lang.Object visitNullLiteralExp(NullLiteralExp il)
           
 java.lang.Object visitOperationCallExp(OperationCallExp oc)
          Callback for an OperationCallExp visit.
 java.lang.Object visitPropertyCallExp(PropertyCallExp pc)
          Callback for an PropertyCallExp visit.
 java.lang.Object visitRealLiteralExp(RealLiteralExp rl)
          Callback for a RealLiteralExp visit.
 java.lang.Object visitStateExp(StateExp s)
           
 java.lang.Object visitStringLiteralExp(StringLiteralExp sl)
          Callback for a StringLiteralExp visit.
 java.lang.Object visitTupleLiteralExp(TupleLiteralExp tl)
          Callback for a TupleLiteralExp visit.
 java.lang.Object visitTupleLiteralPart(TupleLiteralPart tp)
           
 java.lang.Object visitTypeExp(TypeExp t)
          Callback for a TypeExp visit.
 java.lang.Object visitUnspecifiedValueExp(UnspecifiedValueExp uv)
          Callback for an UnspecifiedValueExp visit.
 java.lang.Object visitVariable(Variable vd)
          Callback for a VariableDeclaration visit.
 java.lang.Object visitVariableExp(VariableExp v)
          Callback for a VariableExp visit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Visitor getInstance()
Obtains an instance of the validation visitor that assumes an Ecore environment, inferred from the context of the constraint being validated.

Returns:
a validation visitor instance

getInstance

public static Visitor getInstance(Environment environment)
Obtains an instance of the validation visitor that validates against the specified environment, which presumably was used in parsing the OCL in the first place.

Parameters:
environment - an OCL environment
Returns:
a validation visitor instance for the specified environment

getEnvironment

protected Environment getEnvironment(ASTNode node)
Obtains the current environment, which may be inferred from the context of the constraint that we are validating.

Parameters:
node - an AST node from which possibly to infer the environment. If null, it will be assumed that we were initialized with an environment
Returns:
a suitable environment, or a default if no node was provide for inference and we were not initialized with an explicit environment

visitOperationCallExp

public java.lang.Object visitOperationCallExp(OperationCallExp oc)
Callback for an OperationCallExp visit. Well-formedness rule: All of the arguments must conform to the parameters of the referred operation. There must be exactly as many arguments as the referred operation has parameters.

Specified by:
visitOperationCallExp in interface Visitor
Parameters:
oc - the operation call expression
Returns:
Boolean -- true if validated

visitEnumLiteralExp

public java.lang.Object visitEnumLiteralExp(EnumLiteralExp el)
Callback for an EnumLiteralExp visit. Well-formedness rule: The type of an enum Literal expression is the type of the referred literal.

Specified by:
visitEnumLiteralExp in interface Visitor
Parameters:
el - the enumeration literal expresion
Returns:
Boolean -- true if validated

visitVariableExp

public java.lang.Object visitVariableExp(VariableExp v)
Callback for a VariableExp visit. Well-formedness rule: The type of a VariableExp is the type of the Variable to which it refers.

Specified by:
visitVariableExp in interface Visitor
Parameters:
v - the variable expression
Returns:
Boolean -- true if validated

visitPropertyCallExp

public java.lang.Object visitPropertyCallExp(PropertyCallExp pc)
Callback for an PropertyCallExp visit. Well-formedness rule: The type of the PropertyCallExp is the type of the referred EStructuralFeature.

Specified by:
visitPropertyCallExp in interface Visitor
Parameters:
pc - the property call expression
Returns:
Boolean -- true if validated

visitAssociationClassCallExp

public java.lang.Object visitAssociationClassCallExp(AssociationClassCallExp ae)
Callback for an AssociationClassCallExp visit. Well-formedness rules:

Specified by:
visitAssociationClassCallExp in interface Visitor
Parameters:
ae - the association end expression
Returns:
Boolean -- true if validated

visitVariable

public java.lang.Object visitVariable(Variable vd)
Callback for a VariableDeclaration visit. Well-formedness rule: The type of the initExpression must conform to the type of the declared variable.

Specified by:
visitVariable in interface Visitor
Parameters:
vd - -- variable declaration
Returns:
Boolean -- true if validated

visitIfExp

public java.lang.Object visitIfExp(IfExp i)
Callback for an IfExp visit. Well-formedness Rule: The type of the condition must be Boolean. The type of the if expression is the common supertype of the then and else

Specified by:
visitIfExp in interface Visitor
Parameters:
i - - if expression
Returns:
Boolean -- true if validated

visitMessageExp

public java.lang.Object visitMessageExp(MessageExp m)
Specified by:
visitMessageExp in interface Visitor

visitUnspecifiedValueExp

public java.lang.Object visitUnspecifiedValueExp(UnspecifiedValueExp uv)
Callback for an UnspecifiedValueExp visit.

Specified by:
visitUnspecifiedValueExp in interface Visitor
Parameters:
uv - -- unspecified value expression
Returns:
Boolean -- true if validated

visitTypeExp

public java.lang.Object visitTypeExp(TypeExp t)
Callback for a TypeExp visit.

Specified by:
visitTypeExp in interface Visitor

visitIntegerLiteralExp

public java.lang.Object visitIntegerLiteralExp(IntegerLiteralExp il)
Callback for an IntegerLiteralExp visit. Well-formedness rule: The type of an integer Literal expression is the type Integer

Specified by:
visitIntegerLiteralExp in interface Visitor
Parameters:
il - - integer literal expression
Returns:
Boolean -- true if validated

visitRealLiteralExp

public java.lang.Object visitRealLiteralExp(RealLiteralExp rl)
Callback for a RealLiteralExp visit. Well-formedness rule: The type of a real literal expression is the type Real.

Specified by:
visitRealLiteralExp in interface Visitor
Parameters:
rl - -- real literal expression
Returns:
Boolean -- true if validated

visitStringLiteralExp

public java.lang.Object visitStringLiteralExp(StringLiteralExp sl)
Callback for a StringLiteralExp visit. Well-formedness rule: The type of a string literal expression is the type of the string.

Specified by:
visitStringLiteralExp in interface Visitor
Parameters:
sl - -- string literal expression
Returns:
Boolean -- true if validated

visitBooleanLiteralExp

public java.lang.Object visitBooleanLiteralExp(BooleanLiteralExp bl)
Callback for a BooleanLiteralExp visit. Well-formedness rule: The type of a Boolean Literal expression is the type of the boolean.

Specified by:
visitBooleanLiteralExp in interface Visitor
Parameters:
bl - - boolean literal expression
Returns:
Boolean - true if validated

visitLetExp

public java.lang.Object visitLetExp(LetExp l)
Callback for LetExp visit. Well-formedness rule: The type of the Let expression is the type of the in expression.

Specified by:
visitLetExp in interface Visitor
Parameters:
l - -- let expression
Returns:
Boolean -- true if validated

visitIterateExp

public java.lang.Object visitIterateExp(IterateExp ie)
Callback for an IterateExp visit. *Well-formedness rule: The type of the iterate is the type of the result variable. The type of the body expression must conform to the declared type of the result variable. *A result variable must have an init expression. *The type of a source expression must be a collection. *The loop variable has no init expression. *The type of the iterator variable must be the type of the elements of the *source collection.

Specified by:
visitIterateExp in interface Visitor
Parameters:
ie - - iterate expression
Returns:
Boolean -- true if validated

visitIteratorExp

public java.lang.Object visitIteratorExp(IteratorExp ie)
Callback for an IteratorExp visit. Well-formedness rule: If the iterator is "forall", "isUnique", "any", "one", or "exists", the type of the iterator must be Boolean. The result type of the collect operation on a sequence type is a sequence; the result type of collect on any other type is a bag. The select and reject iterators have the same type as its source. They type of the body of the select, reject, forall, exists must be boolean. The type of a source expression must be a collection. The loop variable has no init expression. The type of the iterator variable must be the type of the elements of the source collection.

Specified by:
visitIteratorExp in interface Visitor
Parameters:
ie - -- iterator expression
Returns:
Boolean -- true if validated

visitCollectionLiteralExp

public java.lang.Object visitCollectionLiteralExp(CollectionLiteralExp cl)
Callback for a CollectionLiteralExp visit. Well-formedness rule: The type of a collection literal expression is determined by the collection kind selection, and the common supertype of all elements. The empty collection has a Classifier as element type.

Specified by:
visitCollectionLiteralExp in interface Visitor
Parameters:
cl - -- collection literal expression
Returns:
Boolean -- true if validated

visitTupleLiteralExp

public java.lang.Object visitTupleLiteralExp(TupleLiteralExp tl)
Callback for a TupleLiteralExp visit. Well-formedness rule: The type of a tuple literal is a TupleType the specified parts All tuple literal expression parts must have unique names. The type of each attribute in a tuple literal part must match the type of the initialization expression.

Specified by:
visitTupleLiteralExp in interface Visitor
Parameters:
tl - tuple literal expression
Returns:
Boolean

visitTupleLiteralPart

public java.lang.Object visitTupleLiteralPart(TupleLiteralPart tp)
Specified by:
visitTupleLiteralPart in interface Visitor

visitStateExp

public java.lang.Object visitStateExp(StateExp s)
Specified by:
visitStateExp in interface Visitor

visitConstraint

public java.lang.Object visitConstraint(Constraint constraint)
Applies well-formedness rules to constraints.

Specified by:
visitConstraint in interface Visitor
Parameters:
constraint - the constraint to validate

visitInvalidLiteralExp

public java.lang.Object visitInvalidLiteralExp(InvalidLiteralExp il)
Specified by:
visitInvalidLiteralExp in interface Visitor

visitNullLiteralExp

public java.lang.Object visitNullLiteralExp(NullLiteralExp il)
Specified by:
visitNullLiteralExp in interface Visitor

Copyright 2002, 2006 IBM Corporation and others.
All Rights Reserved.