Skip to content
Crescencio Lima edited this page Jun 20, 2019 · 37 revisions

We create a simple example is to illustrate our PLA recovery approach. Next, we present two fictitious variants. Variant_1 was initially developed from scratch and then Variant_2 was developed by reusing the former variant using opportunistic reuse. The approach steps are presented in the following subsections.

Variant_1 source code analysis and extraction

We implemented a class called Class_A that calls the method foo() implemented by Class_B}.

package package_X;

public class Class_A {
	private int test_1;
	
	public Class_A(Class_B B){
		test_1 = B.foo(); 
	}
}

Next, we implemented the Class_B constructor and the method foo(). We grouped classes Class_A and Class_B in the package_X.

package package_X;

public class Class_B {
	public Class_B(){}
	
	int foo(){
		return 0; 
	}
}

Extracting the trivial graph (*.tgf) of Variant_1 with Stan4J

We extract the information in packages and classes. Follow the steps described in this guideline.

Next, we describe the *.tgf file with Variant_1 package information:

1 package_X
#

Visual representation of the extracted package information created with Stan4J:

Next, we describe the *.tgf file with Variant_1 class information:

1 Class_A
2 Class_B
#
1 2 2

Visual representation of the extracted class information created with Stan4J:

Variant_2 source code analysis and extraction

Following, we present the Variant_2 source code. Class_B constructor calls the zoo() method implemented by Class_C.

package package_X;
import package_Y.*;

public class Class_B {
	private int test_2;
	public Class_B(Class_C C){
		test_2 = C.zoo(); 
	}
	
	int foo(){
		return 0; 
	}
}

Next, we describe Variant_2 implementation of Class_C. We organised the development project in two packages, package_X and package_Y.

package package_Y;

public class Class_C {
	public int zoo(){
		return 1; }
}

Extracting the trivial graph (*.tgf) of Variant_2 with Stan4J

We extract the information in packages and classes. Follow the steps described in this guideline.

Next, we describe the *.tgf file with Variant_2 package information:

1 package_X
2 package_Y
#
1 2 2

Visual representation of the extracted package information created with Stan4J:

Next, we describe the *.tgf file with Variant_2 class information:

1 Class_B
2 Class_C
#
1 2 1

Visual representation of the extracted class information created with Stan4J:

Running the PLAR-tool

Run the PLAR-tool executable. Follow the steps described in this guideline. Following, we present the recovered information both in packages and classes analysis.

For more information

Did this user manual help you somehow? How can we improve it and provide information that you need? Please send your comments and suggestions to Crescencio Lima.

Clone this wiki locally