In this thesis an automatic method which is used to detect the dis - contiguous parameterized duplication code is introduced 本文介紹了一個自動的檢測程序中非連續(xù)參數化重復代碼的方法。
( 1 ) an improved parameterized matching algorithm is constructed , the improvment is that extending the matching unit from the char to statement , as a result the transform function is redefined and the complexity of the algorithm is decreased , so it is fit for detecting the duplication codes in more large scale program 所作的工作有兩部分, ( 1 )對baker的參數化匹配算法進行了改進。把匹配單位由單個的字符變?yōu)槌绦蛑械恼Z句,為了配合匹配單位的改變,重新定義了轉換函數。
( 2 ) a fragment combining algorithm is designed to judge the combined ability of the parameterized duplication code fragment which are found by the former method , so the discontiguous parameterized duplication code is detected . the analysis indicates that the new algorithm has an acceptable complexity 經過改進,算法的空間復雜性得到降低,使之更適于大型程序文本的匹配; ( 2 )提出了程序碎片合并算法,判斷通過參數化匹配算法找到的重復代碼段之間的可合并性,從而能從程序中識別出非連續(xù)的近似重復代碼。