Skip to content

Documentation

SourabhJaz edited this page Apr 18, 2018 · 1 revision

Development

Tool Used: QT Creator 5.5  Programming Language: C++

Helper Files & Folders

 Java  Finalperl.pl  GnuWin32

Finalperl.pl

 Perl script to generate OO metrics for only common classes between two versions.

Mainwindow.cpp

Delall()

 Deletes temporary files from working directory.

CloseEvent()

 Confirmation-box before exiting.  If CRG is doing some processing then force-close it using 􀍞taskkill /F􀍟 command.

on_pushButton_2_clicked()

 􀍞About􀍟 button.

on_pushButton_clicked()

 􀍞Help􀍟 button.

on_toolButton_clicked()

 Directory browser for version 1.

on_toolButton_2_clicked()

 Directory browser for version 2.

Rcomments() : Helper to remake()

 Removes comments from the JAVA file.  Creates a temporary file and stores the code without comment in that file.  Removes original file and renames temporary file to original file.

Remake()

 Compares to JAVA classes name lists stored in 2 vectors and stores the common classes names in another vector.

Wr(): Helper to rd()

 Uses a hash map to hash lines to file name.  As 􀍞file name=package name + class name􀍟 and there can be hierarchy of classes, so each line is mapped accordingly. Example: For writing line to class􀍟a.b.c 􀍞, first the line is mapped to 􀍟a.b.c􀍟 then to 􀍞a.b􀍟 and finally to 􀍞a􀍟.

Fnd(): Helper to isclass()

 Scans the line and returns class name, number of opening parentheses and number of closing parentheses.

Fnp(): Helper to ispack()

 Scans the line and returns package name.

Ispack(): Helper to rd()

 Checks if keyword 􀍞package􀍟 is present in the line and if present, then uses fnp() to return the package name.

Isclass(): Helper to rd()

 Checks if keyword 􀍞class􀍟 is present in the line and if present, then uses fnd() to return the class name.

Rd()

 Recursively reads the file, writes each class into a separate file and uses balanced parentheses (curly-braces actually) to check where the class ends.

Common()

 Compares to JAVA file name lists stored in vectors and stores the common file names into a new vector.

on_pushButton_3_clicked()

 First validates directory paths.  Deletes old temporary data if present.  Current working directory is used to store everything.  Java files from version are copied into current directory temporary folder and same is done for folder 2.  Path for JAVA files for version 1 is stored in 􀍞myfiles.lis􀍟 as they are needed while creating project database using 􀍞und.exe􀍟 in 􀍞metrics.cpp􀍟.  Finds common JAVA files.  Removes comments from common files.  Each class is extracted from both the folders and is stores in temporary folder.  Common classes are found and difference is calculated using 􀍞diff􀍟 command (First all the commands are stored in a then they are executed).  Results are written into results.csv file.  Temporary files are deleted.

Metrics.cpp

on_toolButton_clicked()

 File browser to locate installation directory of SciTools Understand tool.

on_pushButton_clicked()

 Validates directory paths.  Finds 􀍞und.exe􀍟 in SciTools directory.  Stores all the commands for 􀍞und.exe􀍟 in 􀍞comlist.txt􀍟.  Executes the commands using system() command.  Results are stored in 􀍞anb.csv􀍟.  􀍞anb.csv􀍟 is scanned and metrics are renamed and the contents are copied to a new file in destination location.  Understand project database and 􀍞anb.csv􀍟 are removed.

on_pushButton_2_clicked()

 􀍞About􀍟 button.

on_pushButton_3_clicked()

 􀍞Help􀍟 button.

on_toolButton_2_clicked()  Directory browser for destination file.