Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "ATL Standard Library"

(updated links to new location)
(improved structure wrt. both VMs, and added information about type encoding)
(4 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
However, some extensions have been made (see [[ATL_FAQ#How_close_is_ATL_navigation_language_from_the_OCL_2.0_standard.3F]]).
 
However, some extensions have been made (see [[ATL_FAQ#How_close_is_ATL_navigation_language_from_the_OCL_2.0_standard.3F]]).
  
For each type ''T'', a CVS link is given to the Java class implementing ''T'' in the ATL virtual machine.
+
This page describes how the ATL standard library is implemented in the two ATL Virtual Machines (VMs) available from ''Eclipse.org''.
 +
 
 +
__TOC__
 +
 
 +
 
 +
== EMF VM Implementation ==
 +
 
 +
In EMFVM, the ATL standard library is mostly implemented in the [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/plugins/org.eclipse.m2m.atl.engine.emfvm/src/org/eclipse/m2m/atl/engine/emfvm/lib/ExecEnv.java?root=Modeling_Project&view=markup ExecEnv] Java class.
 +
Most types are not wrapped, and Java objects are used directly in many cases.
 +
 
 +
== Regular VM Implementation ==
 +
 
 +
In the Regular VM, Java objects are wrapped by specific objects (instances of subclasses of [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/plugins/org.eclipse.m2m.atl.engine.vm/src/org/eclipse/m2m/atl/engine/vm/nativelib/ASMOclAny.java?root=Modeling_Project&view=markup ASMOclAny]).
 +
In the description that follows, for each type ''T'' a CVS link is given to the Java class implementing ''T'' in the Regular ATL virtual machine.
 
In each class, operations available from the ATL language (as opposed to implementation-specific methods) are represented as Java methods located below the following comment:
 
In each class, operations available from the ATL language (as opposed to implementation-specific methods) are represented as Java methods located below the following comment:
  
Line 20: Line 33:
 
   // Additional Operations
 
   // Additional Operations
  
All of these Java classes are located in the [http://dev.eclipse.org/viewcvs/indextech.cgi/org.eclipse.gmt/ATL/org.atl.engine.vm/src/org/atl/engine/vm/nativelib/ org.atl.engine.vm.nativelib] package.
+
All of these Java classes are located in the [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/deprecated/org.atl.engine.vm/src/org/atl/engine/vm/nativelib/?root=Modeling_Project org.atl.engine.vm.nativelib] package.
  
 
When the description given here is not complete enough, it is possible to go and read the Java implementation.
 
When the description given here is not complete enough, it is possible to go and read the Java implementation.
This way, it is possible to know, for instance: the list of available operations and their semantics (e.g. operation String.regexReplaceAll(a : String, b : String) is implemented in [http://dev.eclipse.org/viewcvs/indextech.cgi/org.eclipse.gmt/ATL/org.atl.engine.vm/src/org/atl/engine/vm/nativelib/ASMString.java?rev=HEAD&content-type=text/vnd.viewcvs-markup ASMString] using [http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#replaceAll(java.lang.String,%20java.lang.String) java.lang.String.replaceAll(String a, String b)]).
+
This way, it is possible to know, for instance: the list of available operations and their semantics (e.g. operation String.regexReplaceAll(a : String, b : String) is implemented in [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/deprecated/org.atl.engine.vm/src/org/atl/engine/vm/nativelib/ASMString.java?root=Modeling_Project&rev=HEAD&content-type=text/vnd.viewcvs-markup ASMString] using [http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#replaceAll(java.lang.String,%20java.lang.String) java.lang.String.replaceAll(String a, String b)]).
  
__TOC__
 
  
==Primitive Types==
+
===Primitive Types===
  
===Boolean===
+
====Boolean====
The ''Boolean'' OCL type is implemented by the [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/deprecated/org.atl.engine.vm/src/org/atl/engine/vm/nativelib/ASMBoolean.java?root=Modeling_Project&rev=HEAD&content-type=text/vnd.viewcvs-markup ASMBoolean] Java class.
+
The ''Boolean'' OCL type is implemented by the [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/plugins/org.eclipse.m2m.atl.engine.vm/src/org/eclipse/m2m/atl/engine/vm/nativelib/ASMBoolean.java?root=Modeling_Project&view=markup ASMBoolean] ([http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/deprecated/org.atl.engine.vm/src/org/atl/engine/vm/nativelib/ASMBoolean.java?root=Modeling_Project&rev=HEAD&content-type=text/vnd.viewcvs-markup deprecated version]) Java class.
 
The underlying Java type is '''boolean'''.
 
The underlying Java type is '''boolean'''.
  
===Integer===
+
====Integer====
  
The ''Integer'' OCL type is implemented by the [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/deprecated/org.atl.engine.vm/src/org/atl/engine/vm/nativelib/ASMInteger.java?root=Modeling_Project&rev=HEAD&content-type=text/vnd.viewcvs-markup ASMInteger] Java class.
+
The ''Integer'' OCL type is implemented by the [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/plugins/org.eclipse.m2m.atl.engine.vm/src/org/eclipse/m2m/atl/engine/vm/nativelib/ASMInteger.java?root=Modeling_Project&view=markup ASMInteger] ([http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/deprecated/org.atl.engine.vm/src/org/atl/engine/vm/nativelib/ASMInteger.java?root=Modeling_Project&rev=HEAD&content-type=text/vnd.viewcvs-markup deprecated version]) Java class.
 
The underlying Java type is '''int'''.
 
The underlying Java type is '''int'''.
  
===Real===
+
====Real====
  
The ''Real'' OCL type is implemented by the [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/deprecated/org.atl.engine.vm/src/org/atl/engine/vm/nativelib/ASMReal.java?root=Modeling_Project&rev=HEAD&content-type=text/vnd.viewcvs-markup ASMReal] Java class.
+
The ''Real'' OCL type is implemented by the [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/plugins/org.eclipse.m2m.atl.engine.vm/src/org/eclipse/m2m/atl/engine/vm/nativelib/ASMReal.java?root=Modeling_Project&view=markup ASMReal] ([http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/deprecated/org.atl.engine.vm/src/org/atl/engine/vm/nativelib/ASMReal.java?root=Modeling_Project&rev=HEAD&content-type=text/vnd.viewcvs-markup deprecated version]) Java class.
 
The underlying Java type is '''double'''.
 
The underlying Java type is '''double'''.
  
===String===
+
====String====
  
The ''String'' OCL type is implemented by the [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/deprecated/org.atl.engine.vm/src/org/atl/engine/vm/nativelib/ASMString.java?root=Modeling_Project&rev=HEAD&content-type=text/vnd.viewcvs-markup ASMString] Java class.
+
The ''String'' OCL type is implemented by the [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/plugins/org.eclipse.m2m.atl.engine.vm/src/org/eclipse/m2m/atl/engine/vm/nativelib/ASMString.java?root=Modeling_Project&view=markup ASMString] ([http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/deprecated/org.atl.engine.vm/src/org/atl/engine/vm/nativelib/ASMString.java?root=Modeling_Project&rev=HEAD&content-type=text/vnd.viewcvs-markup deprecated version]) Java class.
 
The underlying Java type is [http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html java.lang.String].
 
The underlying Java type is [http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html java.lang.String].
  
==Collection Types==
+
===Collection Types===
  
===Collection===
+
====Collection====
  
The ''Collection'' OCL type is implemented by the [http://dev.eclipse.org/viewcvs/indextech.cgi/org.eclipse.gmt/ATL/org.atl.engine.vm/src/org/atl/engine/vm/nativelib/ASMCollection.java?rev=HEAD&content-type=text/vnd.viewcvs-markup ASMCollection] Java class.
+
The ''Collection'' OCL type is implemented by the [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/plugins/org.eclipse.m2m.atl.engine.vm/src/org/eclipse/m2m/atl/engine/vm/nativelib/ASMCollection.java?root=Modeling_Project&view=markup ASMCollection] ([http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/deprecated/org.atl.engine.vm/src/org/atl/engine/vm/nativelib/ASMCollection.java?root=Modeling_Project&rev=HEAD&content-type=text/vnd.viewcvs-markup deprecated version]) Java class.
 
There is no underlying Java type for this abstract type.
 
There is no underlying Java type for this abstract type.
 
However, all concrete collection types are implemented by sub-classes of [http://java.sun.com/j2se/1.4.2/docs/api/java/util/Collection.html java.util.Collection].
 
However, all concrete collection types are implemented by sub-classes of [http://java.sun.com/j2se/1.4.2/docs/api/java/util/Collection.html java.util.Collection].
  
===Bag===
+
====Bag====
  
The ''Bag'' OCL type is implemented by the [http://dev.eclipse.org/viewcvs/indextech.cgi/org.eclipse.gmt/ATL/org.atl.engine.vm/src/org/atl/engine/vm/nativelib/ASMBag.java?rev=HEAD&content-type=text/vnd.viewcvs-markup ASMBag] Java class.
+
The ''Bag'' OCL type is implemented by the [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/plugins/org.eclipse.m2m.atl.engine.vm/src/org/eclipse/m2m/atl/engine/vm/nativelib/ASMBag.java?root=Modeling_Project&view=markup ASMBag] ([http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/deprecated/org.atl.engine.vm/src/org/atl/engine/vm/nativelib/ASMBag.java?root=Modeling_Project&rev=HEAD&content-type=text/vnd.viewcvs-markup deprecated version]) Java class.
 
The underlying Java type is [http://java.sun.com/j2se/1.4.2/docs/api/java/util/ArrayList.html java.util.ArrayList].
 
The underlying Java type is [http://java.sun.com/j2se/1.4.2/docs/api/java/util/ArrayList.html java.util.ArrayList].
  
===OrderedSet===
+
====OrderedSet====
  
The ''OrderedSet'' OCL type is implemented by the [http://dev.eclipse.org/viewcvs/indextech.cgi/org.eclipse.gmt/ATL/org.atl.engine.vm/src/org/atl/engine/vm/nativelib/ASMOrderedSet.java?rev=HEAD&content-type=text/vnd.viewcvs-markup ASMOrderedSet] Java class.
+
The ''OrderedSet'' OCL type is implemented by the [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/plugins/org.eclipse.m2m.atl.engine.vm/src/org/eclipse/m2m/atl/engine/vm/nativelib/ASMOrderedSet.java?root=Modeling_Project&view=markup ASMOrderedSet] ([http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/deprecated/org.atl.engine.vm/src/org/atl/engine/vm/nativelib/ASMOrderedSet.java?root=Modeling_Project&rev=HEAD&content-type=text/vnd.viewcvs-markup deprecated version]) Java class.
 
The underlying Java type is [http://java.sun.com/j2se/1.4.2/docs/api/java/util/LinkedHashSet.html java.util.LinkedHashSet].
 
The underlying Java type is [http://java.sun.com/j2se/1.4.2/docs/api/java/util/LinkedHashSet.html java.util.LinkedHashSet].
  
===Sequence===
+
====Sequence====
  
The ''Sequence'' OCL type is implemented by the [http://dev.eclipse.org/viewcvs/indextech.cgi/org.eclipse.gmt/ATL/org.atl.engine.vm/src/org/atl/engine/vm/nativelib/ASMSequence.java?rev=HEAD&content-type=text/vnd.viewcvs-markup ASMSequence] Java class.
+
The ''Sequence'' OCL type is implemented by the [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/plugins/org.eclipse.m2m.atl.engine.vm/src/org/eclipse/m2m/atl/engine/vm/nativelib/ASMSequence.java?root=Modeling_Project&view=markup ASMSequence] ([http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/deprecated/org.atl.engine.vm/src/org/atl/engine/vm/nativelib/ASMSequence.java?root=Modeling_Project&rev=HEAD&content-type=text/vnd.viewcvs-markup deprecated version]) Java class.
 
The underlying Java type is [http://java.sun.com/j2se/1.4.2/docs/api/java/util/ArrayList.html java.util.ArrayList].
 
The underlying Java type is [http://java.sun.com/j2se/1.4.2/docs/api/java/util/ArrayList.html java.util.ArrayList].
  
===Set===
+
====Set====
  
The ''Set'' OCL type is implemented by the [http://dev.eclipse.org/viewcvs/indextech.cgi/org.eclipse.gmt/ATL/org.atl.engine.vm/src/org/atl/engine/vm/nativelib/ASMSet.java?rev=HEAD&content-type=text/vnd.viewcvs-markup ASMSet] Java class.
+
The ''Set'' OCL type is implemented by the [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/plugins/org.eclipse.m2m.atl.engine.vm/src/org/eclipse/m2m/atl/engine/vm/nativelib/ASMSet.java?root=Modeling_Project&view=markup ASMSet] ([http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/deprecated/org.atl.engine.vm/src/org/atl/engine/vm/nativelib/ASMSet.java?root=Modeling_Project&rev=HEAD&content-type=text/vnd.viewcvs-markup deprecated version]) Java class.
 
The underlying Java type is [http://java.sun.com/j2se/1.4.2/docs/api/java/util/HashSet.html java.util.HashSet].
 
The underlying Java type is [http://java.sun.com/j2se/1.4.2/docs/api/java/util/HashSet.html java.util.HashSet].
  
==Additional Types==
+
===Additional Types===
  
 
The types described in this section are not part of the OCL 2.0 specification.
 
The types described in this section are not part of the OCL 2.0 specification.
  
===Map===
+
====Map====
  
The ''Map'' OCL type is implemented by the [http://dev.eclipse.org/viewcvs/indextech.cgi/org.eclipse.gmt/ATL/org.atl.engine.vm/src/org/atl/engine/vm/nativelib/ASMMap.java?rev=HEAD&content-type=text/vnd.viewcvs-markup ASMMap] Java class.
+
The ''Map'' OCL type is implemented by the [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/plugins/org.eclipse.m2m.atl.engine.vm/src/org/eclipse/m2m/atl/engine/vm/nativelib/ASMMap.java?root=Modeling_Project&view=markup ASMMap] ([http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/deprecated/org.atl.engine.vm/src/org/atl/engine/vm/nativelib/ASMMap.java?root=Modeling_Project&rev=HEAD&content-type=text/vnd.viewcvs-markup deprecated version]) Java class.
 
The underlying Java type is [http://java.sun.com/j2se/1.4.2/docs/api/java/util/HashMap.html java.util.HashMap].
 
The underlying Java type is [http://java.sun.com/j2se/1.4.2/docs/api/java/util/HashMap.html java.util.HashMap].
 +
 +
==In the Bytecode Files (.asm)==
 +
 +
Types are encoded using a scheme described in the Javadoc of class [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.atl/plugins/org.eclipse.m2m.atl.engine.vm/src/org/eclipse/m2m/atl/engine/vm/ASMInterpreter.java?revision=1.8&root=Modeling_Project&view=markup ASMInterpreter].
 +
This type encoding is also implemented at the beginning of [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org.eclipse.m2m.atl/dsls/ATL/Compiler/ATL.acg?root=Modeling_Project&view=markup the ATL compiler].
 +
  
 
[[Category:ATL]]
 
[[Category:ATL]]

Revision as of 07:15, 16 June 2009

< To: ATL

The ATL standard library consists of the types built into ATL and of their operations. It is based on the OCL 2.0 standard library as described in chapter 11 of the UML 2.0 OCL Final Adopted specification. However, some extensions have been made (see ATL_FAQ#How_close_is_ATL_navigation_language_from_the_OCL_2.0_standard.3F).

This page describes how the ATL standard library is implemented in the two ATL Virtual Machines (VMs) available from Eclipse.org.


EMF VM Implementation

In EMFVM, the ATL standard library is mostly implemented in the ExecEnv Java class. Most types are not wrapped, and Java objects are used directly in many cases.

Regular VM Implementation

In the Regular VM, Java objects are wrapped by specific objects (instances of subclasses of ASMOclAny). In the description that follows, for each type T a CVS link is given to the Java class implementing T in the Regular ATL virtual machine. In each class, operations available from the ATL language (as opposed to implementation-specific methods) are represented as Java methods located below the following comment:

 // Native Operations Below

In some of these classes, there are two additional comments delimiting:

  • Operations specified by OCL 2.0:
 // OCL Operations
  • Operations added in ATL:
 // Additional Operations

All of these Java classes are located in the org.atl.engine.vm.nativelib package.

When the description given here is not complete enough, it is possible to go and read the Java implementation. This way, it is possible to know, for instance: the list of available operations and their semantics (e.g. operation String.regexReplaceAll(a : String, b : String) is implemented in ASMString using java.lang.String.replaceAll(String a, String b)).


Primitive Types

Boolean

The Boolean OCL type is implemented by the ASMBoolean (deprecated version) Java class. The underlying Java type is boolean.

Integer

The Integer OCL type is implemented by the ASMInteger (deprecated version) Java class. The underlying Java type is int.

Real

The Real OCL type is implemented by the ASMReal (deprecated version) Java class. The underlying Java type is double.

String

The String OCL type is implemented by the ASMString (deprecated version) Java class. The underlying Java type is java.lang.String.

Collection Types

Collection

The Collection OCL type is implemented by the ASMCollection (deprecated version) Java class. There is no underlying Java type for this abstract type. However, all concrete collection types are implemented by sub-classes of java.util.Collection.

Bag

The Bag OCL type is implemented by the ASMBag (deprecated version) Java class. The underlying Java type is java.util.ArrayList.

OrderedSet

The OrderedSet OCL type is implemented by the ASMOrderedSet (deprecated version) Java class. The underlying Java type is java.util.LinkedHashSet.

Sequence

The Sequence OCL type is implemented by the ASMSequence (deprecated version) Java class. The underlying Java type is java.util.ArrayList.

Set

The Set OCL type is implemented by the ASMSet (deprecated version) Java class. The underlying Java type is java.util.HashSet.

Additional Types

The types described in this section are not part of the OCL 2.0 specification.

Map

The Map OCL type is implemented by the ASMMap (deprecated version) Java class. The underlying Java type is java.util.HashMap.

In the Bytecode Files (.asm)

Types are encoded using a scheme described in the Javadoc of class ASMInterpreter. This type encoding is also implemented at the beginning of the ATL compiler.

Copyright © Eclipse Foundation, Inc. All Rights Reserved.