Changes between Version 5 and Version 6 of SuffixTreeBasedDuplicateCodeAnalysis


Ignore:
Timestamp:
May 27, 2012, 10:12:30 PM (13 years ago)
Author:
manualwiki
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SuffixTreeBasedDuplicateCodeAnalysis

    v5 v6  
    1515 
    1616||=Property=||=Description=||=Type=||=Default value=||=Example=|| 
    17 ||files||files in which the search is carried out||[Module::atom() [[BR]] |Filepath::string() [[BR]] |RegExp::string() [[BR]] |File::string()]||all files from the database||{files,["/usr/local/lib/erlang/lib/mnesia-4.5/src/mnesia_log.erl", module]}|| 
     17||files||specify files to search||[Module::atom() [[BR]] |Filepath::string() [[BR]] |RegExp::string() [[BR]] |File::string()]||all files from the database||{files,["/usr/local/lib/erlang/lib/mnesia-4.5/src/mnesia_log.erl", module]}|| 
    1818||minlen||minimal length of a clone(length is in tokens)||integer()||10||{minlen,50}|| 
    1919||minnum||minimal number of clones in one clone group||integer()||2||{minnum,5}|| 
    2020||overlap||maximum length that duplicates can overlap each other (length is in tokens)||integer()||0||{overlap,1}|| 
    21 ||output||name of the file in which to save the result of the analysis||string()||-||{output,"result.txt"}|| 
    22 ||name||name of the result in the table||atom()||the string "temp" concatenated with the timestamp||{name,referl}|| 
     21||output||name of the file in which the results are saved||string()||-||{output,"result.txt"}|| 
     22||name||name of the result in the table||atom()||the atom 'temp' concatenated with the timestamp||{name,referl}|| 
    2323 
    2424== Interfaces == 
     
    2929=== Console interface === 
    3030 
    31 We currently have two interface functions in the ri module: search_duplicates/0  
    32 and search_duplicates/1. The first uses the default values of the parameters.  
    33 The second takes a proplist as parameter described above. Both interface  
    34 function provide information about the progress of the process. The result is  
    35 the list of clone groups. Every clones are defined by the path of the file and  
    36 information about the start and end positions (line and column number). 
    37 An example can be found at the bottom of the page. 
     31==== Analyser functions ==== 
     32 
     33* search_duplicates/0: uses the default values of the properties. 
     34* search_duplicates/1: takes a proplist as parameter described above. 
     35 
     36Both interface function provide information about the progress of the process.  
     37The result is the list of clone groups. Every clones are defined by the path of  
     38the file and information about the start and end positions (line and column number). 
     39Results are saved. An example can be found at the bottom of the page. 
     40 
     41==== Result query functions ==== 
     42 
     43||Function||Parameters||Description||Example|| 
     44||stored_dupcode_results/0||-||queries all saved results (name and information about the parameters of the analysis)||{{{ri:stored_dupcode_results()}}}|| 
     45||save_dupcode_result/2||Name::atom() - name associated with the result,[[BR]]Filename::string() - name of the file||saves the given result in the file||{{{ri:save_dupcode_result(temp20120527205412,"result.txt")}}}|| 
     46||show_dupcode/1||Name::atom() - name associated with the result||lists the result's all clone groupes||{{{ri:show_dupcode(temp20120527205412)}}}|| 
     47||show_dupcode_group/2||Name::atom() - name associated with the result,[[BR]]GroupNumber::integer() - the required clone group's number||lists the given clone group of the result||{{{ri:show_dupcode_group(temp20120527205412, 2)}}}|| 
    3848 
    3949== Examples == 
     50 
     51=== Analysis functions === 
     52 
     53Calling and allowed parameterizations: 
    4054 
    4155{{{#!erlang 
     
    4559{{{#!erlang 
    4660ri:search_duplicates([ 
    47         {files, ["/home/user/dups/dup1.erl", 
     61        {files, [dup2, 
     62                 "/home/user/dups/dup1.erl", 
    4863                 "/home/[0-9a-zA-Z/_.\-]+/src"]}, 
    4964        {minlen, 50}, 
     
    5469}}} 
    5570 
    56 Small example of the return value and the progress report: 
     71Return value and the progress report (only if the analysis was not run yet): 
    5772 
    5873{{{#!erlang 
    59 ri:search_duplicates([{files,[dup1, dup2]}]). 
     74(refactorerl@localhost)3> ri:search_duplicates([{files,[dup1,dup2]}]). 
    6075 
    6176Initial clone detection started. 
     
    6681Calculating positions started. 
    6782Calculating positions finished. 
    68 [[[{filepath,"/home/user/dups/dup1.erl"}, 
    69    {startpos,{15,1}}, 
    70    {endpos,{17,24}}], 
    71   [{filepath,"/home/user/dups/dup2.erl"}, 
    72    {startpos,{5,1}}, 
    73    {endpos,{7,24}}]], 
    74  [[{filepath,"/home/user/dups/dup1.erl"}, 
    75    {startpos,{8,1}}, 
    76    {endpos,{14,11}}], 
    77   [{filepath,"/home/user/dups/dup2.erl"}, 
    78    {startpos,{12,1}}, 
    79    {endpos,{18,11}}]]] 
     832 clone groups found. 
     84Result saved to temp20120527234307... 
     85run ri:show_dupcode(temp20120527234307) to see the result. 
     86ok 
     87 
     88(refactorerl@localhost)4> ri:search_duplicates([{files,[dup1,dup2]}]). 
     892 clone groups found. 
     90Result saved to temp20120527234307... 
     91run ri:show_dupcode(temp20120527234307) to see the result. 
     92ok 
    8093}}} 
     94 
     95=== Result query functions === 
     96 
     97{{{#!erlang 
     98(refactorerl@localhost)5> ri:stored_dupcode_results(). 
     99[[temp20120527234307, 
     100  [{files,[{"/home/user/dups/dup1.erl", 
     101            112018930}, 
     102           {"/home/user/dups/dup2.erl", 
     103            96559118}]}, 
     104   {minlen,10}, 
     105   {minnum,2}, 
     106   {overlap,0}]], 
     107 [temp20120527235556, 
     108  [{files,[{"/usr/local/lib/erlang/lib/mnesia-4.5/src/mnesia_schema.erl", 
     109            101394176}]}, 
     110   {minlen,20}, 
     111   {minnum,3}, 
     112   {overlap,0}]]] 
     113}}} 
     114 
     115{{{#!erlang 
     116(refactorerl@localhost)17> ri:show_dupcode(temp20120527234307).         
     117[{1, 
     118  [[{filepath,"/home/user/dups/dup1.erl"}, 
     119    {startpos,{8,1}}, 
     120    {endpos,{18,11}}], 
     121   [{filepath,"/home/user/dups/dup2.erl"}, 
     122    {startpos,{5,1}}, 
     123    {endpos,{15,11}}]]}, 
     124 {2, 
     125  [[{filepath,"/home/user/dups/dup1.erl"}, 
     126    {startpos,{6,5}}, 
     127    {endpos,{6,62}}], 
     128   [{filepath,"/home/user/dups/dup2.erl"}, 
     129    {startpos,{18,5}}, 
     130    {endpos,{18,58}}]]}] 
     131Contains 2 clone groups... 
     132run ri:show_dupcode_group(temp20120527234307, GroupNumber::integer()) to see one of the clone groups. 
     133ok 
     134}}} 
     135 
     136{{{#!erlang 
     137(refactorerl@localhost)16> ri:show_dupcode_group(temp20120527234307,2). 
     138[[{filepath,"/home/user/dups/dup1.erl"}, 
     139  {startpos,{6,5}}, 
     140  {endpos,{6,62}}], 
     141 [{filepath,"/home/user/dups/dup2.erl"}, 
     142  {startpos,{18,5}}, 
     143  {endpos,{18,58}}]] 
     144Contains 2 members. 
     145ok 
     146}}}