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

    java.lang.Object
      org.eclipse.emf.ocl.expressions.impl.ValidationVisitorImpl

All Implemented Interfaces:
  Visitor

    public class ValidationVisitorImpl

extends 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.
`Object` `visitAssociationClassCallExp(AssociationClassCallExp ae)` Callback for an AssociationClassCallExp visit.
`Object` `visitBooleanLiteralExp(BooleanLiteralExp bl)` Callback for a BooleanLiteralExp visit.
`Object` `visitCollectionLiteralExp(CollectionLiteralExp cl)` Callback for a CollectionLiteralExp visit.
`Object` `visitConstraint(Constraint constraint)` Applies well-formedness rules to constraints.
`Object` `visitEnumLiteralExp(EnumLiteralExp el)` Callback for an EnumLiteralExp visit.
`Object` `visitIfExp(IfExp i)` Callback for an IfExp visit.
`Object` `visitIntegerLiteralExp(IntegerLiteralExp il)` Callback for an IntegerLiteralExp visit.
`Object` `visitInvalidLiteralExp(InvalidLiteralExp il)`
`Object` `visitIterateExp(IterateExp ie)` Callback for an IterateExp visit.
`Object` `visitIteratorExp(IteratorExp ie)` Callback for an IteratorExp visit.
`Object` `visitLetExp(LetExp l)` Callback for LetExp visit.
`Object` `visitMessageExp(MessageExp m)`
`Object` `visitNullLiteralExp(NullLiteralExp il)`
`Object` `visitOperationCallExp(OperationCallExp oc)` Callback for an OperationCallExp visit.
`Object` `visitPropertyCallExp(PropertyCallExp pc)` Callback for an PropertyCallExp visit.
`Object` `visitRealLiteralExp(RealLiteralExp rl)` Callback for a RealLiteralExp visit.
`Object` `visitStateExp(StateExp s)`
`Object` `visitStringLiteralExp(StringLiteralExp sl)` Callback for a StringLiteralExp visit.
`Object` `visitTupleLiteralExp(TupleLiteralExp tl)` Callback for a TupleLiteralExp visit.
`Object` `visitTupleLiteralPart(TupleLiteralPart tp)`
`Object` `visitTypeExp(TypeExp t)` Callback for a TypeExp visit.
`Object` `visitUnspecifiedValueExp(UnspecifiedValueExp uv)` Callback for an UnspecifiedValueExp visit.
`Object` `visitVariable(Variable vd)` Callback for a VariableDeclaration visit.
`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 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 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 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 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 Object visitAssociationClassCallExp(AssociationClassCallExp ae)

  Callback for an AssociationClassCallExp visit. Well-formedness rules:
  - the type of the AssociationClassCallExp is the type of the referenced EReference
  - the referenced EReference is an AssociationClassEnd, and its associationClass reference is not null

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

### visitVariable

    public 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 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 Object visitMessageExp(MessageExp m)

  Specified by:
    `visitMessageExp` in interface `Visitor`

### visitUnspecifiedValueExp

    public 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 Object visitTypeExp(TypeExp t)

  Callback for a TypeExp visit.

  Specified by:
    `visitTypeExp` in interface `Visitor`

### visitIntegerLiteralExp

    public 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 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 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 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 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 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 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 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 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 Object visitTupleLiteralPart(TupleLiteralPart tp)

  Specified by:
    `visitTupleLiteralPart` in interface `Visitor`

### visitStateExp

    public Object visitStateExp(StateExp s)

  Specified by:
    `visitStateExp` in interface `Visitor`

### visitConstraint

    public Object visitConstraint(Constraint constraint)

  Applies well-formedness rules to constraints.

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

### visitInvalidLiteralExp

    public Object visitInvalidLiteralExp(InvalidLiteralExp il)

  Specified by:
    `visitInvalidLiteralExp` in interface `Visitor`

### visitNullLiteralExp

    public Object visitNullLiteralExp(NullLiteralExp il)

  Specified by:
    `visitNullLiteralExp` in interface `Visitor`

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