Introduction
~~~~~~~~~~~~~

This is a mutated clone detection tool (reports both similar and modified parts at the scope level). It detects clones in C, C++, Java source code.
It may also work for C# (not tested). The tool runs both in Windows and Linux.

Contents
~~~~~~~~~
Outer(root) folder contains
- Windows solution folder/dir (CloneDetectionOptPublic)
- test files - to test clone detection
- this readMe file.
- config.txt - a simple configuration file 
CloneDetectionOptPublic contains
 - VS studio solution - CloneDetectionOpt 
 - compile.sh  - compiles the tool in Ubuntu (make sure to fix permission with chmod +x compile.sh)
 - config.txt - a simple configuration to change parameters
 - source code files of the tool (some of the source code files are located in the sub-directories StringMatch and MTree)


How to use the tool in Windows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Launch CloneDetectionOpt solution and change the source code path to be analyzed.
copy config.txt from solution folder to source code folder/dir to be analyzed.
Check the reports in the Report section.
Note: Dependency on StringMatch, ScopeExtractor, and MTree is defined using static library.

How to use the tool in Linux
~~~~~~~~~~~~~~~~~~~~~~~~~~~
copy config.txt from CloneDetectionOpt to the input source_code_path for clone detection
run DetectClone source_path   (./DetectClone source_code_path)
check the reports in the Report section.

Report
~~~~~~
Only few files are reported (located in input source_code_path)
- exactMatch.txt    - contains similar segments locations followed by mutated segments(if it exists) for each clone pair.
- exactMatchFunctionOnly - only mutated clones at the function level (format is similar to exactMatch)
- performance.txt - includes running time and statistics including LOC, Clone LOC, mutated LOC

What to change in config.txt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
One can use the tool only by specifying the source code path to be analyzed in which case default parameters are used.
However, the config.txt can be copied to the input source code path and the parameters can be changed.
The config file has parameter and value pairs. It is a simple text file. Change only the values. Most of the names are self explanatory.
The most important parameters are.
num_lines  7           -- the number of lines below which clones are discarded.
match_thr  0.9         -- the similarity level of the clone pairs. For large code bases use above 0.92
You can play with the other parameters too.



