Title: Gemini
1Gemini
http//sel.ist.osaka-u.ac.jp/cdtools/
- ????, ????, ????, ????, ????
- ???? ??????????y-ueda, y-higo, kusumoto,
inoue_at_ist.osaka-u.ac.jp - ????????? ??????21kamiya_at_ist.osaka-u.ac.jp
2??
- Gemini
- ??
- Scatter plot
- Metric graph
- Gapped clone
- CCFinder/Gemini????
- ?????????????
- ?????
- ????
3Gemini - ??(1/2)
- GUI???????????????
- CCFinder???????????????????
- ??????????
- Scatter plot
- ???????????????????
- ?????,?????...
- Metric graph
- ???????????????????????
- Source code view
- ??????????????????
- ????
- Java
4Gemini - ??(2/2)
Gemini
Interfaces
Clone pair manager
Scatter plot view
Clone selection information
(Clone pair list view)
CCFinder
User
Code clone detector
Source code manager
Source code view
Source files
Code clone Information
Clone selection information
Metrics manager
Metric graph views
(Clone class list view)
5Gemini - Scatter plot(1/2)
a b c a b c a d e c
- ??????
- ???,???????????????????
- ????,???????????????????????
- ??????????????????,????????????
- CCFinder???????????????????,??????????
- ????????????????
a b c a b c a d e c
a, b, c, ... tokens
matched position
6Gemini - Scatter plot(2/2) ?????????
- ???????scatter plot ?????????,????????????????
- ?????????????????,???????????
- ????????????????????????????????????
7Gemini - Metric Graph(1/2)
- LEN(C) Clone class C ??1????????
- POP(C) Clone class C ?????
- DFL(C) Clone class C ????????????????????????????
?????????? - RAD(C) Clone class C ???????????????????????????
new sub routine
caller statements
8Gemini - Metric Graph(2/2)
- ????????????????
- ??????????????
- 1 clone class ???,1????????
9Gemini Gapped clone(1/3)
If (a gt b) b a1
- Gapped clone ???????????????????????
- CopyPaste????(??,??,??)
- CCFinder??????????????????????
resued by copy-andpaste
resued by copy-and-paste
renamed
inserted
modified
deleted
If (i gt j) //comment i0
If (i gt j) //comment j j 1
i0
If (a gt b) //comment b a1
If (i gt j) //comment j i0
If (i gt j) i i / 2 //comment
j i0
Renamed clone
Exact clone
Gapped clone
Gapped clone
Gapped clone
gaps
10Gemini Gapped clone(2/3)
- Gapped clone?CCFinder??????????(exact clone,
renamed clone)???????????? - ?????????????????????
11Gemini Gapped clone(3/3)
- ???gapped clone ???????????????,gap?????????
- CCFinder????????????gap?scatter
plot?????????,???gapped clone?????????????????
12CCFinder/Gemini????(1/12)
- ????????
- ??????(.exe)??????????????,????Path???????????
- ccfinder.exe, ccfinder_i_.exe, shaper.exe
- gemini.jar??????????????,????CLASSPATH??jar?????
????????
13CCFinder/Gemini????(2/12)
- Gemini????
- ?????????????, ????????????,?java Gemini????
- (VM??????????????) ?java mx512m Gemini?
- (?????CLASSPATH?????????) ?java cp
c\bin\gemini.jar Gemini? - ?????gemini.jar??????????????
14CCFinder/Gemini????(3/12)
- (???????????1) ?????????????
- ????Settings - Clone Detection Option
- ?Language???????
- Java,C/C,COBOL,...
- ?Memory Resource Limit?CCFinder????????
- ????????1/10
- ?????????????1/50
- ?Minimum Clone Size???????????????????
- ?Relation of Clone Pair???????????
- File Interior ???????????????
- Cross Files ??????????????2??????????????
- Cross Groups ???????????????2??????????????
- ?Analysis Result?CCFinder????????????
- ??????????TMP?????????????????_CCFINDER?
15CCFinder/Gemini????(4/12)
- (???????????2) ??????????
- ????File - New Detection
- (??????????????????????) (??)
- ?Load List??????????????
- ??????????????
- 1??1??????
- ????????,JavaVM?????????????????
- -ns?????????
- ?????????????dir /s /b .java gt list.txt?
- (?????????)
- ?New Group???????????
- ?Add Target?????????????
- ?Remove??????????(????)?????????
- ?Save List?????????????
16CCFinder/Gemini????(5/12)
- (???????????3) CCFinder????????????
- ?Target File????????OK?????????
- CCFinder??????Output Window??????????????????
- ??????????????????????,????????
- ??????????,?????????????
- ????File - Load Result ??????????
- ?java Gemini? ???????????????????????
- ??java Gemini c\result.txt?
17CCFinder/Gemini????(6/12)
- ????????
- ?????
- ?Clone Pair?
- ?Clone Class?
- ?File List?
- ?????
- ?Scatter Plot?
- ?Metric Graph?
- ?File Similarity Graph?
- ?Source Code?
?????
?????
18CCFinder/Gemini????(7/12)
- ?????
- ?Clone Pair??????????????
- ?Fragment1???Fragment2?????????,???????Token
Size? - 0.0 157, 477 162, 539
- 0.0 ?????157????162?????????
- (477,539????????????????)
- ?Clone Class????????????
- ????????????????????
- ??????????????????(????)
- 0.0 157 162
- 0.0 ?????157????162?????????
- ?File List? ????????
- ?ID???????CCFinder?????????
- 0.00???????0?????
-
19CCFinder/Gemini????(8/12)
- ?????
- ?ScatterPlot?
- ?Vertical??Horizontal????????????????????????????
- ????????????(??),???????(??)
- ?????????
- ?Reset To Overview?????????????????
- ?Zoom??????????????????(??????????????????)
- ?Sort by ...??????????????????????????
- File Index
- ??????????(?????)
- Clone Coverage about All Files
- ???????????
- Clone Coverage about Files in Group ???????????
???? - Clone Coverage about Group ????????????
-
20CCFinder/Gemini????(9/12)
- ?????????
- ?Display??????????
- ????,???????,????????????????
- ????Settings - Scatter Plot Option
- ?Clone Pair Filter????????????????????????
- (Gap????????,???????????)
- ?Gap?Gap?????? (?Upper Limit????gap???)
- ?Border Line??????????????????
- ????????
- ?????????????????,?????????????????????????(?????)
???(? ??,Clone Pair Filter????????????????????) - ????????????????????Source code??????????????????
21CCFinder/Gemini????(10/12)
- ?Clone Class Metric Graph?
- ?????????
- ?????????Filtering Mode OFF?????????
- ??????????(??)????(?????????????)
- ??????????????????????????????
- ???????????????????????
- ?Source code????????????????????
- ???,?????,?????...
22CCFinder/Gemini????(11/12)
- ?File Similarity Graph?
- RSA(f)????f????????f????????????????????????????
????? - RST(f1,f2)????f1????????????f2???????????????????
???? - RSA,RST??Scatter Plot????????????
- ?Sort????Metric????????????
23CCFinder/Gemini????(12/12)
- ?Source Code?
- ???????????
- ??????????????????
- ?????(?????????????????)
24?????????????(1/3)
- ????????????? 2
- ????????(Correction) ????????????????????????????
??????????????? - ????????(Adaptation) ????????????????????????????
????????????????????????????????????????????????
? - ?????????(Perfection) ???????????????????????????
????????????? - ????????(Prevention) ???????????????????????????
?????????????????????????????????????????????????
????????
25?????????????(2/3)
- ???????????????????????
- Case1Correction, Prevention ???????????????,???
?????????????????????. - Case2Adaptation??????????,??????????,??????????
?????????. - Case3Perfection???????????????,????????????????
????????????. - Case4Prevention????????????????????????????????
???????.
26?????????????(3/3)
- ????????Gemini????????
- Case1,Case2
- ??????????????????????????(??,???)
- ????????????????????????,??????????1????,????????1
???????,???????????????????????? - Case3
- ?Clone Class Metric Graph?????????????
- DFL???????????
- ?POP????RAD???????????
- ?File Similarity Graph????RSA?????????????????????
?? - Case4
- ?Clone Class Metric Graph??LEN??????????????
- ????????????????????????4
- ?????????????File Similarity Graph????RST?????????
?,????????????????????????????????
27?????(1/3)
- ???Gemini????
- ???????????
- ??????????
- ???????????????
- ????????
- ??????????????????????
- Google?????????
- ?????,??,???????????????
- Web????????
- ????????????????
- ??????????,???????????(COBOL)
- ??????????????????
- ???????????????????????
28?????(2/3)
- SPARS(??????????????????????)????
- http//sel.ist.osaka-u.ac.jp/SPARS/
????????
????
Web???
??
?? ??
?????????? ?????
Eclipse??? ??????
??
??????
29?????(3/3)
?????(3/3)
??
User
??????
Web ???,Eclipse ???IDE
Source code repository
???(????)
CCFinder
???????????????
SPARSdatabase????
???????
???????(??????, ???)
Code clone database
30????(????????)
???? ?????
????? ??
???? ??
???? ??
????????
/home/project/leg1
??
20?????????????????????????????????
31????(????????)
???? ?????
????????????.???????????.
??
32????(????????)
???? ?????
???????????????
??
33????(????????)
???? ?????
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
?????????????????.?????????????
????
34????(????????)
???? ?????
clone class ID 107 ????? ??,??? MSVab.java 10,
30 amay.java 15, 35 ogih.java 12,
32 adeu.java 5, 25 meu.java 33, 53 ...
????????????????????.
35????(????)
???? ?????
????? ??
???? ??
???? ??
??????
/home/project/leg2/MSVab.java
??????,MSVab.java????????????.????????????????????
?????????
36????(????)
???? ?????
???? ??? waka.java
????? ??
???? ??
1????.?????????.
37????(????)
???? ?????
???? ??? ??? waka.java
taka.java
shinihi.java
?,1353?
????? ??
???? ??
???????????,????????????????????.
38????
???? ?????
???? ??? ??? object.java
class.java
exception.java
????? ??
???? ??
?????????????????????
????????????????
39???????(?????)
???? ?????
???? ??
????? ??
???????
sort
??
????????????????
40???????(?????)
???? ?????
???? ??? ??? quicksort.java
samplesort.java
sorting.java
???? ??
????? ??
????????????????
41???????(????)
???? ?????
???? ??
????? ??
??????
Process ps r.exec(name) InputStream in
ps.getInputStream() BufferedReader bufin
new BufferedReader( new InputStreamReader(in))
??
?????????????????????????
??????????????????????
42???????(????)
???? ?????
???? ??? ??? exec.java
execution.java
process.java
???? ??? ??? exec.java
execution.java
process.java
???? ??
????? ??
??????????????????????
??????? ?????
43?????????
???? ?????
???? exec.java
???? ??
????? ??
?? ???
import java.io. public class Exec /
????????????? / public static void main(
String argv ) try Runtime runtime
Runtime.getRuntime() Process process
runtime.exec( argv ) // ????????????????
?? ???
??????? ?????
???????????
??? ???
44?????????
???? ?????
???? ??? exec.java
exec2.java
???? ??
????? ??
???????????
45??????????
???? ?????
???? exec.java
???? ??
????? ??
?? ???
import java.io. public class Exec /
????????????? / public static void main(
String argv ) try Runtime runtime
Runtime.getRuntime() Process process
runtime.exec( argv ) // ????????????????
????????????????
??? ???
46??????????
???? ?????
???? ??? ??? system.java
newprocess.java
newsystem.java
???? ??
????? ??
???????????????
47????
1 Y. Higo, Y. Ueda, T. Kamiya, S. Kusumoto, K.
Inoue, On Software Maintenance Process
Improvement Based on Code Clone Analysis, Proc.
of the 4th International Conference onProduct
Focused Software Process Improvement, 2002, (to
appear). 2 IEEE Std 1219 Standard for Software
Maintenance, 1997. 3 T. Kamiya, S. Kusumoto,
and K. Inoue, CCFinder A Multilinguistic
Token-Based Code Clone Detection System for Large
Scale Source Code, IEEE Transactions on Software
Engineering, Vol.28, No.7, pp. 654-670, 2002. 4
A. Monden, D. Nakae, T. Kamiya, S. Sato, K.
Matsumoto, Software Quality Analysis by Code
Clones in Industrial Legacy Software, Proc. of
the 8th IEEE International Symposium on Software
Metrics, pp. 87-94, 2002. 5 Y. Ueda, T. Kamiya,
S. Kusumoto, K. Inoue, Gemini Maintenance
Support Environment Based on Code Clone
Analysis, Proc. of the 8th International
Symposium on Software Metrics, pp.67-76,
2002. 6 Y. Ueda, T. Kamiya, S. Kusumoto, K.
Inoue, On Detection of Gapped Code Clones using
Gap Locations, Proc. of the 9th Asia-Pacific
Software Engineering Conference, 2002, (to
appear).