org.eclipse.papyrus.emf.facet.query.ocl.core.util
Class OclQueryUtil

java.lang.Object
  extended by org.eclipse.papyrus.emf.facet.query.ocl.core.util.OclQueryUtil

public final class OclQueryUtil
extends java.lang.Object

All necessary methods for the creation and evaluation of OCL expressions.


Method Summary
static boolean compareClassifierTypes(EClassifier firstType, EClassifier secondType)
          Compare the two types and return if they are equivalents.
static  createOCLExpression(EClassifier context, java.lang.String expression)
          Create an OCLExpression according to a string.
static java.lang.Object evaluateQuery(EClassifier context,  oclExpression)
          Evaluate the expression in parameter.
static java.lang.Object evaluateQuery(EClassifier context,  oclExpression, java.util.List<?> objectsSource)
          Evaluate the expression in parameter on the specifics objects.
static java.lang.Object evaluateQuery(EClassifier context,  oclExpression, java.lang.Object objectSource)
          Evaluate the expression in parameter on the specific object.
static EClassifier getEClassifier(EClassifier context, java.lang.Object type)
          Return the EClassifier associated to the type in parameter.
static  getEvaluationEvironment()
           
static java.lang.Object getExpressionType( expression)
           
static java.util.List<Choice> getSyntaxHelp(EClassifier context, java.lang.String expression)
          Return a list of syntax choice for the current expression.
static void setHelperInstanceContext(java.lang.Object context)
          Set the helper context.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getEvaluationEvironment

public static  getEvaluationEvironment()

setHelperInstanceContext

public static void setHelperInstanceContext(java.lang.Object context)
Set the helper context.

Parameters:
context - the context of the helper.

createOCLExpression

public static  createOCLExpression(EClassifier context,
                                        java.lang.String expression)
                                 throws ParserException
Create an OCLExpression according to a string.

Parameters:
expression - the expression to create.
Returns:
the expression.
Throws:
ParserException - if the string expression isn't well formed.

evaluateQuery

public static java.lang.Object evaluateQuery(EClassifier context,
                                              oclExpression)
Evaluate the expression in parameter.

Parameters:
oclExpression - the expression to evaluate.
Returns:
the result of the expression.

evaluateQuery

public static java.lang.Object evaluateQuery(EClassifier context,
                                              oclExpression,
                                             java.lang.Object objectSource)
Evaluate the expression in parameter on the specific object.

Parameters:
oclExpression - the expression to evaluate.
objectSource - the object on which evaluate the expression.
Returns:
the result of the query.

evaluateQuery

public static java.lang.Object evaluateQuery(EClassifier context,
                                              oclExpression,
                                             java.util.List<?> objectsSource)
Evaluate the expression in parameter on the specifics objects.

Parameters:
oclExpression - the expression to evaluate.
objectsSource - the objects on which evaluate the expression.
Returns:
the result of the query.

getSyntaxHelp

public static java.util.List<Choice> getSyntaxHelp(EClassifier context,
                                                   java.lang.String expression)
Return a list of syntax choice for the current expression.

Parameters:
expression - the expression.
Returns:
the different choices.

getEClassifier

public static EClassifier getEClassifier(EClassifier context,
                                         java.lang.Object type)
Return the EClassifier associated to the type in parameter.

Parameters:
context - the context of the environment.
type - the type to find.
Returns:
the EClassifier associated. Null if not.

compareClassifierTypes

public static boolean compareClassifierTypes(EClassifier firstType,
                                             EClassifier secondType)
Compare the two types and return if they are equivalents.

Parameters:
firstType - the first EClassifier to compare.
secondType - the second EClassifier to compare.
Returns:
true if they are equivalents.

getExpressionType

public static java.lang.Object getExpressionType( expression)
Parameters:
exp -
Returns: