XES - Programmers Guide - nodeMethod

Method Declaration and Definition

The method node always occurs under a class node. It is used to declare and/or define a method of a class.

Unlike variables and classes, method is only used to define a method, a seperate node 'call' is used to call the method.

Attributes used

Child Elements

Each parameter is defined in a nodeParameter node or nodes, these are grouped together under a nodeParameterList. If there are any nodeParameterList nodes then they should be before any other child nodes (apart possibly from comment nodes)

If there are any "throws" they are grouped together in a nameList node which will be the second child immediately after the nodeParameter (assuming there are no comments)

Other possible child elements of classDef are:

Schema entry

	<xs:complexType name="methodType">
<xs:sequence>
<xs:element name="parameterList" type="parameterListType"/>
<xs:element name="tags" type="tagList"/>
<xs:element name="meta" type="xs:string"/>
<xs:element name="variable" type="variableType"/>
<xs:element name="call" type="callType"/>
<xs:element name="comment" type="commentType"/>
<xs:element name="if" type="ifType"/>
<xs:element name="loop" type="loopType"/>
<xs:element name="switch" type="switchType"/>
<xs:element name="try" type="tryType"/>
<xs:element name="break" type="breakType"/>
<xs:element name="return" type="returnType"/>
<xs:element name="block" type="blockType"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="public" type="xs:boolean"/>
<xs:attribute name="private" type="xs:boolean"/>
<xs:attribute name="protected" type="xs:boolean"/>
<xs:attribute name="static" type="xs:boolean"/>
<xs:attribute name="abstract" type="xs:boolean"/>
<xs:attribute name="native" type="xs:boolean"/>
<xs:attribute name="synchonised" type="xs:boolean"/>
<xs:attribute name="final" type="xs:boolean"/>
</xs:complexType>
<xs:complexType name="parameterListType">
<xs:sequence>
<xs:element name="comment" type="commentType"/>
<xs:element name="parameter" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="comment" type="commentType"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="tagType" type="xs:string"/>
<xs:attribute name="tagValue" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>

Possible Improvements

 

Examples of usage

usage java example XES example
constructor

public class myClass {
myClass(){
}
}

<class name="myClass" public="true">
<method constructor="true" name="myClass">
<parameterList/>
</method>
</class>
protected modifier protected myMethod() {
}
<method constructor="true" name="myMethod" protected="true">
<parameterList/>
</method>
private modifier private myMethod() {
}
<method constructor="true" name="myMethod" private="true">
<parameterList/>
</method>
abstract modifier abstract myMethod() {
}
<method abstract="true" constructor="true" name="myMethod">
<parameterList/>
</method>
static modifier static myMethod() {
}
<method constructor="true" name="myMethod" static="true">
<parameterList/>
</method>
final modifier final myMethod() {
}
<method constructor="true" final="true" name="myMethod">
<parameterList/>
</method>
synchronized modifier synchronized myMethod() {
}
<method constructor="true" name="myMethod" synchronized="true">
<parameterList/>
</method>
native modifier native myMethod() {
}
<method constructor="true" name="myMethod" native="true">
<parameterList/>
</method>
transient modifier transient myMethod() {
}
<method constructor="true" name="myMethod" transient="true">
<parameterList/>
</method>
strictfp modifier strictfp myMethod() {
}
<method constructor="true" name="myMethod" strictfp="true">
<parameterList/>
</method>
native parameter myMethod(int i) {
}
<method constructor="true" name="myMethod">
<parameterList>
<parameter name="i" type="int"/>
</parameterList>
</method>
native parameter myMethod(myClass mc){
}
<method constructor="true" name="myMethod">
<parameterList>
<parameter name="mc" type="myClass"/>
</parameterList>
</method>
native and reference parameter myMethod(int i,myClass mc) {
}
<method constructor="true" name="myMethod">
<parameterList>
<parameter name="i" type="int"/>
<parameter name="mc" type="myClass"/>
</parameterList>
</method>
native return type int myMethod(){} <method name="myMethod" type="int">
<parameterList/>
</method>
native return type myReturnType myMethod(){} <method name="myMethod" type="myReturnType">
<parameterList/>
</method>
generics public < T > void genericMethod(Stack < T > stack){} <method genericsType="T" name="genericMethod" public="true" type="void">
<parameterList>
<parameter genericsType="T" name="stack" type="Stack"/>
</parameterList>
</method>
throw public void myMethod() throws myError{} <method name="myMethod" public="true" type="void">
<parameterList/>
<nameList elementName="throws" name="myError"/>
</method>
multiple throws public void myMethod() throws myError1,myError2{} <method name="myMethod" public="true" type="void">
<parameterList/>
<nameList elementName="throws" name="myError1,myError2"/>
</method>
abstract class public abstract class myClass{
public abstract void myMethod();
}
<class abstract="true" def="true" name="myClass" public="true">
<method abstract="true" name="myMethod" public="true" type="void">
<parameterList/>
</method>
</class>
     

Mapping to other languages

Modifiers

XES java C# C++
  public public  
  protected protected  
  private private  
  abstract (an abstract method can only be declaired in an abstract class) abstract  
  static    
       
  strictfp    
  native new  
  synchronized internal  
    sealed  
    unsafe  

Java

public int getValue(String value) throws IOExeption {
   ...
} 

Scala

def getValue(value: String) unit= {
    ... 
} 

metadata block
see also:

 

Correspondence about this page

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2023 Martin John Baker - All rights reserved - privacy policy.