????????????CCFinder - PowerPoint PPT Presentation

About This Presentation
Title:

????????????CCFinder

Description:

Title: PowerPoint Author: Yasushi Ueda Last modified by: y-higo Created Date: 10/7/2000 6:51:55 AM Document presentation format – PowerPoint PPT presentation

Number of Views:29
Avg rating:3.0/5.0
Slides: 39
Provided by: Yasu45
Category:

less

Transcript and Presenter's Notes

Title: ????????????CCFinder


1
?????????????????????
?? ??, ????,????,???? ???? ??????????
????????????? ????????? ??????????
2
????
  • ???????
  • ????????????CCFinderGemini
  • ???????(????????)
  • ????????????????????
  • ????
  • ???

3
????? ???????
  • ????????????????????????????????????

??????
  • ??????????????????????
  • ??????????????????????????????????????????????????
    ?????

4
???????????? CCFinderGemini
  • ????????????CCFinder???
  • ??????????????????????????Gemini???

5
CCFinder???
  • ???????????????????????????????????
  • ????????
  • ???????????
  • ??????????????
  • ??????????????
  • ??????????????????????

6
CCFinder?????
1. static void foo() throws RESyntaxException
2. String a new String "123,400",
"abc", "orange 100" 3. org.apache.regexp.RE
pat new org.apache.regexp.RE("0-9,") 4.
int sum 0 5. for (int i 0 i lt
a.length i) 6. if (pat.match(ai)) 7.
sum Sample.parseNumber(pat.getParen(0)
) 8. System.out.println("sum " sum) 9.
10. static void goo(String a) throws
RESyntaxException 11. RE exp new
RE("0-9,") 12. int sum 0 13. for
(int i 0 i lt a.length i) 14. if
(exp.match(ai)) 15. sum
parseNumber(exp.getParen(0)) 16.
System.out.println("sum " sum) 17.
7
Gemini???(1/2)
  • GUI???????????????
  • CCFinder???????????????????
  • ??????????
  • Scatter plot
  • ???????????????????
  • ?????,?????...
  • Metric graph
  • ???????????????????????
  • Source code view
  • ??????????????????
  • ????
  • Java

8
Gemini???(2/2)
User Interfaces
Clone pair manager
Scatter plot view
Clone selection information
Source code manager
Source code view
Clone selection information
Code clone database
Metrics manager
Metric graph views
9
CCFinderGemini?????
  • ?????????
  • JDK libraries (Java, 570 KLOC)
  • Linux, FreeBSD (C, 1.6 1.3 MLOC)
  • FreeBSD, OpenBSD,NetBSD(C)
  • Qt(C,240KLOC)
  • ??
  • NTT Data Corp., Hitachi Ltd., Hitachi GP, NEC
    soft Ltd., ASTEC Inc., SRA Inc., NASDA,Daiwa
    Computer, ???
  • ?????
  • ???????????????

10
???????????????
  • CCFinder/Gemini???????????????????????????????????
    ????
  • CCFinder???????????????????????,???????????(??????
    ???etc)????????

11
??
  • CCFinder???????????????(???????????????????????)?
    ??????????????????????
  • ???????????????????????????????????

M. Fowler Refactoring Improving the Design of
Existing Code, Addison-Wesley, 1999.
12
???????
Void methodA(int i) methodZ() System.out.prin
tln(name name) System.out.println(amount
i) Void methodB(int i) methodY() Syste
m.out.println(name name) System.out.println
(amount i)
methodC(i)
methodC(i)
13
?????????
14
???????
  • CCFinder???????????????????????????????????
  • ???????????CCFinder?????????????????Gemini????????
    ???

15
????????(for Java)
  • ??class ?interface
  • ?????????????????static???????
  • ?if??for??while??do??switch??try??synchronized?
  • ????????????

16
??????
  • CCShaper(Code Clone Shaper)
  • CCFinder??????????????????????????????????
  • ????Java
  • ????????Java
  • ????12,000?
  • ??????????JavaCC????

17
????????
  • ????? ?????????????????????????
  • ??????? ???????CCFinder??????????????????????????
    ??

???????
  • ??????? ?????????????????????????????????????????
    ???

???????
??????
18
(No Transcript)
19
?????????????????(?1)
  • righttokennumber c.getEndNumber() -
    c.getStartNumber() 1
  • string getLeftClone() const
  • char tempSTRLENGTH
  • snprintf(temp,STRLENGTH,
  • "s\td,d,d\td,d,d\t",leftID.c_str(),
  • leftstartline,leftstartcolumn,leftstartnumber,
  • leftendline,leftendcolumn,leftendnumber)
  • string clone(temp)
  • return clone
  • string getRightClone() const
  • char tempSTRLENGTH
  • snprintf(temp,STRLENGTH,

20
?????????????????(?1)
  • righttokennumber c.getEndNumber() -
    c.getStartNumber() 1
  • string getLeftClone() const
  • char tempSTRLENGTH
  • snprintf(temp,STRLENGTH,
  • "s\td,d,d\td,d,d\t",leftID.c_str(),
  • leftstartline,leftstartcolumn,leftstartnumber,
  • leftendline,leftendcolumn,leftendnumber)
  • string clone(temp)
  • return clone
  • string getRightClone() const
  • char tempSTRLENGTH
  • snprintf(temp,STRLENGTH,

return clone string getRightClone()
const char tempSTRLENGTH snprintf(temp,STRL
ENGTH, "s\td,d,d\td,d,d\t",rightID.c_str(
), rightstartline,rightstartcolumn,rightstartnu
mber, rightendline,rightendcolumn,rightendnumbe
r) string clone(temp) return
clone int getLeftTokenNumber()
const return lefttokennumber
21
?????????????????(?2)
  • if(func-gtparameter!NULL)
  • return error("ErrorParameter Exist")
  • curVertex-gtkindST_call lpmakeexptree(NULL,N
    ULL,SIDENTIFIER,idtemp,SPROCEDURE)
  • curVertex-gttreelp
  • curVertex-gtrefersearch_tree_postorder(lp)
  • curVertex-gtreferuniq_RDlist(curVertex-gtrefer)
  • cutSt()
  • break
  • case 66
  • line 314 "subPascalParse.y"
  • struct FUNCTION func
  • struct RD para

lpmakeexptree(lp,NULL,SRPAREN,NULL,SNULL) rp
makeexptree(NULL,lp,SIDENTIFIER, idtemp,SPROCE
DURE) curVertex-gtkindST_call curVertex-gttree
rp curVertex-gtrefersearch_tree_postorder(rp)
curVertex-gtreferuniq_RDlist(curVertex-gtrefer)
cutSt() break case 67 line 355
"subPascalParse.y" yyval.exptree
yyvsp0.exptree break
?????????????????????????(?????????????)
22
???????
  • ????????Java??????(ANTLR,Ant)??????????
  • Pentium4 1.5GHz
  • memory SDRAM512MB
  • 50?????????????????

23
??????1(Ant)(1/5) ??
  • ????????689?
  • ?????164,000?
  • ?????????

CCShaper?? CCShaper??
??????? 12,870 159
???????? 1,161 87
CCShaper??????5?
24
??????1(Ant)(2/5)???????????????
CCShaper??
CCShaper??
a
25
??????1(Ant)(3/5)?????????????
  • ???a???????
  • public void getAutoresponse(Commandline cmd)
  • if (m_AutoResponse null)
  • cmd.createArgument().setValue(FLAG_AUTORESPO
    NSE_DEF)
  • else if (m_AutoResponse.equalsIgnoreCase("Y"
    ))
  • cmd.createArgument().setValue(FLAG_AUTORESPO
    NSE_YES)
  • else if (m_AutoResponse.equalsIgnoreCase("N"
    ))
  • cmd.createArgument().setValue(FLAG_AUTORESPO
    NSE_NO)
  • else
  • cmd.createArgument().setValue(FLAG_AUTORESPO
    NSE_DEF)
  • // end of else

26
??????1(Ant)(4/5)?????????
  • ???????????????
  • ????(???????)???????????????
  • ??????????7???????????
  • ??7???????????????????

?????????????????1?????????????????
27
??????1(Ant)(5/5)?????????????
  • ????????? ??

MSVSS
MSVSSADD
MSVSSCHECKIN
MSVSSCHECKOUT
getAutoresponse (Commandline cmd)
getAutoresponse (Commandline cmd)
getAutoresponse (Commandline cmd)
MSVSSCP
MSVSSCREATE
MSVSSGET
MSVSSLABEL
getAutoresponse (Commandline cmd)
getAutoresponse (Commandline cmd)
getAutoresponse (Commandline cmd)
getAutoresponse (Commandline cmd)
28
??????1(Ant)(5/5)?????????????
  • ????????? ????????????

MSVSS
getAutoresponse (Commandline cmd)
MSVSSADD
MSVSSCHECKIN
MSVSSCHECKOUT
MSVSSCP
MSVSSCREATE
MSVSSGET
MSVSSLABEL
29
??????2(ANTLR)(1/5)??
  • ????????239?
  • ?????44,000?
  • ?????????

CCShaper?? CCShaper??
??????? 388,574 984
???????? 1,072 148
CCShaper??????2?
30
??????2(ANTLR)(2/5)???????????????
CCShaper??
CCShaper??
b
31
??????2(ANTLR)(3/5)?????????????
  • ???b???????
  • public final void mOPEN_ELEMENT_OPTION(boolean
    _createToken)
  • throws RecognitionException, CharStreamException,
    TokenStreamException
  • int _ttype
  • Token _tokennull
  • int _begintext.length()
  • ttype OPEN_ELEMENT_OPTION
  • int _saveIndex
  • match('lt')
  • if ( _createToken _tokennull
    _ttype!Token.SKIP )
  • _token makeToken(_ttype)
  • _token.setText(new String(text.getBuffer(),
    _begin, text.length()-_begin))
  • _returnToken _token

32
??????2(ANTLR)(4/5)?????????
  • ???????????????
  • ???????? ?????
  • ??????????20????????
  • ??????????????????????????

???2???????1?????????????????
33
??????2(ANTLR)(5/5)?????
  • ??????????????????????????????
  • ?????????
  • ???????84?????????????????????????????????

ANTLR (???)
ANTLR (????)
34
???
  • ???????????????????????????????
  • ???(CCShaper)?????
  • Java???????(Ant?ANTLR)????????????????

35
?????
  • ?????????
  • ????????
  • ???????????????????
  • ?????????????????
  • ???????

36
(No Transcript)
37
Suffix-tree
  • Suffix tree is a tree that satisfies the
    following conditions.
  • A leaf node represents the starting position of
    sub-string.
  • A path from root node to a leaf node represents
    a sub-string.
  • First characters of labels of all the edges from
    one node are different from each other.
  • ? A common path means a clone

38
CCFinder????????????????????????????????
  • CCFinder???????????????????????,???????????(??????
    ???etc)????????
  • ??????????????????????????????????
Write a Comment
User Comments (0)
About PowerShow.com