|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A utility object that provides OCL syntax completion suggestions for OCL
expressions on the metamodel and user model levels. Metamodel OCL help is
available for any EMF metamodel, but user model help is only available for
metamodels for which an
org.eclipse.gmf.runtime.emf.core.usermodel.IUserModelSupport
extension is
available.
Helpers of these two flavours can be created via the
HelperUtil#createOCLHelper(ModelingLevel)
method, which accepts
an enumerated modeling level parameter to indicate metamodel or user-model
level.
Note that this interface is not intended to be implemented by clients.
HelperUtil.createOCLHelper(EnvironmentFactory)
Method Summary | |
---|---|
boolean |
check(java.lang.Object context,
OCLExpression constraint)
Evaluates the specified constraint on an instance of my context classifier and returns whether the constraint is satisfied. |
boolean |
check(java.lang.Object context,
java.lang.String constraint)
Evaluates the specified constraint on an instance of my context classifier and returns whether the constraint is satisfied. |
OCLExpression |
createBodyCondition(java.lang.String expression)
Creates an operation body. |
OCLExpression |
createDerivedValueExpression(java.lang.String expression)
Creates a property derived value expression. |
OCLExpression |
createInitialValueExpression(java.lang.String expression)
Creates a property initial value expression. |
OCLExpression |
createInvariant(java.lang.String expression)
Creates an invariant constraint in the current classifier context. |
OCLExpression |
createPostcondition(java.lang.String expression)
Creates an operation postcondition constraint. |
OCLExpression |
createPrecondition(java.lang.String expression)
Creates an operation precondition constraint. |
OCLExpression |
createQuery(java.lang.String expression)
Creates a query expression in the current classifier context. |
org.eclipse.emf.ecore.ETypedElement |
define(java.lang.String defExpression)
Defines an additional property or operation in the context classifier, for use in formulating OCL queries and constraints. |
java.lang.Object |
evaluate(java.lang.Object context,
OCLExpression expression)
Evaluates the specified parsed OCL expression on an instance of my context classifier. |
java.lang.Object |
evaluate(java.lang.Object context,
java.lang.String expression)
Evaluates the specified expression on an instance of my context classifier. |
org.eclipse.emf.ecore.EClassifier |
getContextClassifier()
Obtains my OCL context classifier as an EMF classifier. |
org.eclipse.emf.ecore.EOperation |
getContextOperation()
Obtains my context operation as an EMF operation, if my environment is an operation context. |
org.eclipse.emf.ecore.EStructuralFeature |
getContextProperty()
Obtains my context operation as an EMF property, if my environment is a property context. |
Environment |
getEnvironment()
Obtains the environment defining my current context classifier, operation, or property. |
EnvironmentFactory |
getEnvironmentFactory()
Retrieves the environment factory for the metamodel that I am helping. |
java.util.List |
getSyntaxHelp(ConstraintType constraintType,
java.lang.String txt)
Obtains syntax completion choices for the specified fragment of an OCL expression given that it is intended for a constraint of the specified kind. |
java.util.List |
getSyntaxHelp(java.lang.String txt)
Deprecated. Use the IOCLHelper.getSyntaxHelp(ConstraintType, String)
method, instead, to get the correct completions for the context |
void |
setContext(java.lang.Object context)
Sets the context of the OCL expression for which syntax or parsing help is to be provided. |
void |
setContextOperation(java.lang.Object context,
java.lang.Object operation)
Sets the context of the OCL expression for which syntax or parsing help is to be provided. |
void |
setContextProperty(java.lang.Object context,
java.lang.Object property)
Sets the context of the OCL expression for which syntax or parsing help is to be provided. |
Method Detail |
public void setContext(java.lang.Object context)
EClassifier
of the target metamodel against which an OCL
expression would be parsed. Note that, in the former case, the actual
OCL context classifier (as an OCL type or EClassifier
) will be
inferred from the context object according to the nature of the
environment factory.
context
- the OCL context object or classifierIOCLHelper.setContextOperation(Object, Object)
public org.eclipse.emf.ecore.EClassifier getContextClassifier()
null
)public void setContextOperation(java.lang.Object context, java.lang.Object operation)
context
- the OCL context objectoperation
- the OCL context operationIOCLHelper.setContext(Object)
public org.eclipse.emf.ecore.EOperation getContextOperation()
null
if there is only a
classifier or property contextpublic void setContextProperty(java.lang.Object context, java.lang.Object property)
context
- the OCL context objectproperty
- the OCL context propertyIOCLHelper.setContext(Object)
public org.eclipse.emf.ecore.EStructuralFeature getContextProperty()
null
if there is only a
classifier or operation contextpublic Environment getEnvironment()
null
if I have noneIOCLHelper.setContext(Object)
,
IOCLHelper.setContextOperation(Object, Object)
,
IOCLHelper.setContextProperty(Object, Object)
public java.util.List getSyntaxHelp(java.lang.String txt)
IOCLHelper.getSyntaxHelp(ConstraintType, String)
method, instead, to get the correct completions for the context
IOCLHelper.getSyntaxHelp(ConstraintType, String)
method as it will provide
completions for syntax only available in these constraints.
txt
- a partial OCL expression for which to seek choices that
could be appended to it
Choice
s, possibly empty. The ordering of the
list may or may not indicate relative relevance or frequency of
a choicepublic java.util.List getSyntaxHelp(ConstraintType constraintType, java.lang.String txt)
constraintType
- the kind of constraint that is being composedtxt
- a partial OCL expression for which to seek choices that
could be appended to it
Choice
s, possibly empty. The ordering of the
list may or may not indicate relative relevance or frequency of
a choicepublic OCLExpression createQuery(java.lang.String expression) throws OCLParsingException
expression
- the constraint expression (without any context
declaration). This expression can have any result type; it needs not
be a boolean
OCLParsingException
- if the expression
fails to parsepublic OCLExpression createInvariant(java.lang.String expression) throws OCLParsingException
expression
- the constraint expression (without any context
declaration). This must be a boolean-valued expression
OCLParsingException
- if the expression
fails to parsepublic OCLExpression createPrecondition(java.lang.String expression) throws OCLParsingException
expression
- the constraint expression (without any context
declaration). This must be a boolean-valued expression
OCLParsingException
- if the expression
fails to parseIOCLHelper.setContextOperation(Object, Object)
public OCLExpression createPostcondition(java.lang.String expression) throws OCLParsingException
expression
- the constraint expression (without any context
declaration). This must be a boolean-valued expression
OCLParsingException
- if the expression
fails to parseIOCLHelper.setContextOperation(Object, Object)
public OCLExpression createBodyCondition(java.lang.String expression) throws OCLParsingException
expression
- the constraint expression (without any context
declaration). This must be a boolean-valued expression
OCLParsingException
- if the expression
fails to parseIOCLHelper.setContextOperation(Object, Object)
public OCLExpression createInitialValueExpression(java.lang.String expression) throws OCLParsingException
expression
- the initial value expression (without any context
declaration). This must conform to my context property type
OCLParsingException
- if the expression
fails to parse
or is not valid for my context propertyIOCLHelper.setContextProperty(Object, Object)
public OCLExpression createDerivedValueExpression(java.lang.String expression) throws OCLParsingException
expression
- the derived value expression (without any context
declaration). This must conform to my context property type
OCLParsingException
- if the expression
fails to parse
or is not valid for my context propertyIOCLHelper.setContextProperty(Object, Object)
public org.eclipse.emf.ecore.ETypedElement define(java.lang.String defExpression) throws OCLParsingException
oroperation-name(parameters?) : type = expr
property-name : type = expr
defExpression
- the definition expression (without any other context
declaration).
EOperation
or EStructuralFeature
OCLParsingException
- if the expression
fails to parsepublic java.lang.Object evaluate(java.lang.Object context, OCLExpression expression)
context
- the context object on which to evaluate the expression.
This is the self object, if the expression requires one.
Note that a context is required even for expressions that use the
allInstances() operation to get the instances of an OCL
classifier, in order to find resources to search for instances
(unless the context is a data type, in which case the instances are
not enumerated by models)
null
public java.lang.Object evaluate(java.lang.Object context, java.lang.String expression) throws OCLParsingException
context
- the context object on which to evaluate the expression.
This is the self object, if the expression requires one.
Note the it is required even for expressions that use the
allInstances() operation to get the instances of an OCL
classifier, in order to find resources to search for instances
(unless the context is a data type, in which case the instances are
not enumerated by models)
null
OCLParsingException
- if the expression
fails to parseIOCLHelper.evaluate(Object, OCLExpression)
public boolean check(java.lang.Object context, OCLExpression constraint)
context
- the context object on which to evaluate the expression.
This is the self object, if the expression requires one.
Note the it is required even for expressions that use the
allInstances() operation to get the instances of an OCL
classifier, in order to find resources to search for instances
(unless the context is a data type, in which case the instances are
not enumerated by models)constraint
- a constraint expression to evaluate
true
if the context
object satisfies
the constraint
; false
, otherwise
java.lang.IllegalArgumentException
- if the constraint
is not
boolean-valuedpublic boolean check(java.lang.Object context, java.lang.String constraint) throws OCLParsingException
context
- the context object on which to evaluate the expression.
This is the self object, if the expression requires one.
Note the it is required even for expressions that use the
allInstances() operation to get the instances of an OCL
classifier, in order to find resources to search for instances
(unless the context is a data type, in which case the instances are
not enumerated by models)constraint
- a constraint expression to evaluate
true
if the context
object satisfies
the constraint
; false
, otherwise
OCLParsingException
- if the expression
fails to parse
java.lang.IllegalArgumentException
- if the constraint
is not
boolean-valuedIOCLHelper.check(Object, OCLExpression)
public EnvironmentFactory getEnvironmentFactory()
null
)
|
Copyright 2002, 2006 IBM Corporation and others. All Rights Reserved. |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |