**5. Object-oriented programming systems and their representation by the sequential object Petri nets**

This section deals with main principles applied at modeling of multithreading object-oriented programming systems with the sequential object Petri nets. All program listings are developed in the Java programming language (Goetz et. al, 2006), (Lea, 1999), (Subramaniam, 2011).

Each declared class of the object–oriented programming system is in the sequential object Petri net represented by a net page containing declared data items and methods. Their declarations are made by using elements of the net page. Individual input places of the net page then represent input points of static and non-static methods as a part of the class declaration, and output places of the net page then represent their output points. Input and output places of the net page are associated with identifiers of the particular method whose input and output point they represent while each method has one input and output place. In so doing, we abide to the convention whereby input place identifier of the particular method starts with a small letter and identifier of the output place of the same method with a capital letter. In order to differentiate graphically in layouts of the net declaration of static methods from non-static methods on a given net page, we demarcate identifiers of input and output places of the net page representing input and output points of static methods with the square brackets. Moreover, it is possible on the net page via a position of input and output places in its layout represent visibility of *public*, *protected* and *private* type of individual declared methods thus implementing the characteristic of encapsulation of the object-oriented programming.

Figure 10 illustrates the net page representing the following declaration of the class **Sys**:

```
public class Sys { 
 public static void compute() { … } 
 protected void run() { … } 
 private void init() { … }
```
**Figure 10.** Net page representing declaration of class **Sys**

**}** 

Static and non-static data items are on the net pages represented in the form of **tokens** in the given net marking, i.e. by elements of the set *Tokens*. When representing values of static and non-static data items being the elements of particular tokens of the net, it is for example possible to proceed as follows:


Static data items are usually represented in layouts of nets with the tokens containing only their actual values. Non-static data items are usually represented by tokens containing both the value of pointer to a given instance of the class in which the particular data item is declared, and its actual value according to particular data type. So if within the declaration of the class First for example the following data items are declared:

```
public class First { 
 private static boolean indicator = true; 
 private char status = 'a'; 
}
```
210 Petri Nets – Manufacturing and Computer Science

**sequential object Petri nets** 

object-oriented programming.

 **protected void run() { … } private void init() { … }** 

 **public static void compute() { … }** 

**Figure 10.** Net page representing declaration of class **Sys**

**public class Sys {** 

**}** 

**Figure 9.** Conflict transitions in sequential object Petri net

**5. Object-oriented programming systems and their representation by the** 

This section deals with main principles applied at modeling of multithreading object-oriented programming systems with the sequential object Petri nets. All program listings are developed in the Java programming language (Goetz et. al, 2006), (Lea, 1999), (Subramaniam, 2011).

Each declared class of the object–oriented programming system is in the sequential object Petri net represented by a net page containing declared data items and methods. Their declarations are made by using elements of the net page. Individual input places of the net page then represent input points of static and non-static methods as a part of the class declaration, and output places of the net page then represent their output points. Input and output places of the net page are associated with identifiers of the particular method whose input and output point they represent while each method has one input and output place. In so doing, we abide to the convention whereby input place identifier of the particular method starts with a small letter and identifier of the output place of the same method with a capital letter. In order to differentiate graphically in layouts of the net declaration of static methods from non-static methods on a given net page, we demarcate identifiers of input and output places of the net page representing input and output points of static methods with the square brackets. Moreover, it is possible on the net page via a position of input and output places in its layout represent visibility of *public*, *protected* and *private* type of individual declared methods thus implementing the characteristic of encapsulation of the

Figure 10 illustrates the net page representing the following declaration of the class **Sys**:

#### 212 Petri Nets – Manufacturing and Computer Science

then, the static data item **indicator** can be represented by the token **<true>** and the non-static data item **status** by the token **<11, 'a'>**, where numerical value **11** represents the value of the pointer to the particular instance of class.

Sequential Object Petri Nets and the Modeling of Multithreading Object-Oriented Programming Systems 213

The current notation of that net page suggests, that within the program execution modeled by that net two instances of the class **Obj** have been already created, as in the place **Obj.val** appear tokens **<4, 'a'>** a **<6, 'c'>**, where the first element of each of those tokens is the pointer to the instance of the class **Obj** and second the actual value of the non-static data item **val** of the data type *char*. The non-static method **getVal** will be executed above the instance of class with the pointer **4** by the programming thread with the pointer equal to the value **1**, the nonstatic method **setVal** will be executed above the instance of the class with the pointer **6** by the programming thread with the pointer equal to the value **2**, while the value of method parameter **value** equals to character **'b'**. The shape of the net demonstrates, that over the selected instance of the class can be concurrently executed with any programming thread

Additionally, in layouts of nets can be simply represented the relation of a simple inheritance between two declared classes. The identifier of the net page representing the class declaration being superclass of the given class, we indicate in the layout of the given net page of the class in its left bottom corner. If that identifier of the net page of the superclass is not explicitly indicated in the layout of the net, we consider the given class to be implicitly subclass of the top class in the hierarchy of classes created on the basis of relation of simple inheritance of classes (e.g. within the hierarchy of classes of the Java

With the inheritance relation of classes is organically connected even the term of polymorphism of the object-oriented programming and the possibility of declaration of so called virtual methods. Figure 12 shows two net pages out of which the first represents declaration of the class **Object** and the second declaration of the class **System**, being subclass of the class **Object**. Within the class **Object** is also declared virtual method with the head **public int hashCode()**, which is in the declaration of the class **System** overwritten with the virtual method of identical method head. Input and output places of net pages **Object** and **System**, which appertain to input and output points of both virtual methods are indicated in the net layout by default while in the case of declaration of the virtual methods it is necessary that **all input places representing the input point of the given virtual method had assigned on all the net pages containing the declaration of this method the identical value of** *IOPN* **function and all output places representing the output point of the given virtual method had assigned on all relevant net pages the identical value of** 

Next example demonstrates representation of classes containing declaration of virtual and

maximum one of **getVal** or **setVal** methods.

*IOPN* **function** (see Figure 12).

programming language it is the class **java.lang.Object**).

**Figure 12.** Virtual methods representation in sequential object Petri net

abstract methods. **Virt** and **Add** classes are declared as follows:

The dynamic creation of the instance of the class is not in the sequential object Petri net realized by the creation of a new instance of the particular net page representing declaration of the given class, but by creation of all the tokens representing non-static data items of the declared class. At the same time, each such token contains (usually as its first element) the value of the pointer to the newly created class instance. The fact, that during dynamic creation of instances of classes it is not necessary to create instances of net pages, dramatically simplifies its analysis.

All methods represented by elements of the net pages are executed by the programming threads. Each such programming thread is represented by the particular instance of class (usually by the class **Thread**). Thus, the token accepted by the input place of the net page must contain the pointer for particular programming thread realizing execution of the given method, while that pointer is within arc sequences of the net represented by default by some of the identifiers **T**, **U**, **V**, etc. By the element of the token accepted by the input place of the page representing the input point of some of the non-static methods must be then the pointer of the particular instance of class whose non-static method is (i.e. pointer **this**). That pointer is then within the arc sequences of the net standardly represented by the identifier **O** (while indeed, within representation of static methods that pointer cannot be used). When entering identifiers of static and non-static data items, parameters and local variables of methods, we use by default in layouts of the net so called Hungarian notations, where the first letter (or the first part) of identifier expresses its data type. For identification of standard data types we use the acronym **i** even for data type *int*, **b** for *boolean*, **c** for *char*, **s** for *string* and **p** for *pointer*. Hence for example the identifier **sName** within the arc sequence represents the variable of the data type *string* with the identifier **name**.

Figure 11 shows the net page representing the declaration of the following class **Obj** in its marking *M*:

```
public class Obj { 
 private char val = 'a'; 
 public synchronized char getVal() { return value; } 
 public synchronized void setVal(char value) { this.val = value; } 
}
```
**Figure 11.** Net page representing declaration of class **Obj**

The current notation of that net page suggests, that within the program execution modeled by that net two instances of the class **Obj** have been already created, as in the place **Obj.val** appear tokens **<4, 'a'>** a **<6, 'c'>**, where the first element of each of those tokens is the pointer to the instance of the class **Obj** and second the actual value of the non-static data item **val** of the data type *char*. The non-static method **getVal** will be executed above the instance of class with the pointer **4** by the programming thread with the pointer equal to the value **1**, the nonstatic method **setVal** will be executed above the instance of the class with the pointer **6** by the programming thread with the pointer equal to the value **2**, while the value of method parameter **value** equals to character **'b'**. The shape of the net demonstrates, that over the selected instance of the class can be concurrently executed with any programming thread maximum one of **getVal** or **setVal** methods.

212 Petri Nets – Manufacturing and Computer Science

pointer to the particular instance of class.

dramatically simplifies its analysis.

marking *M*:

**}** 

**public class Obj { private char val = 'a';** 

then, the static data item **indicator** can be represented by the token **<true>** and the non-static data item **status** by the token **<11, 'a'>**, where numerical value **11** represents the value of the

The dynamic creation of the instance of the class is not in the sequential object Petri net realized by the creation of a new instance of the particular net page representing declaration of the given class, but by creation of all the tokens representing non-static data items of the declared class. At the same time, each such token contains (usually as its first element) the value of the pointer to the newly created class instance. The fact, that during dynamic creation of instances of classes it is not necessary to create instances of net pages,

All methods represented by elements of the net pages are executed by the programming threads. Each such programming thread is represented by the particular instance of class (usually by the class **Thread**). Thus, the token accepted by the input place of the net page must contain the pointer for particular programming thread realizing execution of the given method, while that pointer is within arc sequences of the net represented by default by some of the identifiers **T**, **U**, **V**, etc. By the element of the token accepted by the input place of the page representing the input point of some of the non-static methods must be then the pointer of the particular instance of class whose non-static method is (i.e. pointer **this**). That pointer is then within the arc sequences of the net standardly represented by the identifier **O** (while indeed, within representation of static methods that pointer cannot be used). When entering identifiers of static and non-static data items, parameters and local variables of methods, we use by default in layouts of the net so called Hungarian notations, where the first letter (or the first part) of identifier expresses its data type. For identification of standard data types we use the acronym **i** even for data type *int*, **b** for *boolean*, **c** for *char*, **s** for *string* and **p** for *pointer*. Hence for example the identifier **sName** within the arc sequence

Figure 11 shows the net page representing the declaration of the following class **Obj** in its

represents the variable of the data type *string* with the identifier **name**.

 **public synchronized void setVal(char value) { this.val = value; }** 

 **public synchronized char getVal() { return value; }** 

**Figure 11.** Net page representing declaration of class **Obj**

Additionally, in layouts of nets can be simply represented the relation of a simple inheritance between two declared classes. The identifier of the net page representing the class declaration being superclass of the given class, we indicate in the layout of the given net page of the class in its left bottom corner. If that identifier of the net page of the superclass is not explicitly indicated in the layout of the net, we consider the given class to be implicitly subclass of the top class in the hierarchy of classes created on the basis of relation of simple inheritance of classes (e.g. within the hierarchy of classes of the Java programming language it is the class **java.lang.Object**).

With the inheritance relation of classes is organically connected even the term of polymorphism of the object-oriented programming and the possibility of declaration of so called virtual methods. Figure 12 shows two net pages out of which the first represents declaration of the class **Object** and the second declaration of the class **System**, being subclass of the class **Object**. Within the class **Object** is also declared virtual method with the head **public int hashCode()**, which is in the declaration of the class **System** overwritten with the virtual method of identical method head. Input and output places of net pages **Object** and **System**, which appertain to input and output points of both virtual methods are indicated in the net layout by default while in the case of declaration of the virtual methods it is necessary that **all input places representing the input point of the given virtual method had assigned on all the net pages containing the declaration of this method the identical value of** *IOPN* **function and all output places representing the output point of the given virtual method had assigned on all relevant net pages the identical value of**  *IOPN* **function** (see Figure 12).

**Figure 12.** Virtual methods representation in sequential object Petri net

Next example demonstrates representation of classes containing declaration of virtual and abstract methods. **Virt** and **Add** classes are declared as follows:

```
public abstract class Virt { 
 public abstract int compute(int a, int b); 
 public int make(int a, int b) { return compute(a, b); } 
}
```

```
public class Add extends Virt { 
 public int compute(int a, int b) { return (a + b); } 
}
```
The **Virt** class is an abstract class with the declared abstract method **compute**. That method is called as a part of the declared method **make** of the **Virt** class. The method **compute** is then overwritten at the level of declaration of the class **Add**, being the subclass of the class **Virt**. The net page representing the declaration of the class **Virt** is shown in Figure 13. Abstract method **compute** is represented only by a pair of the input place **Virt.compute** and the output place **Virt.Compute**. Regarding the fact that it is also declaration of the virtual method, the selection of function *IOPN* values is important (i.e. in our case *IOPN*(**Virt.compute**) = 1 and *IOPN*(**Virt.Compute**) = 2). The key element of the net page is the manner of calling of the virtual method **compute** represented by the multiarc (**Virt.T1**, **Virt.P1**) and its value of input place function *IPF*, the multiarc (**Virt.P1**, **Virt.T2**) and its value of output place function *OPF*. The value of input place function *IPF* of the multiarc (**Virt.T1**, **Virt.P1**) is in the form of **O.compute** (more precisely in the **O.1** form), where identifier **O** represents the pointer of particular instance of non-abstract subclass of class **Virt**, whose non-static method **compute** is executed. The value of identifier **O** is in our case non-constant, ie. generalized at the realization of steps, and depends on binding of the specific token to the arc sequence in the form **<T, O, iA, iB>**, which shares in the given identification of the net execution of transition **Virt.T1**. According to the numerical value bound to identifier **O** the particular net page net will be determined whose value of the function *PN* of numbering net pages is identical with the numerical value bound to the identifier **O**. Then on this net page the input place with the value of *IOPN* function equal to number **1** will be selected (representing the input point of the virtual method **compute**), into which the particular token in the form **<T, O, iA, iB>** will be placed.

Sequential Object Petri Nets and the Modeling of Multithreading Object-Oriented Programming Systems 215

**compute**, which overwrites the abstract method **compute** declared in the body of the class **Virt**. Thus, on the grounds of that fact it is necessary to correctly assign values of *IOPN* function (in our case *IOPN*(**Add.compute**) = 1 and *IOPN*(**Add.Compute**) = 2). An interesting detail of this net page is the way of determination of the addition of integral values bound to variables **iA** and **iB** of the arc sequence of the arc (**Add.compute**, **Add.T1**). The expression in the form **@(iA\*<0>iB\*<0>)** represents length of the sequence formed by concatenation of two sequences: first sequence containing in total **iA** of numbers **0** and the second sequence containing in total **iB** numbers **0** (in this case, it is worth mentioning, that e.g. via the expression in the form

Next generalization of the form of functions *IPF* and *OPF* associated with multiarcs is possible within the sequential object Petri nets to implement the explicit support of the mechanism of **first order and higher order functions** known from functional programming (ie. given method can take another methods as parameters and return the method as the return value). Figure 15 shows the net page of the class **Func** containing declaration of method **call**. Arc sequence of the token accepted by the input place of that method contains a variable **mO**, the value of which is the value of the function *PN* for the net page with the input place **make** and output place **Make**, which are represented by particular integral values of the function *IOPN*. Values of functions *MAF* of multiarcs of the net in the form **mO.make** and **mO.Make**, whose all components are variables and whose values are not determined until particular arc sequence is bound to token of the net, provide general

mechanism for the possibility of declaration of first order and higher order functions.

Example of recursive method represented by the net page can be seen on Figure 16. This static recursive method **fact** of the class **Integer** implements calculation of the value of

**Figure 15.** Higher order function representation in sequential object Petri net

**@(iA\*(iB\*<0>))** product of integral values of variables **iA** a **iB** can be determined).

**Figure 14.** Polymorphism representation in sequential object Petri net

**Figure 13.** Polymorphism representation in sequential object Petri net

Net page representing the declaration of the class **Add**, being the subclass of the class **Virt**, is shown in Figure 14. In the class **Add** is declared the only non-static virtual method **compute**, which overwrites the abstract method **compute** declared in the body of the class **Virt**. Thus, on the grounds of that fact it is necessary to correctly assign values of *IOPN* function (in our case *IOPN*(**Add.compute**) = 1 and *IOPN*(**Add.Compute**) = 2). An interesting detail of this net page is the way of determination of the addition of integral values bound to variables **iA** and **iB** of the arc sequence of the arc (**Add.compute**, **Add.T1**). The expression in the form **@(iA\*<0>iB\*<0>)** represents length of the sequence formed by concatenation of two sequences: first sequence containing in total **iA** of numbers **0** and the second sequence containing in total **iB** numbers **0** (in this case, it is worth mentioning, that e.g. via the expression in the form **@(iA\*(iB\*<0>))** product of integral values of variables **iA** a **iB** can be determined).

**Figure 14.** Polymorphism representation in sequential object Petri net

214 Petri Nets – Manufacturing and Computer Science

 **public abstract int compute(int a, int b);** 

 **public int make(int a, int b) { return compute(a, b); }** 

which the particular token in the form **<T, O, iA, iB>** will be placed.

**Figure 13.** Polymorphism representation in sequential object Petri net

Net page representing the declaration of the class **Add**, being the subclass of the class **Virt**, is shown in Figure 14. In the class **Add** is declared the only non-static virtual method

The **Virt** class is an abstract class with the declared abstract method **compute**. That method is called as a part of the declared method **make** of the **Virt** class. The method **compute** is then overwritten at the level of declaration of the class **Add**, being the subclass of the class **Virt**. The net page representing the declaration of the class **Virt** is shown in Figure 13. Abstract method **compute** is represented only by a pair of the input place **Virt.compute** and the output place **Virt.Compute**. Regarding the fact that it is also declaration of the virtual method, the selection of function *IOPN* values is important (i.e. in our case *IOPN*(**Virt.compute**) = 1 and *IOPN*(**Virt.Compute**) = 2). The key element of the net page is the manner of calling of the virtual method **compute** represented by the multiarc (**Virt.T1**, **Virt.P1**) and its value of input place function *IPF*, the multiarc (**Virt.P1**, **Virt.T2**) and its value of output place function *OPF*. The value of input place function *IPF* of the multiarc (**Virt.T1**, **Virt.P1**) is in the form of **O.compute** (more precisely in the **O.1** form), where identifier **O** represents the pointer of particular instance of non-abstract subclass of class **Virt**, whose non-static method **compute** is executed. The value of identifier **O** is in our case non-constant, ie. generalized at the realization of steps, and depends on binding of the specific token to the arc sequence in the form **<T, O, iA, iB>**, which shares in the given identification of the net execution of transition **Virt.T1**. According to the numerical value bound to identifier **O** the particular net page net will be determined whose value of the function *PN* of numbering net pages is identical with the numerical value bound to the identifier **O**. Then on this net page the input place with the value of *IOPN* function equal to number **1** will be selected (representing the input point of the virtual method **compute**), into

 **public int compute(int a, int b) { return (a + b); }** 

**public abstract class Virt {** 

**public class Add extends Virt {** 

**}** 

**}** 

Next generalization of the form of functions *IPF* and *OPF* associated with multiarcs is possible within the sequential object Petri nets to implement the explicit support of the mechanism of **first order and higher order functions** known from functional programming (ie. given method can take another methods as parameters and return the method as the return value). Figure 15 shows the net page of the class **Func** containing declaration of method **call**. Arc sequence of the token accepted by the input place of that method contains a variable **mO**, the value of which is the value of the function *PN* for the net page with the input place **make** and output place **Make**, which are represented by particular integral values of the function *IOPN*. Values of functions *MAF* of multiarcs of the net in the form **mO.make** and **mO.Make**, whose all components are variables and whose values are not determined until particular arc sequence is bound to token of the net, provide general mechanism for the possibility of declaration of first order and higher order functions.

**Figure 15.** Higher order function representation in sequential object Petri net

Example of recursive method represented by the net page can be seen on Figure 16. This static recursive method **fact** of the class **Integer** implements calculation of the value of factorial function whose parameter is a certain natural number **n**. Recursive algorithm for calculation of factorial of the integer value **n** in the Java programming language is represented by the following listing:

Sequential Object Petri Nets and the Modeling of Multithreading Object-Oriented Programming Systems 217

Moreover, in the sequential object Petri nets can be simply represented declarations of inner classes of the selected class via subpages of the net page. So if for example the class **Obj** which within its declaration contains declaration of its own inner class **InnerObj**, that declaration can be represented by the subpage **InnerObj** of the page **Obj** (see Figure 17)

The representation of declared interfaces, which can contain only declarations of headings of publicly accessible abstract methods, is also easy. Figure 18 shows the representation of interface *Runnable* (identifiers of interface we indicate in layouts of the net with spaced letters) containing declaration of the method with the head **public abstract void run()**.

**6. Example of simple class hierarchy represented by sequential object** 

In this section we will demonstrate how simple hierarchy of the classes via sequential object Petri nets is built. The model of those examples involve selected classes contained in standard library of classes of the Java programming language. (e.g. classes **java.lang.Object**, **java.lang.Thread**, etc.). For better visibility of layouts we usually present individual declared methods in separate figures representing individual parts of the particular net page (while naturally places and transitions of the net which appear in individual parts of the net page and have identical identifiers, always represent the same place or transition of the total page of the net). Thus, top of our hierarchy of classes will be the class **Object**, whose

**Figure 17.** Inner class declaration representation in sequential object Petri net

declaration made in the Java programming language is the following:

 **private Vector<Thread> = new Vector<Thread>; private synchronized static int getPointer() { … }** 

**Figure 18.** Interface declaration in sequential object Petri net

**Petri net** 

**public class Object { private Object monitor; private Thread thread;** 

 **public Object() { … }** 

 **protected void finalize() { … } public void lock() { … } public void unlock() { … }** 

```
public class Integer { 
 public static int fact(int n) { 
 if (n == 1) return 1; 
 else return (n * fact(n – 1)); 
}
```
If the value of the parameter **iN** equals to number 1, the transition **Integer.T4** is enabled and in the output place **Integer.Fact** the token **<T, 1>** is stored, whose first element **T** represents the programming thread and the second element the value of factorial of number 1. If the value of number **iN** is greater than number 1, by enabling the transition **Integer.T2** that number **iN** is substituted by the sequence consisting of **iN** numbers 0, which is then used at recursive call modeled by the multiarc (**Integer.T3**, **Integer.P2**), whose enabling will always result in elimination of one element of that sequence. The programming stack which is used at realization of recursive procedure of the algorithm is represented by the token in the place **Integer.P3** in the form of the sequence **<T, …, iN-2, iN-1, iN>**. At the moment where the sequence composed from 0 numerals contains after the series of recursive calls of algorithm one element (i.e. it is necessary to determine the value of factorial of number 1 within the stop condition of algorithm), the transition **Integer.T4** is enabled and the value of factorial of number 1 is represented in token **<T, 1>** located in the output place **Integer.Fact**. Then, by repeatedly enabling the transition **Integer.T5** and finally the transition **Integer.T6** the return from recursion is implemented with the gradual calculation of the value of factorial function, which is represented in the token of the form **<T, @(iM\*(iF\*0))>**. Following completion of the process of reverse return of recursion in the output place **Integer.Fact** the token in the form **<T, iF>** is stored, whose second element represents the value of factorial of the natural number **iN**.

**Figure 16.** Recursive function representation in sequential object Petri net

Moreover, in the sequential object Petri nets can be simply represented declarations of inner classes of the selected class via subpages of the net page. So if for example the class **Obj** which within its declaration contains declaration of its own inner class **InnerObj**, that declaration can be represented by the subpage **InnerObj** of the page **Obj** (see Figure 17)

**Figure 17.** Inner class declaration representation in sequential object Petri net

The representation of declared interfaces, which can contain only declarations of headings of publicly accessible abstract methods, is also easy. Figure 18 shows the representation of interface *Runnable* (identifiers of interface we indicate in layouts of the net with spaced letters) containing declaration of the method with the head **public abstract void run()**.

**Figure 18.** Interface declaration in sequential object Petri net

216 Petri Nets – Manufacturing and Computer Science

represented by the following listing:

**public class Integer {** 

 **if (n == 1) return 1;** 

**}** 

 **public static int fact(int n) {** 

 **else return (n \* fact(n – 1));** 

factorial function whose parameter is a certain natural number **n**. Recursive algorithm for calculation of factorial of the integer value **n** in the Java programming language is

If the value of the parameter **iN** equals to number 1, the transition **Integer.T4** is enabled and in the output place **Integer.Fact** the token **<T, 1>** is stored, whose first element **T** represents the programming thread and the second element the value of factorial of number 1. If the value of number **iN** is greater than number 1, by enabling the transition **Integer.T2** that number **iN** is substituted by the sequence consisting of **iN** numbers 0, which is then used at recursive call modeled by the multiarc (**Integer.T3**, **Integer.P2**), whose enabling will always result in elimination of one element of that sequence. The programming stack which is used at realization of recursive procedure of the algorithm is represented by the token in the place **Integer.P3** in the form of the sequence **<T, …, iN-2, iN-1, iN>**. At the moment where the sequence composed from 0 numerals contains after the series of recursive calls of algorithm one element (i.e. it is necessary to determine the value of factorial of number 1 within the stop condition of algorithm), the transition **Integer.T4** is enabled and the value of factorial of number 1 is represented in token **<T, 1>** located in the output place **Integer.Fact**. Then, by repeatedly enabling the transition **Integer.T5** and finally the transition **Integer.T6** the return from recursion is implemented with the gradual calculation of the value of factorial function, which is represented in the token of the form **<T, @(iM\*(iF\*0))>**. Following completion of the process of reverse return of recursion in the output place **Integer.Fact** the token in the form **<T, iF>** is stored, whose second element represents the value of factorial of the natural number **iN**.

**Figure 16.** Recursive function representation in sequential object Petri net
