org.eclipse.ocl.examples.pivot.context
Class AbstractParserContext

java.lang.Object
  extended by org.eclipse.ocl.examples.pivot.context.AbstractParserContext
All Implemented Interfaces:
ParserContext
Direct Known Subclasses:
ClassContext, EClassContext, EObjectContext, ModelContext

public abstract class AbstractParserContext
extends java.lang.Object
implements ParserContext


Field Summary
protected  MetaModelManager metaModelManager
           
protected  org.eclipse.emf.common.util.URI uri
           
 
Constructor Summary
protected AbstractParserContext(MetaModelManager metaModelManager, org.eclipse.emf.common.util.URI uri)
           
 
Method Summary
 BaseResource createBaseResource(java.lang.String expression)
          Create a Concrete Syntax resource containing the parsed expression.
 Type getClassContext()
          Return the type of the self variable.
 ExpressionInOCL getExpression(BaseResource resource)
          Extract an Abstract Syntax ExpressionInOCL fronm a Concrete Syntax resource.
 MetaModelManager getMetaModelManager()
          Returbn the MetaModelManager in use.
 void initialize(Base2PivotConversion conversion, ExpressionInOCL expression)
          Callback to initialize the ExpressionInOCL with the derived context such as a contextvariable for the self type, parameter and result variables.
 ExpressionInOCL parse(org.eclipse.emf.ecore.EObject owner, java.lang.String expression)
          Create an Abstract Syntax ExpressionInOCL containing the parsed expression on behalf of a potential owner.
 ExpressionInOCL parse(java.lang.String expression)
          Deprecated. 
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

metaModelManager

@NonNull
protected final MetaModelManager metaModelManager

uri

@NonNull
protected final org.eclipse.emf.common.util.URI uri
Constructor Detail

AbstractParserContext

protected AbstractParserContext(@NonNull
                                MetaModelManager metaModelManager,
                                @Nullable
                                org.eclipse.emf.common.util.URI uri)
Method Detail

createBaseResource

@NonNull
public BaseResource createBaseResource(@NonNull
                                               java.lang.String expression)
                                throws java.io.IOException,
                                       ParserException
Description copied from interface: ParserContext
Create a Concrete Syntax resource containing the parsed expression. Semantic errors may be found at the Resource.errors and may be converted to ParseExceptions by invoking PivitUtil.checkResourceErrors.

Specified by:
createBaseResource in interface ParserContext
Throws:
java.io.IOException - if resource loading fails
ParserException

getClassContext

@Nullable
public Type getClassContext()
Description copied from interface: ParserContext
Return the type of the self variable.

Specified by:
getClassContext in interface ParserContext

getExpression

@NonNull
public ExpressionInOCL getExpression(@NonNull
                                             BaseResource resource)
                              throws ParserException
Description copied from interface: ParserContext
Extract an Abstract Syntax ExpressionInOCL fronm a Concrete Syntax resource.

Specified by:
getExpression in interface ParserContext
Throws:
ParserException - if parsing fails

getMetaModelManager

@NonNull
public MetaModelManager getMetaModelManager()
Description copied from interface: ParserContext
Returbn the MetaModelManager in use.

Specified by:
getMetaModelManager in interface ParserContext

initialize

public void initialize(@NonNull
                       Base2PivotConversion conversion,
                       @NonNull
                       ExpressionInOCL expression)
Description copied from interface: ParserContext
Callback to initialize the ExpressionInOCL with the derived context such as a contextvariable for the self type, parameter and result variables.

Specified by:
initialize in interface ParserContext

parse

@Deprecated
@NonNull
public ExpressionInOCL parse(@NonNull
                                                java.lang.String expression)
                      throws ParserException
Deprecated. 

Description copied from interface: ParserContext
Create an Abstract Syntax ExpressionInOCL containing the parsed expression.

Specified by:
parse in interface ParserContext
Throws:
ParserException - if parsing fails

parse

@NonNull
public ExpressionInOCL parse(@Nullable
                                     org.eclipse.emf.ecore.EObject owner,
                                     @NonNull
                                     java.lang.String expression)
                      throws ParserException
Description copied from interface: ParserContext
Create an Abstract Syntax ExpressionInOCL containing the parsed expression on behalf of a potential owner.

This an invariant/precondition may specify its constraint as the owner
an operation body may specify the operation as the owner

The owner should be non-null but a null value is tolerated for deprecated compatibility.

Specified by:
parse in interface ParserContext
Throws:
ParserException - if parsing fails