All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.ocl.EvaluationVisitor Maven / Gradle / Ivy

/**
 * 
 *
 * Copyright (c) 2007 IBM Corporation and others.
 * All rights reserved.   This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   IBM - Initial API and implementation
 *
 * 
 *
 * $Id: EvaluationVisitor.java,v 1.1 2007/01/25 18:24:37 cdamus Exp $
 */

package org.eclipse.ocl;

import java.util.Map;
import java.util.Set;

import org.eclipse.ocl.expressions.OCLExpression;
import org.eclipse.ocl.utilities.Visitable;
import org.eclipse.ocl.utilities.Visitor;

/**
 * A specialized visitor that is used for evaluation an
 * {@linkplain OCLExpression OCL expression} by walking its AST.
 * 

* See the {@link Environment} class for a description of the * generic type parameters of this class. *

* * @author Tim Klinger (tklinger) * @author Christian W. Damus (cdamus) */ public interface EvaluationVisitor extends Visitor { /** * Obtains the environment that provides the metamodel semantics for the * expression to be evaluated. * * @return the environment */ public Environment getEnvironment(); /** * Obtains the evaluation environment that keeps track of variable values * and knows how to call operations, navigate properties, etc. * * @return the evaluation environment */ public EvaluationEnvironment getEvaluationEnvironment(); /** * Obtains the mapping of model classes to their extends. * * @return the extent map */ public Map> getExtentMap(); /** * Evaluates the specified expression on the current "self" context * object. This result type of this expression may be any type. An * implementation will typically just call {@link Visitable#accept(Visitor)} * on the expression, but is free to elaborate on that. Thus, * clients should not simply ask the expression to accept this * visitor. * * @param expression the expression to evaluate * * @return the value of the expression */ public Object visitExpression(OCLExpression expression); /** * Checks that the specified constraint is satisfied by the * current "self" context object or, in the case of an operation body * condition, evaluates the body expression. * * @return for boolean-valued constraints (invariant, precondition, postcondition) * Boolean.TRUE if the constraint holds and Boolean.FALSE * if it is violated (including evaluations that result in OclInvalid). * For operation body conditions, the value of the operation result * * @throws IllegalArgumentException if the constraint is one that must * be boolean-valued but the computed result is not of boolean type * (or OclInvalid) */ public Object visitConstraint(CT constraint); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy