-
Notifications
You must be signed in to change notification settings - Fork 1
Simulation Mode of RefGen
For any technical problems, please open an issue.
The simulation mode can run in console without Eclipse.
You only need to copy the RefGen.jar file from lib folder, and copy the file config.prop
from the root of this repository, to a local folder in your computer.
The config.prop contains different parameters to execute RefGen.Jar
Normally you should not modify this parameters, except for adding the path of project you want to analyze:
pathProjecttoAnalize = <path of your project>
The path expected for source code is normally project/src/ For example in windows:
C:/myproject/src/
or in Linux:
~/myproject/src/
NOTE: It is very important that you add / at the end of the path like in the example above. Otherwise the tool won't be able to find the path.
And the type of anti-patterns you want to detect:
detectedAntipatterns=LazyClass,LongParameterList,SpaghettiCode,Blob,SpeculativeGenerality
In addition to computing the number of anti-patterns before and after refactoring, you can also compute Bansiya's QMOOD functions' values. To find out about QMOOD interpretation, see the original publication.
To activate the computation of QMOOD in addition to anti-pattern's detection, you have to set the variable qmood=1
.
Then after the execution, RefGen will print the results of computing the QMOOD model to the code.
RefGen can analyze .class files, java files or Jar Files
to indicate which type of files you want to analyze, use the following key in the config.prop file.
generateFromSourceCode=1
with 1= *.java, 0 = *.class, and 3 = *.jar.
.class
is preferred.
To execute RefGen in batch mode, use the following syntax:
java -jar RefGen.jar config.prop 0 program_identifier
where program_identifier is a string label for the output files.
RefGen will start to printout a lot of information, from which the most important is the values of NOC (number of classes). If NOC is equal to zero, it means that RefGen could not parse correctly the path of the code you specified.
Ensure that you always add a /
at the end of a path variable, in the config.prop file.
After executing RefGen in simulation mode, it will generate the following files:
DetectionResults in 0project_name for <anti-pattern>.ini
Anti-pattern detection before refactoring
DetectionResults in results-0project_name for <anti-pattern>.ini
Anti-pattern detection after simulating refactoring
The files above are the normal files that DECOR (ptidej tool suite) will generate when performing just detection of anti-patterns.
BestRefSequence-0project_name.txt
Best refactoring sequence generated by RePOR. The refactoring sequence is a list of refactoring operations that you need to apply to improve design quality of the system.
OriginalCount.txt
A summary of the anti-patterns detected before refactoring.
refactoringList-0project_name.txt
The total list of refactoring candidates found (BestRefSequence is an ordered non-conflicted subset of this list).
FitnessReport-0project_name.txt
A summary of anti-patterns count after simulating refactoring.
The rest of files are used internally by RefGen, and you do not need to worry about them. However, if you modify the analyzed source code, and want to simulate refactoring again, you must delete them, since we serialize the model of your code for performance, i.e., we generate the code metamodel only once ( *.ser
file). Note that this does not happen when using the Eclipse plug-in, which removes any temporary files automatically and by default.