org.eclipse.m2m.atl.drivers.emf4atl
Class ASMEMFModelElement

java.lang.Object
  extended by org.eclipse.m2m.atl.engine.vm.nativelib.ASMNativeObject
      extended by org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny
          extended by org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclType
              extended by org.eclipse.m2m.atl.engine.vm.nativelib.ASMModelElement
                  extended by org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModelElement
Direct Known Subclasses:
ASMUMLModelElement

public class ASMEMFModelElement
extends ASMModelElement

The EMF implementation for ASMModelElement.


Field Summary
protected  org.eclipse.emf.ecore.EObject object
           
 
Fields inherited from class org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclType
myType
 
Fields inherited from class org.eclipse.m2m.atl.engine.vm.nativelib.ASMNativeObject
nativeImpl
 
Constructor Summary
protected ASMEMFModelElement(java.util.Map modelElements, ASMModel model, org.eclipse.emf.ecore.EObject object)
          Creates a new ASMEMFModelElement with the given parameters.
 
Method Summary
static ASMOrderedSet allInstances(StackFrame frame, ASMEMFModelElement self)
          Returns all instances of a type.
static ASMOrderedSet allInstancesFrom(StackFrame frame, ASMEMFModelElement self, ASMString sourceModelName)
          Returns all instances of a type from a given model.
protected  java.lang.Object asm2EMF(StackFrame frame, ASMOclAny value, java.lang.String propName, org.eclipse.emf.ecore.EStructuralFeature feature)
          Converts an ASM element to its EMF equivalent.
 ASMBoolean conformsTo(ASMOclType other)
          
protected  ASMOclAny emf2ASM(StackFrame frame, java.lang.Object value)
          Converts an EMF element to its ASM equivalent.
protected  void finalize()
          
protected  java.lang.reflect.Method findMethod(java.lang.Class cls, java.lang.String name, java.lang.Class[] argumentTypes)
          Returns the method which match the given parameters.
 ASMOclAny get(StackFrame frame, java.lang.String name)
          
static org.eclipse.emf.ecore.EEnumLiteral getEENumLiteral(org.eclipse.emf.ecore.EEnum eEnum, java.lang.String id)
          Returns the literal matching the given name or literal.
static ASMOclAny getInstanceById(StackFrame frame, ASMEMFModelElement self, ASMString modelName, ASMString id)
          Returns the instance with the given id.
 org.eclipse.emf.ecore.EObject getObject()
          Returns the internal EObject.
 ASMModelElement getProperty(java.lang.String name)
          
 ASMModelElement getPropertyType(java.lang.String name)
          
 ASMOclAny invoke(StackFrame frame, java.lang.String opName, java.util.List arguments)
          Searches for Operation opName in this context and invokes it if found.
 ASMOclAny invokeSuper(StackFrame frame, java.lang.String opName, java.util.List arguments)
          Searches for Operation opName in the superclass context and invokes it if found.
static ASMModelElement newInstance(StackFrame frame, ASMEMFModelElement self)
          Creates a new instance of a given type.
static ASMModelElement newInstanceIn(StackFrame frame, ASMEMFModelElement self, ASMString modelName)
          Creates a new instance of a given type.
 ASMOclAny refImmediateComposite()
          
 void set(StackFrame frame, java.lang.String name, ASMOclAny value)
          
 
Methods inherited from class org.eclipse.m2m.atl.engine.vm.nativelib.ASMModelElement
createNewInstance, getAcquaintance, getMetaobject, getModel, getName, lookupElementExtended, otherEnd, setMetaobject, setName, toString
 
Methods inherited from class org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclType
addSupertype, conformsTo, getName, getSupertypes, getVMOperations, registerHelperAttribute, registerVMOperation, registerWeavingHelper
 
Methods inherited from class org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny
asBag, asSequence, asSet, check, debug, findOperation, findOperation, getHelper, getOclAnyType, getType, invoke, isHelper, oclIsKindOf, oclIsTypeOf, oclIsUndefined, oclType, operatorEQ, operatorNE, output, refGetValue, refImmediateComposite, refInvokeOperation, refSetValue, setType, toString
 
Methods inherited from class org.eclipse.m2m.atl.engine.vm.nativelib.ASMNativeObject
getNativeImpl
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

object

protected org.eclipse.emf.ecore.EObject object
Constructor Detail

ASMEMFModelElement

protected ASMEMFModelElement(java.util.Map modelElements,
                             ASMModel model,
                             org.eclipse.emf.ecore.EObject object)
Creates a new ASMEMFModelElement with the given parameters.

Parameters:
modelElements - the model elements map
model - the model element
object - the object
Method Detail

conformsTo

public ASMBoolean conformsTo(ASMOclType other)

Specified by:
conformsTo in class ASMModelElement
See Also:
ASMModelElement.conformsTo(org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclType)

getPropertyType

public ASMModelElement getPropertyType(java.lang.String name)

Specified by:
getPropertyType in class ASMModelElement
See Also:
ASMModelElement.getPropertyType(java.lang.String)

getProperty

public ASMModelElement getProperty(java.lang.String name)

Specified by:
getProperty in class ASMModelElement
See Also:
ASMModelElement.getProperty(java.lang.String)

refImmediateComposite

public ASMOclAny refImmediateComposite()

Overrides:
refImmediateComposite in class ASMOclAny
See Also:
ASMOclAny.refImmediateComposite()

get

public ASMOclAny get(StackFrame frame,
                     java.lang.String name)

Specified by:
get in class ASMModelElement
See Also:
ASMModelElement.get(org.eclipse.m2m.atl.engine.vm.StackFrame, java.lang.String)

asm2EMF

protected java.lang.Object asm2EMF(StackFrame frame,
                                   ASMOclAny value,
                                   java.lang.String propName,
                                   org.eclipse.emf.ecore.EStructuralFeature feature)
Converts an ASM element to its EMF equivalent.

Parameters:
frame - the frame context
value - the element to convert
propName - the property name
feature - the feature which refers to the element
Returns:
the converted element

emf2ASM

protected ASMOclAny emf2ASM(StackFrame frame,
                            java.lang.Object value)
Converts an EMF element to its ASM equivalent.

Parameters:
frame - the frame context
value - the element to convert
Returns:
the converted element

getEENumLiteral

public static org.eclipse.emf.ecore.EEnumLiteral getEENumLiteral(org.eclipse.emf.ecore.EEnum eEnum,
                                                                 java.lang.String id)
Returns the literal matching the given name or literal.

Parameters:
eEnum - the enumeration
id - the name or the literal
Returns:
the literal

set

public void set(StackFrame frame,
                java.lang.String name,
                ASMOclAny value)

Overrides:
set in class ASMModelElement
See Also:
ASMModelElement.set(org.eclipse.m2m.atl.engine.vm.StackFrame, java.lang.String, org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny)

getInstanceById

public static ASMOclAny getInstanceById(StackFrame frame,
                                        ASMEMFModelElement self,
                                        ASMString modelName,
                                        ASMString id)
Returns the instance with the given id. For testing purpose.

Parameters:
frame - the frame context
self - the current element
modelName - the model name
id - the instance id
Returns:
the instance

allInstances

public static ASMOrderedSet allInstances(StackFrame frame,
                                         ASMEMFModelElement self)
Returns all instances of a type.

Parameters:
frame - the frame context
self - the caller type
Returns:
all instances of a type

allInstancesFrom

public static ASMOrderedSet allInstancesFrom(StackFrame frame,
                                             ASMEMFModelElement self,
                                             ASMString sourceModelName)
Returns all instances of a type from a given model. TODO: return type could be a Set because there is no order, in theory However, keeping resource (i.e., XMI) order is sometimes less confusing

Parameters:
frame - the frame context
self - the caller type
sourceModelName - the model name
Returns:
all instances of a type from a given model

newInstance

public static ASMModelElement newInstance(StackFrame frame,
                                          ASMEMFModelElement self)
Creates a new instance of a given type.

Parameters:
frame - the frame context
self - the given type
Returns:
the new element

newInstanceIn

public static ASMModelElement newInstanceIn(StackFrame frame,
                                            ASMEMFModelElement self,
                                            ASMString modelName)
Creates a new instance of a given type.

Parameters:
frame - the frame context
self - the given type
modelName - the model where to create the element
Returns:
the new element

findMethod

protected java.lang.reflect.Method findMethod(java.lang.Class cls,
                                              java.lang.String name,
                                              java.lang.Class[] argumentTypes)
Returns the method which match the given parameters.

Parameters:
cls - the class which contains the method
name - the method name
argumentTypes - th method parameters
Returns:
the method

invoke

public ASMOclAny invoke(StackFrame frame,
                        java.lang.String opName,
                        java.util.List arguments)
Searches for Operation opName in this context and invokes it if found.

Overrides:
invoke in class ASMOclAny
Parameters:
frame - The current stack frame
opName - The Operation's name
arguments - The operation arguments, excluding self
Returns:
The Operation's result or null
See Also:
ASMOclAny.invoke(org.eclipse.m2m.atl.engine.vm.StackFrame, java.lang.String, java.util.List)

invokeSuper

public ASMOclAny invokeSuper(StackFrame frame,
                             java.lang.String opName,
                             java.util.List arguments)
Searches for Operation opName in the superclass context and invokes it if found.

Overrides:
invokeSuper in class ASMOclAny
Parameters:
frame - The current stack frame
opName - The Operation's name
arguments - The operation arguments, excluding self
Returns:
The Operation's result or null
See Also:
ASMOclAny.invokeSuper(org.eclipse.m2m.atl.engine.vm.StackFrame, java.lang.String, java.util.List)

getObject

public org.eclipse.emf.ecore.EObject getObject()
Returns the internal EObject.

Returns:
The internal EObject.

finalize

protected void finalize()
                 throws java.lang.Throwable

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable
See Also:
Object.finalize()

Copyright 2007 IBM Corporation and others.
All Rights Reserved.