Modifier and Type | Field and Description |
---|---|
protected EnvironmentFactory |
environmentFactory |
protected MetaModelManager |
metaModelManager |
protected Environment |
rootEnvironment |
Constructor and Description |
---|
OCLHelperImpl(OCL ocl)
Initializes me with my environment.
|
Modifier and Type | Method and Description |
---|---|
ExpressionInOCL |
createBodyCondition(java.lang.String expression)
Creates an operation body.
|
ExpressionInOCL |
createDerivedValueExpression(java.lang.String expression)
Creates a property derived value expression.
|
ExpressionInOCL |
createInvariant(java.lang.String expression)
Creates an invariant constraint in the current classifier context.
|
ExpressionInOCL |
createPostcondition(java.lang.String expression)
Creates an operation postcondition constraint.
|
ExpressionInOCL |
createPrecondition(java.lang.String expression)
Creates an operation precondition constraint.
|
ExpressionInOCL |
createQuery(java.lang.String expression)
Creates a query expression in the current classifier context.
|
protected ExpressionInOCL |
createSpecification(java.lang.String expression) |
Type |
getContextClassifier()
Obtains my OCL context classifier as a classifier.
|
Operation |
getContextOperation()
Obtains my context operation, if my environment is an operation context.
|
Property |
getContextProperty()
Obtains my context attribute, if my environment is an attribute context.
|
Environment |
getEnvironment()
|
MetaModelManager |
getMetaModelManager() |
OCL |
getOCL()
Obtains the OCL instance that created me.
|
org.eclipse.emf.common.util.Diagnostic |
getProblems()
Obtains problems, if any, found in parsing the last OCL constraint or
query expression.
|
boolean |
isValidating()
Queries whether I validate the expressions that I parse.
|
void |
setContext(org.eclipse.emf.ecore.EClassifier context)
Sets the classifier context of the OCL expression for which syntax or
parsing help is to be provided.
|
void |
setContext(Type context)
Sets the classifier context of the OCL expression for which syntax or
parsing help is to be provided.
|
void |
setInstanceContext(java.lang.Object instance)
Sets the classifier context implied by the specified instance.
|
void |
setInstanceOperationContext(java.lang.Object instance,
Operation operation)
Sets the operation context implied by the specified instance.
|
void |
setInstancePropertyContext(java.lang.Object instance,
Property property)
Sets the operation context implied by the specified instance.
|
void |
setOperationContext(org.eclipse.emf.ecore.EClassifier context,
org.eclipse.emf.ecore.EOperation operation)
Sets the operation context of the OCL expression for which syntax or
parsing help is to be provided.
|
void |
setOperationContext(Type context,
Operation operation)
Sets the operation context of the OCL expression for which syntax or
parsing help is to be provided.
|
void |
setPropertyContext(org.eclipse.emf.ecore.EClassifier context,
org.eclipse.emf.ecore.EStructuralFeature property)
Sets the attribute context of the OCL expression for which syntax or
parsing help is to be provided.
|
void |
setPropertyContext(Type context,
Property property)
Sets the attribute context of the OCL expression for which syntax or
parsing help is to be provided.
|
void |
setValidating(boolean validating)
Sets whether I should validate the expressions that I parse.
|
@NonNull protected final Environment rootEnvironment
@NonNull protected final MetaModelManager metaModelManager
@NonNull protected final EnvironmentFactory environmentFactory
public OCLHelperImpl(@NonNull OCL ocl)
ocl
- the OCL environment@NonNull public ExpressionInOCL createBodyCondition(@NonNull java.lang.String expression) throws ParserException
OCLHelper
createBodyCondition
in interface OCLHelper
expression
- the constraint expression (without any context
declaration). Ordinarily, this is an expression of the same type
as the operation, specifying the value of the operation.
Alternatively, this may be a boolean-valued expression phrased like
a post-condition (according to the well-formedness rules of UML
constraints)ParserException
- if the expression
fails to parse#setOperationContext(Object, Object)
@NonNull public ExpressionInOCL createDerivedValueExpression(@NonNull java.lang.String expression) throws ParserException
OCLHelper
createDerivedValueExpression
in interface OCLHelper
expression
- the derived value expression (without any context
declaration). This must conform to my context property typeParserException
- if the expression
fails to parse
or is not valid for my context property#setPropertyContext(Object, Object)
@NonNull public ExpressionInOCL createInvariant(@NonNull java.lang.String expression) throws ParserException
OCLHelper
createInvariant
in interface OCLHelper
expression
- the constraint expression (without any context
declaration). This must be a boolean-valued expressionParserException
- if the expression
fails to parse@NonNull public ExpressionInOCL createPostcondition(@NonNull java.lang.String expression) throws ParserException
OCLHelper
createPostcondition
in interface OCLHelper
expression
- the constraint expression (without any context
declaration). This must be a boolean-valued expressionParserException
- if the expression
fails to parse#setOperationContext(Object, Object)
@NonNull public ExpressionInOCL createPrecondition(@NonNull java.lang.String expression) throws ParserException
OCLHelper
createPrecondition
in interface OCLHelper
expression
- the constraint expression (without any context
declaration). This must be a boolean-valued expressionParserException
- if the expression
fails to parse#setOperationContext(Object, Object)
@NonNull public ExpressionInOCL createQuery(@NonNull java.lang.String expression) throws ParserException
OCLHelper
createQuery
in interface OCLHelper
expression
- the expression (without any context declaration).
This expression can have any result type; it needs not be a booleanParserException
- if the expression
fails to parse@NonNull protected ExpressionInOCL createSpecification(@NonNull java.lang.String expression) throws ParserException
ParserException
@Nullable public Property getContextProperty()
OCLHelper
getContextProperty
in interface OCLHelper
null
if there is only a
classifier or operation context@Nullable public Type getContextClassifier()
OCLHelper
getContextClassifier
in interface OCLHelper
null
)@Nullable public Operation getContextOperation()
OCLHelper
getContextOperation
in interface OCLHelper
null
if there is only a
classifier or attribute context@NonNull public Environment getEnvironment()
OCLHelper
getEnvironment
in interface OCLHelper
null
if I have
not yet been assigned a context#setContext(Object)
,
#setOperationContext(Object, Object)
,
#setPropertyContext(Object, Object)
@NonNull public final MetaModelManager getMetaModelManager()
@NonNull public OCL getOCL()
OCLHelper
public org.eclipse.emf.common.util.Diagnostic getProblems()
OCLHelper
getProblems
in interface OCLHelper
null
if all was OKpublic boolean isValidating()
OCLHelper
isValidating
in interface OCLHelper
public void setContext(@NonNull org.eclipse.emf.ecore.EClassifier context)
OCLHelper
setContext
in interface OCLHelper
context
- the OCL context classifier#setOperationContext(Object, Object)
,
#setPropertyContext(Object, Object)
public void setContext(@NonNull Type context)
OCLHelper
setContext
in interface OCLHelper
context
- the OCL context classifier#setOperationContext(Object, Object)
,
#setPropertyContext(Object, Object)
public void setInstancePropertyContext(@NonNull java.lang.Object instance, @NonNull Property property)
OCLHelper
This method is convenient for ad hoc parsing and evaluation of OCL constraints or expressions in the context of a model instance.
setInstancePropertyContext
in interface OCLHelper
instance
- the OCL context instanceproperty
- the OCL context attribute#setPropertyContext(Object, Object)
public void setInstanceContext(@NonNull java.lang.Object instance)
OCLHelper
This method is convenient for ad hoc parsing and evaluation of OCL constraints or expressions in the context of a model instance.
setInstanceContext
in interface OCLHelper
instance
- the OCL context instance#setContext(Object)
public void setInstanceOperationContext(@NonNull java.lang.Object instance, @NonNull Operation operation)
OCLHelper
This method is convenient for ad hoc parsing and evaluation of OCL constraints or expressions in the context of a model instance.
setInstanceOperationContext
in interface OCLHelper
instance
- the OCL context instanceoperation
- the OCL context operation#setOperationContext(Object, Object)
public void setOperationContext(@NonNull org.eclipse.emf.ecore.EClassifier context, @NonNull org.eclipse.emf.ecore.EOperation operation)
OCLHelper
setOperationContext
in interface OCLHelper
context
- the OCL context classifieroperation
- the OCL context operation#setContext(Object)
public void setOperationContext(@NonNull Type context, @NonNull Operation operation)
OCLHelper
setOperationContext
in interface OCLHelper
context
- the OCL context classifieroperation
- the OCL context operation#setContext(Object)
public void setPropertyContext(@NonNull org.eclipse.emf.ecore.EClassifier context, @NonNull org.eclipse.emf.ecore.EStructuralFeature property)
OCLHelper
setPropertyContext
in interface OCLHelper
context
- the OCL context classifierproperty
- the OCL context attribute#setContext(Object)
public void setPropertyContext(@NonNull Type context, @NonNull Property property)
OCLHelper
setPropertyContext
in interface OCLHelper
context
- the OCL context classifierproperty
- the OCL context attribute#setContext(Object)
public void setValidating(boolean validating)
OCLHelper
setValidating
in interface OCLHelper
validating
- whether I should validate parsed expressions