UML Modeler

com.ibm.xtools.modeler.ui
Interface IOclQueryHelper


public interface IOclQueryHelper

A convenience interface for the execution of OCL expressions and queries on EMF models.

Note that this interface is not intended to be implemented by clients.


Method Summary
 Object evaluate(EObject self, String oclExpression, IProgressMonitor monitor)
          Evaluates the OCL expression specified by oclExpression using self as the context for the expression evaluation.
 Set<Object> executeOclStatement(EObject self, EClass selfType, String oclStatement, IProgressMonitor monitor)
          Deprecated. Use the IOclQueryHelper.evaluate(EObject, String, IProgressMonitor) method, instead, because it preserves the ordering of collection-valued OCL expressions in case the expression is of an ordered collection (list) type
 Set<EObject> executeQueryUsingOclFilter(EObject queryRoot, EClass selfType, String oclFilter, IProgressMonitor monitor)
          Executes a query using queryRoot as the root of the subtree to be searched and an OCL filter specified by oclFilter.
 

Method Detail

executeQueryUsingOclFilter

Set<EObject> executeQueryUsingOclFilter(EObject queryRoot,
                                        EClass selfType,
                                        String oclFilter,
                                        IProgressMonitor monitor)
                                        throws InterruptedException,
                                               InvalidOclExpressionException
Executes a query using queryRoot as the root of the subtree to be searched and an OCL filter specified by oclFilter. EObjects satisfying the OCL filter condition are returned.

Parameters:
queryRoot - The root element to recursively search
selfType - Type of the "self" element specified in the query text. Use null to specify a context-free OCL query (in which case no syntactic validation of the OCL expression can be performed)
oclFilter - The string specifying the OCL query condition
monitor - The monitor to use to display progress and/or cancel
Returns:
A collection of EObjects in the queryRoot subtree that match the oclFilter condition
Throws:
InterruptedException - if the query operation was interrupted
InvalidOclExpressionException - if the specified OCL expression is invalid
IllegalArgumentException - if the oclFilter is an empty string
NullPointerException - if any argument is null

executeOclStatement

Set<Object> executeOclStatement(EObject self,
                                EClass selfType,
                                String oclStatement,
                                IProgressMonitor monitor)
                                throws InterruptedException,
                                       InvalidOclExpressionException
Deprecated. Use the IOclQueryHelper.evaluate(EObject, String, IProgressMonitor) method, instead, because it preserves the ordering of collection-valued OCL expressions in case the expression is of an ordered collection (list) type

Executes the OCL statement specified by oclStatement using self as the context for the statement evaluation. The statement will only be applied to self without recursing into its contents.

Parameters:
self - The context to use for the OCL statement evaluation
selfType - Type of the self. Use null to specify a context-free OCL statement (in which case no syntactic validation of the OCL expression can be performed)
oclStatement - The string specifying the OCL statement
monitor - The monitor to use to display progress and/or cancel
Returns:
The set of Objects produced by executing the OCL statement. Can contain EObjects, Strings, Numbers, even nulls. However, the result itself will not be null
Throws:
InterruptedException - if the statement execution was interrupted
InvalidOclExpressionException - if the specified oclStatement is invalid
IllegalArgumentException - if the oclStatement is an empty string
NullPointerException - if one of the arguments was null

evaluate

Object evaluate(EObject self,
                String oclExpression,
                IProgressMonitor monitor)
                throws InterruptedException,
                       InvalidOclExpressionException
Evaluates the OCL expression specified by oclExpression using self as the context for the expression evaluation. The expression will only be evaluated on self without recursing into children.

Parameters:
self - The context to use for the OCL expression evaluation
oclExpression - The string specifying the OCL expression
monitor - The monitor to use to display progress and/or cancel
Returns:
the value of the OCL expression, if any. The value may be
  • null if the expression's value is null or if it is a statement that has no result type
  • an EObject if the value is a model element
  • a Java Object if the value is some primitive value or other kind of Java object such as a string or a date
  • a Collection of some kind if the value is some kind of OCL collection. This may be an ordered collection (List), a set (Set), or a bag (Collection)
  • . The collection could be empty and might contain any type of object (even collections).
Throws:
InterruptedException - The expression evaluation was interrupted
InvalidOclExpressionException - The specified OCL expression is invalid
IllegalArgumentException - oclExpression/code> is an empty string
NullPointerException - One of the arguments was null

UML Modeler

© Copyright IBM Corp. 2009. All rights reserved.