User Tools

Site Tools


padl

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
padl [2014/02/16 09:44]
yann
padl [2019/10/06 20:37] (current)
Line 5: Line 5:
 ===== Levels of Models ===== ===== Levels of Models =====
  
-There are three different levels of abstractions to model programs, collectively called abstract-level models:+There are four different levels of abstractions to model programs, collectively called abstract-level models:
  
     * A ''​ICodeLevelModel''​ represents the "​raw"​ model of a program, including only data directly extractable from the program source representation (Java bytecodes, Java source code, C/C++ source code...);     * A ''​ICodeLevelModel''​ represents the "​raw"​ model of a program, including only data directly extractable from the program source representation (Java bytecodes, Java source code, C/C++ source code...);
Line 70: Line 70:
 </​code>​ </​code>​
  
-Obviously, the class ''​padl.creator.classfile.test.creator.InheritanceImplementationCounter'​ implements ''​padl.visitor.IWalker''​.+Obviously, the class ''​padl.creator.classfile.test.creator.InheritanceImplementationCounter'' implements ''​padl.visitor.IWalker''​.
  
  
Line 76: Line 76:
 ===== Method Invocations ===== ===== Method Invocations =====
  
-As part of an effort to improve code representation in PADL. The concept of method invocation has been added since 2004-2005. An interface IMethodInvocation represents method invocations. This concept is as-of-today not quite clean and is used to describes both method invocations and field accesses. Therefore, the interface IMethodInvocation (and its reference implementation) includes:+As part of an effort to improve code representation in PADL. The concept of method invocation has been added since 2004-2005. An interface ​''​padl.kernel.IMethodInvocation'' ​represents method invocations. This concept is as-of-today not quite clean and is used to describes both method invocations and field accesses. Therefore, the interface ​''​padl.kernel.IMethodInvocation'' ​(and its reference implementation) includes:
  
-    * a IMethod container that is the calling method (in which the method invocation can be found.) (Dirty Hack.)+    * a ''​padl.kernel.IMethod'' ​container that is the calling method (in which the method invocation can be found.) (Dirty Hack.)
  
-    * a int cardinality that describes the cardinality of the call+    * a ''​int cardinality''​ value that describes the cardinality of the call
       * 1 = unique call;       * 1 = unique call;
       * 2 = repetitions of the call;       * 2 = repetitions of the call;
  
-    * a int type that characterises the type of method invocation:​ +    * a ''​int type''​ value that characterises the type of method invocation:​ 
-      * CLASS_CLASS:​ method invocation from a class method to another class method; +      * ''​CLASS_CLASS''​: method invocation from a class method to another class method; 
-      * CLASS_CLASS_FROM_FIELD:​ method invocation from a class method to another class method through a class variable; +      * ''​CLASS_CLASS_FROM_FIELD''​: method invocation from a class method to another class method through a class variable; 
-      * CLASS_INSTANCE:​ method invocation from a class method to an instance method; +      * ''​CLASS_INSTANCE''​: method invocation from a class method to an instance method; 
-      * CLASS_INSTANCE_FROM_FIELD:​ method invocation from a class method to an instance method through a class variable; +      * ''​CLASS_INSTANCE_FROM_FIELD''​: method invocation from a class method to an instance method through a class variable; 
-      * INSTANCE_CLASS:​ method invocation from an instance method to a class method; +      * ''​INSTANCE_CLASS''​: method invocation from an instance method to a class method; 
-      * INSTANCE_CLASS_FROM_FIELD:​ method invocation from an instance method to a class method through an instance variable; +      * ''​INSTANCE_CLASS_FROM_FIELD''​: method invocation from an instance method to a class method through an instance variable; 
-      * INSTANCE_CREATION:​ creation of a new instance; +      * ''​INSTANCE_CREATION''​: creation of a new instance; 
-      * INSTANCE_INSTANCE:​ method invocation from an instance method to another instance method; +      * ''​INSTANCE_INSTANCE''​: method invocation from an instance method to another instance method; 
-      * INSTANCE_INSTANCE_FROM_FIELD:​ method invocation from an instance method to another instance method through an instance variable; +      * ''​INSTANCE_INSTANCE_FROM_FIELD''​: method invocation from an instance method to another instance method through an instance variable; 
-      * OTHER: other things... such as field accesses! ([[Dirty Hack]].)+      * ''​OTHER''​: other things... such as field accesses! ([[Dirty Hack]].)
  
-    * IEntity targetEntitythe entity declaring the called method. ([[Dirty Hack]].)+    * an ''​IEntity targetEntity''​ that references ​the entity declaring the called method. ([[Dirty Hack]].)
  
-    * int visibilitythe visibility of the called method. ([[Dirty Hack]].)+    * an ''​int visibility''​ values that is the visibility of the called method. ([[Dirty Hack]].)
  
-    * IAbstractMethod calledMethoda reference to the called method.+    * an ''​IAbstractMethod calledMethod''​ that is a reference to the called method.
  
-    * List callingFieldsa list of the fields (if any) through which the called method is invoked. ([[Fragile Code]].)+    * a ''​List callingFields''​ that is a list of the fields (if any) through which the called method is invoked. ([[Fragile Code]].)
  
-    * IEntity fieldDeclaringEntity: a reference to the IEntity declaring the (last) field through which the called method is invoked. ([[Dirty Hack]].)+    * an ''​IEntity fieldDeclaringEntity''​ referencing ​the ''​IEntity'' ​declaring the (last) field through which the called method is invoked. ([[Dirty Hack]].)
  
  
  
-===== ''​getName()'' ​and ''​getPath()''​ Methods ​=====+===== Names and Paths =====
  
-Although the getID(), getName(), and getPath() methods form a trio, they have different semantics. The getID() must return a unique identifier for each constituent in a model. ​The getName() returns the name of a constituent. For binary class relationships and method invocations,​ the name returned by getName() is less important, it could simply be Method Invocation, for example. ​(Their ID must still be unique, though.)+The ''​getName()''​ always ​returns the simple ​name of a constituent. For binary-class relationships and method invocations,​ the name returned by ''​getName()'' ​is less important, it could simply be ''​Method Invocation''​, for example. ​For a first-class entity, though, it is important, for example ''​getName()''​ returns ''​IConstituent''​ for ''​padl.kernel.IConstituent''​. Here are other examples of ''​getName()''​ values:
  
-Here are some examples of getID() :+    * ''​padl''​ for a package;
  
-    * padl for a package;+    * ''​getName()'' ​for a method;
  
-    * getName() for a method;+    * ''​setName(char[])'' ​for a method;
  
-    * setName(java.lang.String) ​for a method;+    * ''​name'' ​for an attribute;
  
-    * addA(int, padl.example.aggregation.A) ​for a method;+    * ''​NaturalOrderComparator'' ​for a member class.
  
-    * name for an attribute.+The paths are used to name and address each constituent uniquely within a model but consistently across modelsThe paths start with a '/'​ and the name of the model. Then, it includes the name, as in ''​getName()'',​ of each constituent to go through until the name of the current constituent is reached. Here are some examples of ''​getPath()''​ values:
  
-    * Member ​for a member class, member interface, or member ghost.+    * ''/​PADL|padl'' ​for a package;
  
-Here are some examples of getName() ​:+    * ''/​PADL|padl|kernel|padl.kernel.IConstituent|getName()''​ for a method;
  
-    * padl for a package;+    * ''/​PADL|padl|kernel|padl.kernel.IConstituent|setName(char[])'' ​for a method;
  
-    * getName ​for a method;+    * ''/​PADL|padl|kernel|impl|padl.kernel.impl.Constituent|name'' ​for an attribute;
  
-    * setName ​for a method;+    * ''/​PADL|padl|kernel|impl|padl.kernel.impl.GenericContainerOfNaturallyOrderedConstituents$NaturalOrderComparator'' ​for a member class.
  
-    * addA for a method;+The class ''​padl.path.Finder''​ in the ''​PADL''​ project can be used to walk the paths.
  
-    * name for an attribute.+===== Visitors =====
  
-    * Member for a member class, member interface, or member ghost. +The PADL metamodel provide two types of visitors ​to allow third-party ​to analyse PADL modelsIt follows the standard API for visitors but with a twist for the implementationUnderstading ​the PADL visitors [[http://www.ptidej.net/​team/​photos/​180306 ​Understanding PADL Visitor|is easy]]!
- +
-The paths are used to represent how to get to a constituent within a model. +
- +
-The paths start with a '/'​ and the name of the model (optional). +
- +
-Then, each constituent to go through until the target is specified ​the same way: +
- +
-   - the '​|'​ character,​ +
-   - the (simple) name of the interface in padl.kernel of the constituent (or one of its super-interface,​ but always in padl.kernel), +
-   the ':'​ character,​ +
-   - a constituent specific part: +
-     * If the constituent ​is an Operation, its name, a '​(',​ the list of the TypeName of the types of its arguments separated by a ','​ (if any), a '​)'​ +
-     * Its name otherwise +
- +
-The class padl.path.Finder can be used to walk the paths.+
padl.1392543870.txt.gz · Last modified: 2019/10/06 20:37 (external edit)