Home

VisCad User Guide

image

Contents

1. Greer Were vales 56 1 Click on any column header to sort the rows with t N Export Metric Values Plot Browse Code ae man c ce ame i TLOC TLOC Clone TCLOC PTCLOC FAWC PFAWC Avg CRFL CCH CCP jower aw jHotDraw7 6 126112 91693 152470 27 6754 b 29 50 229008 2 0089977 1 0 0 0 app HotDraw7 6 10705 6942 4478 16 777206 73 33 45 20548 0 78955793 1 0 0 0 action JHotDraw7 6 4988 3405 2624 18 20369 52 26 50 0 0 8784873 _ 0 98214287 0 017857144 app HotDraw7 6 16 843 573 500 25 622776 8 E 37 5 0 83936954 _ 0 5694444 0 43055558 edit HotDraw7 6 24 1035 882 1303 31 304348 12 9 75 0 1 5976193 1 0 o o file HotDraw7 6 4 m sz s i sa u m 19664423 0 6923077 0 30769232 view 1186858 1 0 0 0 window 3940363 0 75 0 25 osx jHotDraw7 6 l Exporting 2 plotting metric values and 3 browsing source code of the 15339233 10 0 0 pan JHotoraw 6 clone fragments are suppoted by these buttons p gt EJ color jHotDraw7 6 0 9066667 0 09333334 draw jHotDraw7 6 0 880657 0 119343 action JHotDraw7 6 7 6736855 0 8648649 _ 0 13513513 connector jHotDraw7 6 970 182 56 2 8865979 11 2 18 181818 _ 0 30147058 0 75 lo 25 event jHotDraw7 6 2118 392 284 6 704438 26 4 15 384615 _ 0 7462152 _ 0 8333333 _ 0 16666667 gui jHotDraw7 6 5 972 862 5648 68 6214 7 5 71 42857 5 462257 0 48333335 0 51666665 handle HotDraw7 6 153 5838 4843 56
2. e EE KI Documents Images lib 274 0 0 111 4 E 275 0 111 Bins i 0 111 File Name s of Type AllFiles v Click on this button to save the result VisCad saves the filtered clone detection result in VisCad input file format VisCad User Guide 70
3. eS Export Values Browse Code 10 CCL __MaxLengh Min length Avg Length Files Associated 1 18 9 9 9 0 1 2 12 l6 6 6 0 1 3 12 6 6 6 0 2 4 14 17 7 7 0 2 5 18 6 6 6 0 lz 6 6 j4 7 8 BE Exporting 2 Sorting metrics values and 3 browsing the source code of the clone fragments Tu Within the selected clone classes are also possible 13 Te Tu 70 m TE 14 2 6 6 l2 15 5 30 6 6 6 0 la 16 2 42 32 10 21 0 2 17 2 12 6 6 6 0 i 18 2 16 8 8 8 0 1 19 2 12 6 6 6 0 hi 20 2 12 6 6 6 0 lz 21 2 18 9 9 9 0 2 22 2 12 6 6 6 0 i 23 2 12 6 6 6 0 E 24 2 12 A a en 2 The computed metrics values for all clone classes will be displayed as a new tab panel titled Clone Class Metric Details in the viewer window VisCad User Guide 59 Other operations Various operations such as sorting exporting and plotting computed metrics values and browsing source code of the clone fragments are also supported For details see those operations in the discussion for files Obtaining Metrics For Files VisCad User Guide 60 Filtering VisCad User Guide 61 Introduction The first and foremost challenge in clone analysis is the large volume of clone detection results Not all clones are useful to the user and the objective of the analysis at hand governs the set of the useful clones Here the term useful clones refers to those clone fragments that the maintenance en
4. 1758 Cloned File 342 Documentation Clone 0 Cloned File 0 JavaDoc Clone 0 Cloned File 0 Samples Clone 0 Cloned File 0 3 Source Clone 1758 Cloned File 342 jhotdraw7 Clone 1758 Cloned File 342 lib Clone 0 Cloned File 0 nbproject Clone 0 Cloned File 0 src Clone 1758 Cloned File 342 documentation Clone 0 Cloned File 0 main Clone 1758 Cloned File 342 a java Clone 1758 Cloned File 342 19429 tool Similarity duplicate 1414 processe 61258 duplicate 342 processin 3 150sec JHotDraw7 6 O Clone Classes 737 Clone Class Tree CC 1 Fragments CC 2 Fragments CC 3 Fragments 2 CC 4 Fragments 2 CC 5 Fragments 3 CC 6 Fragments 4 CC 7 Fragments 2 CC 8 Fragments 2 CC 9 Fragments 3 CC 10 Fragments 2 CC 11 Fragments 2 CC 12 Fragments 2 CC 13 Fragments 2 CC 14 Fragments 2 CC 15 Fragments 5 CC 16 Fragments CC 17 Fragments Clone class tree groups the detected clones into different classes VisCad User Guide 19 Viewer Project Sys a xy a Dx Systems E JHotDraw7 6 Clone 1758 Cl Documentation Clone O JavaDoc Clone O Cloned Samples Clone O Cloned E Source Clone 1758 Clon E jhotdraw7 Clone Ea lib Clone O Cloned nbproject Clone 0 E src Clone 1758 Cl documentation E java Clone 1 net Clone org Clone resources Clq test
5. Right click on a node represnting a directory opens a popup menu You can then select the target operation The clone pairs internal external will be viewed in a new tab using the clone pair browser component see the next figure VisCad User Guide 45 Example of a clone pair browser Viewer WER Hierarchical Dependency Graph external clone pairs Y Clone Pair Browser External clone pairs for the directory Users muhammad 880Research Simian JHotDraw7 6 Source jhotdraw7 src main java org jhotdr No PCID 1 CCID 1 Path 1 SL 1 EL 1 CLOC 1 PCID 2 CCID 2 Path 2 SL 2 EL 2 CLOC 2 1 152 473 JHotDra 104 118 15 1 154 473 JHotDra 119 473 JHotDra 473 jHotDra 92 JHotDra 92 JHotDra 92 JHotDra 92 JHotDra 92 JHotDra 92 JHotDra 185 JHotDra En 185 JHotDra 185 JHotDra 185 JHotDra 181 JHotDra 181 JHotDra 181 HotDra 181 jHotDra a Ox ojojo s w n ES 146 fant namantan ni Il oli 4 Click on this buton to see the source code differences InputStream in url openCo InputStream in url VisCad User Guide 46 try i NanoxMLDOMInput domi result Drawing domi Y finally i in close else de result null return result try i NanoxMLDOMInput d result Drawing Y finally in cl
6. VisCad User Guide 48 Obtaining Metrics For Files This section discusses the steps for obtaining various metrics values for the clone files located in a directory Select a directory E System Navigation Tree 2 aN a KA Systems E JHotDraw7 6 Clone 1758 Cloned File 342 Documentation Clone 0 Cloned File 0 JavaDoc Clone 0 Cloned File 0 Samples Clone 0 Cloned File 0 Source Clone 1758 Cloned File 342 E jhotdraw7 Clone 1758 Cloned File 342 U lib Clone 0 Cloned File 0 nbproject Clone 0 Cloned File 0 src Clone 1758 Cloned File 342 documentation Clone 0 Cloned File 0 main Clone 1758 Cloned File 342 Jae Hee net Clone 39 Cloned File 13 E a OTU O 5 U J resources Clone 0 Ched File 0 test Clone 0 Cloned File L Templates Clone 0 Cloneg Selected directory is highlighted with blue color Click on a target directory to select it from the system navigation tree Metrics will be computed for all clone files located within this directory VisCad User Guide 49 Open the popup menu and select the operation a ee ee HT m mw main Clone 1758 Cloned File 342 java Clone 1758 Cloned File 342 net Clone 39 Clamad Eila 12 org Clone 1719 Open Clone List resources Clone 0 Open Clone File List test Clone 0 Cloned F mplates Clone 0 Clone Metrics d Metric
7. Clone 0 Cla Templates Clone 0 facio a aj JHotDraw7 6 VisCad Analyzing Clones With Visualization O Viewer a x g XA a MX Clon amp Code Browse E Cloe Nof l To close a tab click on this button 222 jHot 384 ateg Details mroces 680 duplica 19429 hol Similari duplica 1414 Mroces 61258 duplica 342 froces 3 150sec maximize the viewer window B 1 016 415 Hot 164 178 15 1 017 a 725 293 Hot 184 192 9 726 136 60 Hot 127 132 6 135 Click on this button to 122 jHot 508 513 6 306 222 jHot 384 390 7 549 222 Hot 384 390 7 550 222 JHot 384 390 7 551 222 Hot 399 405 222 Hot 384 390 7 552 222ljHot 415 421 390 7 553 222 Hot 435 441 ifferencer a Draw7 6 Source jhotdraw7 src main java net n3 nanoxml PiReader java BY FA fab Depending on the user s selection it accomodates different views such as the scatter plot treemap hierarchical dependency graph source code browser etc VisCad User Guide 20 Obtaining information specific to clone detection VILA FUIGIyLIIIYH CIVIC ILI VIDUGIILGLIUII a _Dx E Viewer A x n
8. JHotDraw7 6 Source jhotdraw src main java org jhotdraw undo Sorting allows to identify cloning patterns easily VisCad User Guide 34 Zoom in or zoom out Z Viewer X a Scatter Plot Level 2 Sort By CLOC Sort By Clones Selection Type File Folder Bc m You can hold the right mouse button and move it in the inward or outward direction to perform zoom in or zoom out operations The above figure shows an example of zoom out operation You can also identify the files or directories involved with a cell with tooltip by holding the mouse pointer on the cell VisCad User Guide 35 Treemap Treemap preserves the hierarchical structure of subject systems where each rectangle represents a file or directory The rectangles representing the files are aggregated to indicate the cloning status of a directory in the system hierarchy Opening treemap E System Navigatio X _nx FViewer X Systems E JHotDraw7 6 Clone 1758 Cloned File 342 Documentation Clone 0 Cloned File 0 JavaDoc Clone O Cloned File 0 Samples Clone 0 Cloned File 0 Source Clone 1758 Cloned File 342 E jhotdraw7 Clone 1758 Cloned File 34 lib Clone 0 Cloned File 0 nbproject Clone 0 Cloned File 0 src Clone 1758 Cloned File 342 documentation Clone 0 Cloned 3 main Clone 1758 Cloned File 3 java Clon erze net Clo Open Clone List org Cl
9. detection result you obtained by running clone detection on the subject system using the supported clone detectors Current you can directly import clone detection result of CCFinder Simian SimScan NiCad If you have clone detection result in RCF format you can also import and anlyze the data in VisCad For other clone detection tools you need to convert the result into VisCad input file format VisCadBeta zip file contains an example of VisCad input file Make the selection VisCad Analyzing Clc Import Result from NiCad e Viewer a xy Import Result from Simian Import Result from SimScan Import RCF Import VisCad Input File Import Result from CCFinder To import clone detection result or RCF data file click on the Project menu This opens a list of importing operations supported by VisCad VisCad User Guide 7 Import clone detection result of Simian ae VisCad Analyzing Clor Import Result from NiCad mport Result from Simian _ Import Result from SimScan Import RCF Import VisCad Input File Import Result from CCFinder a_ Dx Viewer a x Suppose your computer contians the source code of JHotDraw version 7 6 and located in the JHotDraw7 6 directory You detect the clones using Simian on that directory and stores the result in jhotdrawResultSimian txt file To import the result you need to click on the Project menu and select the Import Result from Simian menu item VisCad U
10. fragments located in the selected files on the left side We can change the file selection This also change the displayed clone fragments in the right side The previous selection open the code browser in the viewer window in a new tab VisCad User Guide 24 An Example E Viewer 2 X Clone Code Browser 98 Click on the checkbox to select or deselect a file neo Clone Files and Fragy Clone Pairs suusa Name path __ Loc coc clo A M AA a fa BezierPath java JHotDraw7 6 Source 1 248 248 15 1 468 613 JHotDraw7 317 344 BezierPathlterator java JHotDraw7 6 Source 335 172 1 469 613 JHotDraw 249 276 ol ConvexHull java JHotDraw7 6 Source 261 20 B DoubleStroke java JHotDraw7 6 Source 283 120 mj Geom java JHotDraw7 6 Source 859 206 16 Only two clone fragments are located in the selected Insets2D java file We can also change the selection Clicking on the checkbox select deselect a clone fragment Suppose we want to analyze the clone fragments located only in the Insets2D java file We need to deselect all files except Insets2D java file by clicking on the checkboxes From the right side we can see that only two code fragments are located in this file VisCad User Guide 25 Examining clone pairs O Viewer 2 X 4 FOX Clone Code Browser Clone Files an
11. titled File metric Values in the viewer window VisCad User Guide 50 Sorting metric values File Metric Values Export Metric values Plot Browse Code No Name Total Clone fra Total LOC Clone Loc y CRFL 4 NonValidator java 13 633 gt 0 7756714 CDATAReader java 4 172 0 8911917 11 XMLElement java E 144 0 12653778 5 PiRaaar iawa BE N7IRITFSR To sort the rows by a metric values click on the column header A downward arrow indicates that values are sorted in descending order An upward arrow indicates sorting in ascending order IXMLBuilder java 6 StdXML Builder java 1 336 12 Exporting Saving metric values File Metric Values 0 055555556 0 035714287 xport Metric values Y Plot Browse Code Name Total Clone fra Total LOC 2 Clone LOC CRFL Edi Padi Rad Pahi P l Pohdi Pudil Heel Fudd Poudi Pod 12 XMLParserFactory java 2 1150 36 10 24 IHotDraw7 6 10 XMLAttribute java Save 5 PiReader java 1 CDATAReader java Save In E muhammad a ez D 2 ContentReader java 3 IXMLBuilder java 880Research Downloads H javadoc 5 StdXMLBuilder java _ Components Dropbox l jtxldb 0 12 ardao Pugin aa core dwhelper kdiff3 app B StdXMLReader java NonValidator java cyclone examples latest api diffs 7 stdXMLParser java A Desktop extensions latest javadoc Es _ pMtutlljawa Y Documents Images lib 11 XML
12. 16 207 514 323 330 14 HotDra 3 lo 14 265 l656 J483 494 15 JHotDra 3 0 14 265 656 483 494 16 JHotDra 9 0 47 268 664 492 500 17 IHotDra 8 0 28 286 701 135 144 VisCad User Guide 66 Saving the result Continued Overlapping Filter Overlapped Clones bounds getOwnerl get TRANSFORM createTransformedShapel bounds 42 143 bounds view getDrawingToViewTransform createTransformedShape bounds 144 Stroke strokel 45 Color strokeColor1 46 Stroke stroke2 Color strokeColor2 Set the name and location of the file 880Research Downloads Ef javadoc Components Dropbox EJ jtxidb 0 12 core dwhelper kdiff3 app cyclone examples latest api diffs Source SL 2 EL 2 CN x Desktop extensions latest javadoc JHotDra 1 Documents Images lib 21 139 JHotDra 3 45 163 JHotDra I 3 121 UHotDra E _ 83 494 File Name JHotDra 1 92 500 1 Files of Type All Files 92 501 12 425 Click on this button to save the result gt Cancel 30 442 04 519 11 JHotDra 8 0 38 207 514 323 330 495 1200 323 335 12 JHotDra 8 0 25 207 514 323 330 658 11571 323 346 13 JHotDra 6 0 16 207 514 323 330 678 1614 325 354 14 JHotDra 3 0 14 265 656 483 494 268 1664 492 500 15 JHotDra 3 0 14 265 656 1483 494 339 836 1492
13. 501 16 JHotDra 9 0 47 268 664 492 500 339 836 492 501 17 JHotDra 8 0 28 286 701 135 144 552 1330 137 155 VisCad saves the filtered clone detection result as a VisCad input file format VisCad User Guide 67 Textual filtering Textual filtering allows to remove clones that are only structurally similar without having any semantic similariy For each clone class VisCad determines the clone fragment that maximizes the sum of the textual similarity to all other fragments of that class We call this fragment as the leading clone fragment for that class If the textual similarity between the leading clone fragment and any other clone fragment in the clone class falls below a given threshold value we remove the fragment from the analysis We discard an entire clone class from the analysis when the textual similarities between the leading clone fragment and all other non leading clone fragments of that clone class fall below the threshold value Make the selection E Clone Class Tree m X JHotDraw7 6 Clone Cla Filter Clone Class Clone Class Metrics Select the Clone Classes node from the Clone Class Tree Right click on it to bring the popup menu and select the Filter Clone Class option This open the similarity browser view VisCad User Guide 68 Similarity Browser View E Viewer s X i Similarity Browser 98 Graphically shows the similarity Sort By Clone Fra
14. 94 36 86194 26 19 73 07692 10247235 0 91292524 0 08707483 io jHotDraw7 6 20 1449 1210 1034 24 292616 8 5 62 5 0 87536085 0 71833336 _ 0 2816667 layouter HotDraw7 6 6 445 217 98 11 011236 6 2 33 333332 0 46978492 10 0 0 liner jHotDraw7 6 20 713 636 853 53 997196 5 3 60 0 1 3474804 1 0 0 0 locator HotDraw7 6 2 871 239 62 3 5591273 8 1 12 5 0 25941423 1 0 0 0 print HotDraw7 6 1 170 149 34 10 0 2 1 50 0 0 22818792 0 5 0 5 tool JHotDraw7 6 47 4450 3421 1937 21 146067 20 13 65 0 0 654375 0 87820506 0 12179487 geom JHotDraw7 6 75 5943 4553 2799 22 37927 j13 8 61 53846 0 6186949 0 9722222 0 027777778 gui JHotDraw7 6 86 16080 8882 9229 12 978856 89 3 33 707867 _ 1 4307154 _ 0 8474638 _ 0 15253624 fontchooser HotDraw 6 13 1540 l879 614 16 558441 zo la 57 142857 _ 0 69577664 0 9166667 _ 0 083333336 The computed metrics values for all clone directories will be displayed as a new tab panel titled Directory Metric Values in the viewer window VisCad User Guide 56 Other operations Various operations such as sorting exporting and plotting computed metrics values and browsing source code of the clone fragments are also supported For details see those operations in the discussion for files Obtaining Metrics For Files VisCad User Guide 57 Obtaining Metrics For Clone Classes This section discusses the steps for obtaining various metrics values for the clone cl
15. Draw 6 Source hotdraw7 src main java org jhotdraw text JHotDraw7 6 Source jhotdraw7 src main java org jhotdraw undo JHotDraw7 6 Source hotdraw7 src main java org hotdraw util JHotDraw7 6 Source jhotdraw7 sre main java org hotdraw xml VisCad User Guide 33 Example of Sorting Viewer ax Selection Type File Folder Both Ee JHotDraw7 6 Source jhotdra JHotDraw7 6 Source jhotdra JHotDraw7 6 Source jhotdra JHotDraw7 6 Source jhotdra JHotDraw7 6 Source jhotdra JHotDraw7 6 Source jhotdra JHotDraw7 6 Source jhotdra JHotDraw7 6 Source jhotdra JHotDraw7 6 Source jhotdra JHotDraw7 6 Source jhotdra JHotDraw7 6 Source jhotdra JHotDraw7 6 Source jhotdra ot Draw 7 6 Source jhotdraw7 src main java org jhotdraw sample JHotDraw7 6 Source jhotdraw7 src main java org hotdraw draw JHotD raw 7 6 Source hotdraw7 src main java org jhotdraw app JHotDraw 6 Source jhotdraw7 sre main java org jhotdraw color JHotDraw 7 6 Source jhotdraw7 sre main java org jhotdraw gui JHotDraw 7 6 Source jhotdraw7 src main java org jhotdraw geom JHotDraw7 6 Source jhotdraw7 src main java org hotdraw util JHotDraw 6 Source jhotdraw7 src main java org jhotdraw xml JHotDraw7 6 Source jhotdraw7 src fmain java org jhot draw text JHotD raw7 6 Source hotdraw7 src main java org jhotdraw flo
16. Element java 4 File Name 0 Files of Type All Files To save the result follow the following steps VisCad User Guide 51 Save Cancel Step 1 To save the result click on the Export Metric Values button This will open a dialog box Select w the folder where you want to save the result Step 2 Provide the name of the file you want to save Step 3 Click on the Save button to complete the operation Plotting metric values File Metric Values Export Metric values Plot Browse Code Nim Total lone fra Toaoc a 3 XMLARTibutejava 1 ML Builder java ae o a NonValidatorjava p stdxmuParseriva 86 Bo mula ae 11 XMLElement java 5 To plot the metric values click the on the Plot button 1 CDATAReader java ContentReader java VisCad User Guide 52 Plotting metric values Continued File Metric Values Plot z A Select a metric you want to plot Total Clone Snippets v Total Clone Snippets otting of data Total Lines of code LOC Total clone LOC Total Clone Snippets 8 9 CRFL CDATAReader java EJ ConieniResder java The selected metric A XML Builder java Non Validator java SUM Builder java 4 ES JA Std XML Reader java Clone Files Granularity File Directory Clone Class Y
17. Fil ictri j i processedFiles Clone Distribution Window duplicatedLines tool duplicatedFiles processedLines duplicatedBlocks samples 42 06 draw 31 76 app 6 81 color 6 75 gui 5 00 geom 4 36 util 0 87 xml 0 81 text 0 76 io 0 58 undo 0 17 beans 0 06 net 0 00 Click on a directory in the system navigation tree to select it Based on the selection the clone distribution window updates and shows the distribution of clones in its subdirectories through a pie chart VisCad User Guide 22 Analyze Clone Fragments You can analyze the source code of the clone fragments using the code browser The same component is used for analyzing clone code fragments in other places also Open the popup menu and make selection Fm LIS MF WJ NEMZETI Pe a a notdraw7 Clone 1758 Cloned File 342 lib Clone 0 Cloned File 0 nbproject Clone 0 Cloned File 0 src Clone 1758 Cloned File 342 documentation Clone 0 Cloned File 0 3 main Clone 1758 Cloned File 342 java Clone 1758 Cloned File 342 net Clone 39 Cloned File 13 3 org Clone 1719 Cloned File 329 E jhotdraw Clone 1719 Cloned File 329 app Clone 117 Cloned File 33 beans Clone 1 Cloned File 1 color Clone 116 Cloned File 21 draw Clone 546 Cloned File 106 geom Clone 75 Cp AAA gui Clone 86 Clo io Clone 10 Clon net Clone O Cl
18. User Guide 13 Import result from NiCad Import Project Getting Result From NiCad Language ACTIONSCRIPT x Granularity Function w CF Source Patt Cd ResultFile _ Interproject Clones Ok Cancel A sample clone detection result JHotDraw7 6_functions clones 0 3 xml for JHotDraw Version 7 6 is included in the zip file You can also find the source code of the subject system in a zip file hotdraw 7 6 nested zip Clones were detected using NiCad Follow the steps listed below 1 Unzip the jhotdraw 7 6 nested zip file and rename the folder to JHotDraw7 6 2 Put the clone detection result file in the same directory where JHotDraw7 6 folder resides 3 Select the Import Result from NiCad menu item from the Project menu located on the top left of the VisCad interface This opens a dialog to import the result 4 Click on the Source Path button and select the source code directory In this case JHotDraw7 6 folder This should be the folder on which you apply clone detection 5 Now Click on the Result File button and select the clone detection result file In this case JHotDraw7 6_functions clones 0 3 xml 6 Select the language of the subject system and also the granularity of clone detection If you are not sure you can leave them as default 7 Now click on the Ok button to load the subject system by VisCad The loading time may vary depending on the size of the system 8 You can clic
19. VisCad User Guide Introducing VisCad 1 1 1 2 1 3 1 4 1 5 1 6 1 7 Introduction System Requirement Obtaining and Running VisCad Importing clone detection result User Interface Components Analyze Clone Fragments Analyze Clone Files Visualization 2 1 2 2 2 3 2 4 Introduction Scatter Plot Treemap Hierarchical Dependency Graph Code Clone Metrics 3 1 Introduction 3 2 Obtaining Metrics For Files 3 3 Obtaining Metrics For Directories 3 4 Obtaining Metrics For Clone Classes Filtering 4 1 Introduction 4 2 Overlapping Clone filterng 4 3 Textual filtering oOo N O oO A 23 27 31 32 36 41 48 49 55 58 62 63 68 Introducing VisCad VisCad User Guide 3 Introduction Detection and analysis of similar code fragments code clones has become an integral part of software maintenance In response over the last decade a great many clone detection techniques and tools have been proposed However identifying useful cloning information from the large volume of textual data produced by these detectors is challenging VisCad is a tool with which a user can visualize and analyze large volumes of raw cloning data in an interactive fashion Users can analyze and identify distinctive code clones through a set of visualization techniques metrics and data filtering operations The loosely coupled architecture of VisCad allows users to work with the clones of any clone detection tools that report sourc
20. a Open Clone File List resources test Clone O Templates Clong Analyze Overlapping Show TreeMap ScatterPlotView L Hierarchical Dependency Graph nau NU M MK ee O ee A A I o Select a directory and right clink on it to open the popup menu Click on the Show TreeMap menu item VisCad User Guide 36 Configure the treemap e 0 Clone oned File of You can select number of clones or clone LOC Cloned F TreeMap Setup 19 Clone 0 Cloned elect Parameter Number of Clone v File 0 d File TE a Horizontal Axis Length p Vertical Axis Length E 800 A You can change the size of the treemap A Ok Cancel re ol Click on the ok button A dialog box appears that can be used to configure thre neema Click on the ok button to open the treemap An Example FE action Be KKR NEK i mil An example of a treemap for the JHotDraw system Version 7 6 Putting the mouse over any rectangle will provide details information about that using a tooltip VisCad User Guide 37 Zoom in or zoom out Zoom in Zoom out Unzoom To Root Get Sources Right click on rectangle representing a directory opens a popup menu You can then perform zoom in or zoom out operation VisCad User Guide 38 An example of zoom in operation samples svg figures gui An example
21. aln java org jhotdraw geom JHotDraw7 6 Source Jhotdraw7 src main java org Jhotdraw gul JHotDraw7 6 Source jhotdraw7 src main java org jhotdraw to JHotDraw 6 Source jhotdraw7 sre main java org jhotdraw samples Ig JHotDraw7 6 Source hotdraw7 src main java org jhotdraw text JHotDraw 6 Source hotdraw7 src main java org jhotdraw fur JHotDraw 6 Source Jhotdraw src main java org hotdraw util v JHot Draw 7 6 Source jhotdraw7 sre main Java org jhotdraw xml The previous selection opens the above scatter plot on a new tab in the viewer view panel in the middle of the VisCad user interface Options Scatter Plot Leve You can change the level to compare more files or directories inside the selected directory JHotDraw7 6 SQ JHotDraw7 6 Sour JHotDraw7 6 O You can sort the cell otra SoN JHot Draw 6 Source jhotdraw src main java org jhotdraw beans JHotD raw7 6 Source jhotdraw7 sre main java forg Jhotdraw color JHotD raw 6 Source jhotdraw7 src main java org jhotdraw draw JHotDraw7 6 Source jhotdraw src main java orgijhotdraw geom JHotDraw7 6 Source jhotdraw7 sre main java org jhotdraw gul JHotDraw 6 Source jhotdraw7 src main java org jhotdraw to Cell colour represent the clone pairs common JHotDraw 6 Source jhotdraw src main java org jhotdraw samples beteen the directories JHot
22. asses Make the selection E Clone Class Tree Z m X JHo B 4 E Clone Classes 737 EZ CC 2 Fragments CC 3 Fragments CC 4 Fragments Select this CC 5 Fragments CC 6 Fragments CC 7 Fragments CC 8 Fragments CC 9 Fragments CC 10 Fragments CC 11 Fragments CC 12 Fragments CC 13 Fragments CC 14 Fragments CC 15 Fragments CC 16 Fragments CC 17 Fragments CC 18 Fragments CC 19 Fragments CC 20 Fragments HI Le H Click on the root node of the clone classes to select it from the clone class tree Metrics will be computed for all clone classes within it VisCad User Guide 58 Open the popup menu and select the operation E Clone Class Tree 2 xy JHotDraw7 6 CC l Frag CC 2 Frag CC 3 Frag CC 4 Frag Filter Clone Class CC 5 Frag Clone Class Metrics CC 6 Fragl CC 7 Fragments 2 CC 8 Fragments 2 CC 9 Fragments 3 CC 10 Fragments 2 CC 11 Fragments 2 CC 12 Fragments 2 CC 13 Fragments 2 C ldiFranmant lt 21 Right click on the selected node to open the popup menu Select Clone Class metrics menu item from the popup menu L L HEHH Result El Viewer 2 x Esa clone class Metric vetas JON New tab panel To sort the rows click on a column header
23. d Fragments fClone Pairs 4 q QQ WD D2 E y 022 0 QR A ee AS 36 1 468 613 JHotDraw 317 344 28 613 JHotDraw7 249 276 28 Clone pairs second tab of the code browser Click on a row to select a clone pair _ _ A A ___ _ _ _ _ _ _ o _ _ _ _____ Differencer HotDraw7 6 Source jhotdraw7 src main java org jhotdraw geom Insets2D java HotDraw7 6 Source jhotdraw7 src main java org jhotdraw geom lnsets2D java this left left ty ol as this bottom bottom this bottom bottom ia this right right prey mere aOverride i doubl tTop E public double getTop e ee pg A t return top 7 GOverride Source code of the selected clone pair Hue public double getLeft j return left GOverride E Daae daunle cetBoa om TE oe y For the selected clone fragments the next tab in the code browser shows the clone pairs Selecting a clone pair also displays the code fragments in the bottom panel Source code difference analysis O os on EL button to see the AS in the clone ai fraaments Start Line 249 End Line 276 i _ top this top top a left lefa Z this left left bottom O rinht ru this bottom bottom thic rinht rinht A diff viewer shows the differences of the code fragments OWO iblic double getTopi PCID is a number t
24. directory to open the popup menu and select Open Clone File List menu item VisCad User Guide 27 List of clone files O Viewer 2 X X Browse Clone by Files loned Fragments Within Same Class PCID 189 Path JHotDraw7 6 Source jhotdraw Source Path JHotDraw7 6 Source jhotdraw7 src main java org jhotdraw geom Bez pcio taretineft88 1 return that 2 catch CloneNotSupportedException e 3 InternalError error new InternalError loned Fragments Within Same Class PCID 190 Path JHotDraw7 6 Source jhotdraw7 src mait Source Path HotDraw7 6 Source jhotdraw src main java org jhotdraw geom BezierPath jav peao fstarebintas Si r 2 catch CloneNotSupportedException e 3 InternalError error new InternalError 4 error initCausele 4 error initCausele 5 throw error 5 throw error 6 7 6 7 7 GOverride GOverride Path Users 880Research Simian JHotDraw Source jhotdrar r Users muhammad 880Research Simian JHotDraw7 6 Source jhotdraw7 src main java or Path OResearch Simian JHotDraw7 6 Source jhotdraw7 sr fh Users muhammad 880Research Simian JHotDraw7 6 Source jhotdraw src main java orc Path Users muhammad 880Research Simian JHotDraw7 6 Source jhotdraw7 srffh Users muhammad 880Research Simian JHotDraw7 6 Source jhotdraw src main java orc Path Users muhammad 880Research Simian JHotDraw7 6 So
25. e 1758 Clq I Mele Matelaats n Clone 0 4 f 2 0 Cloned e 0 Cloned 1758 Clone Clone 1754 e 0 Cloned zt Clone 0 ne 1758 Clg mentation J a Flanna Y I E Overview 2 x Category Details processedFiles tool Similarity Analyser 2 3 32 INGE icatedFiles 414 processedLines 61258 342 3 150sec duplicatedBlocks processingTime Provide information that is produced by the clone detectors as part of clone detection result O Clone Distribution 2 X s java 100 00 resources 0 00 This part contains information such as tool name overview of clone detection result VisCad User Guide 21 Clone distribution window Project VisCad Analyzing Clones With Visualization E System Navigation 5 Clone O Cloned File 0 Clone 1758 Cloned File 342 Hraw7 Clone 1758 Cloned File 342 b Clone 0 Cloned File 0 bproject Clone 0 Cloned File 0 c Clone 1758 Cloned File 342 documentation Clone 0 Cloned File 0 main Clone 1758 Cloned File 342 java Clone 1758 Cloned File 342 net Clone 39 Cloned File 13 E or gli A loncibils E jhotdraw Clone 1719 Cloned File 32 lone 1 Cloned File 1 one 116 Cloned File 21 Selected directory in the system navigation tree CC 1 Fragments CC 2 Fragments CC 3 Fragments CC 4 Fragments Ox D Overview ax Cate d
26. e co ordinates of the found clones This yields the opportunity to work with the clone detectors of choice which is important for clone analysis since clone detectors have their own strengths and weaknesses VisCad User Guide 4 System Requirement 1 VisCad requires Java Runtime Environment JRE 6 or later You can download the recent JRE from here 2 We have successfully tested VisCad on Windows XP Windows 7 Max OS X version 10 6 and on some Linux distribution Such as Ubuntu 4 The more RAM your computer has the better performance you gain from VisCad However 2 0 GB or more is recommended 5 Display dimension of 1024 x 768 or greater is recommended VisCad User Guide 5 Obtaining and Running VisCad Follow the steps listed below 1 Download the VisCad_beta zip file from here You can obtain the most recent version of VisCad documentation source code from this location 2 Extract the contents of the archive 3 Double click on the VisCad jar file to run the program VisCad user interface VisCad Analyzing Clones With Visualization Project w __ E L O OOOO mL O System Navigatio 2 SZ a nx HViewer WEZ Pa _0x E Ove PERA a DxX E Clo MERA a 0x D Clone Class Tree 2 Em Running the viscad jar file opens the above window VisCad User Guide 6 Importing clone detection result VisCad requires the subject system and the clone
27. ect Clone 0 Cloned File 0 src Clone 1758 Cloned File 342 documentation Clone 0 Cloned File 0 3 main Clone 1758 Cloned File 342 java Clone 1758 Cloned File 342 net Clone 39 Cloned File 13 org Clone pas 7 jhotdra Open Clone List H app Open Clone File List beans Metrics color draw Analyze Overlapping Show TreeMap Hierarchical Dependency Graph samples Clone 723 Cloned File 113 text Clone 13 Cloned File 4 undo Clone 3 Cloned File 2 util Clone 15 Cloned File 3 xml Clone 14 Cloned File 5 resources Clone 0 Cloned File 0 test Clone 0 Cloned File 0 E Select a directory from the system navigation tree and right click on it to open a popup menu Click on the Scatter Plot View menu item VisCad User Guide 32 An example File Folder Both Sort By CLOC Sort By Clones Selection Type 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 5 3 3 3 3 3 3 3 3 3 3 3 3 g g g S g My S g g g g g R z R 5 gt gt gt R R R R a a a a a a a 8 8 8 8 8 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 x A A 5 5 JHotDraw7 6 Source Jhotdraw src main java org Jhotdraw app JHot Draw 7 6 Source hotdraw src main java org jhotdraw beans JHotDraw7 6 Source jhotdraw sr main java org hotdraw color JHotD raw 6 Source jhotdraw src main java org jhotdraw draw m JHotDraw 6 Source hotdraw7 src m
28. ed File 113 text Clone 13 Cloned File 4 undo Clone 3 Cloned File 2 util Clone 15 Cloned File 3 xml Clone 14 Cloned File 5 resources Clone 0 Cloned File 0 Open Clone File List Click on a directory to selct it Right click on it to open the popup menu and select Analyze Overlapping menu item VisCad User Guide 63 Overlapping Clone pairs list Overlapping Filter Overlapped Clones bounds getOwnerl get TRANSFORM createTransformedShape bounds bounds view getDrawingToViewTransform createTransformedShape bounds Stroke strokel Color strokeColor1 Stroke strake JHotDra JHotDra JHotDra JHotDra JHotDra JHotDra JHotDra JHotDra HotDra JHotDra JHotDra JHotDra JHotDra JHotDra JHotDra JHotDra o w w w 00 eR Oe e VisCad analyzes and shows the list of overlapping clone pairs VisCad User Guide 64 Set threshold value for overlapping clone filtering Overlapping E Filter Overlapped Clones omr s aetOwner aetl TRANSFORM createTransformedShapel bounds lt 12 z At first click on this button 4 1 Stroke strokes Color strokeColor2 2 Select the threshold value for ovelapping clone filtering E6 Overlaboing Filter 15 a Select overlap
29. g Clones With Visualization Project System Navigation Tree 2 X f O Viewer FE a nx Wax eon Category L Details E p ab Fl ksz ER processe 680 ocumentation Clone oned File 0 JavaDoc Clone 0 Cloned File 0 cupia Eart tool Similarity Samples Clone 0 Cloned File 0 E Source Clone 1758 Cloned File 342 duplicate 1414 jhotdraw7 Clone 1758 Cloned File 342 processe 61258 lib Clone 0 Cloned File 0 i duplicate 342 nbproject Clone O Cloned File 0 processin 3 150sec E src Clone 1758 Cloned File 342 J documentation Clone 0 Cloned File 0 E main Clone 1758 Cloned File 342 java Clone 1758 Cloned File 342 net Clone 39 Cloned File 13 org Clone 1719 Cloned File 329 resources Clone 0 Cloned File 0 test Clone 0 Cloned File 0 Templates Clone 0 Cloned File 0 System Navigation Tree p HY W EEE EJ Clone Class Tree X A JHotDraw7 6 O Clone Classes 737 CC 1 Fragments 2 CC 2 Fragments 2 CC 3 Fragments 2 CC 4 Fragments 2 CC 5 Fragments 3 CC 6 Fragments It maps clones to files and directories VisCad User Guide 18 Clone Class Tree VisCad Analyzing Clones With Visualization Project O System Navigation Tree 2 X e 0x E Viewer JHotDraw7 6 Clone
30. gineers are looking for or are interested in For example when the objective is to analyze the inter project clones users may be more interested in the clone classes whose fragments are distributed across different projects and these clone fragments form the set of useful clones In that case we can filter out the clone pairs that are not distributed across different projects VisCad supports a set of filtering operations to remove clones that are not useful interesting to the users VisCad User Guide 62 Overlapping Clone filterng Clones may overlapped each other and removing those overlapping clones also reduces the size of the result set Analyze overlapping O System Navigation Tree 7 X Ox Systems O HotDraw7 6 Clone 1758 Cloned File 347 Documentation Clq Open Clone List JavaDoc Clone 0 C Samples Clone 0 Q Source Clone 1754 Metrics E jhotdraw7 Clone lib Clone 0 C nbproject Cle 3 src Clone 17 ScatterPlotView documents Hierarchical Dependency Graph E main Clore remen gt java Clone 1758 Cloned File 342 net Clone 39 Cloned File 13 3 org Clone 1719 Cloned File 329 jhotdraw Clone 1719 Cloned File 329 app Clone 117 Cloned File 33 beans Clone 1 Cloned File 1 color Clone 116 Cloned File 21 draw Clone 546 Cloned File 106 geom Clone 75 Cloned File 8 gui Clone 86 Cloned File 30 io Clone 10 Cloned File 3 net Clone 0 Cloned File 0 samples Clone 723 Clon
31. gment Filter Selected clone class JHotDraw7 6 E of Clone Classes 737 Circle with blue color indicates leading node for the selected clo a a Circles with the red color represent other clones Y CC 554 Fragments 8 ee Y CC 67 Fragments 7 ee of CC 124 Fragments 7 of CC 291 Fragments 7 o of CC 101 Fragments 6 of CC 118 Fragments 6 ff CC 222 Fragments 6 of CC 316 Fragments 6 of CC 404 Fragments 6 Y CC 501 Fragments 6 Y CC 15 Fragments 5 Y CC 96 Fragments 5 Y CC 106 Fragments 5 af CC 135 Fragments 5 0 0 Distance Distance from leading node PCID 274 Similarity values First one is the leading clone fragment Filter the result Sort By Clone Fragmen Fitter JHotDraw7 6 E 3 of Clone Classes 737 Circle with blue color indicates leading node for the selected af CC 728 Fragments 20 1 Click on this button Circles with the red color represent other clones SAA W of CC 414 Fragments 9 0 0 3 BY co ssa Fragments 8 i e of CC 67 Fragments 7 LE af CC 124 Fragments 7 4 CC 291 Fragments 7 of CC 101 Fragments 6 Y CC 118 Fragments 6 of CC 222 Fragments 6 0 1 ee of CC 316 Fragments 6 af CC 404 Fragments 6 Filter Y CC 501 Fragments 6 El 4 CC 15 Fragments 5 R Y CC 96 Fragments 5 af CC 106 Fragments 5 of CC 135 Fragments 5 PCID Select a distance value to perform f
32. guage of the subject system and also the granularity of clone detection If you are not sure you can leave them as default 9 Now click on the Ok button to load the subject system by VisCad The loading time may vary depending on the size of the system 10 You can click on the Cancel button to cancel the import operation rr VisCad User Guide 16 Import VisCad input file 60 Import Project Getting Result From VisCad Input File Language ACTIONSCRIPT w Granularity Function z SourcePath CS Y ResultFile _ Interproject Clones Ok Cancel E gg Oe For any other clone detection tools the result file needs to be converted to the VisCad input file format A sample clone detection result resultViscadInputFile txt for JHotDraw Version 7 6 is included in the VisCadBeta zip file Clones were detected using Simian Follow the steps listed below 1 Unzip the jhotdraw 7 6 nested zip file and rename the folder to JHotDraw7 6 2 Put the clone detection result file in the same directory where JHotDraw7 6 folder resides 3 Select the Import VisCad Input File menu item from the Project menu located on the top left of the VisCad interface This opens a dialog to import the result 4 Click on the Source Path button and select the source code directory In this case JHotDraw7 6 folder This should be the folder on which you apply clone detection 5 Now click on the Result File button and select
33. h JHotDraw7 6 Source jhotdraw7 sl This view has some advantages It groups clone fragments located within the selected file labelled with 1 For the selected clone fragment it also groups all clone fragments that falls within the same clone class labelled with 2 The left and right part shows the same list of clone files We can change the selection and compare the related clone fragments side by side VisCad User Guide 29 Visualization VisCad User Guide 30 Introduction Visualization plays an important role in code clone analysis since it can provide high level overview of cloning in a system At present VisCad supports three different visualizations which are scatter plot treemap and hierarchical dependency graph VisCad User Guide 31 Scatter Plot A scatter plot can be viewed as a two dimensional matrix where each cell represents the cloning status between a pair of files or directories In VisCad cells render the clone pairs distributed between a pair of files or directories using a color heatmap Cells are also labelled in the horizontal and vertical axes Opening a scatter plot O System Navigation Tree 27 X Systems a E JHotDraw7 6 Clone 1758 Cloned File 342 Documentation Clone 0 Cloned File 0 JavaDoc Clone 0 Cloned File 0 Samples Clone 0 Cloned File 0 Source Clone 1758 Cloned File 342 E jhotdraw7 Clone 1758 Cloned File 342 lib Clone 0 Cloned File 0 nbproj
34. hat uniquely identifies a clone fragment return top We can understand the source code differences using the diff viewer In the above figure the two clone fragments are exact copy of each other Similar to PCID another number CCID is used to uniquely identify each clone class VisCad User Guide 26 Analyze Clone Files You can use this view to analyze and compare clone files with grouping and selection features Make selection O System Navigation Tree 2 X EPT O View a ivaDoc Clone 0 Cloned File amples Clone 0 Cloned File 0 ource Clone 1758 Cloned File 342 y jhotdraw7 Clone 1758 Cloned File 342 lib Clone O Cloned File 0 nbproject Clone O Cloned File 0 src Clone 1758 Cloned File 342 documentation Clone O Cloned File 0 main Clone 1758 Cloned File 342 java Clone 1758 Cloned File 342 net Clone 39 Cloned File 13 HE org Clone 1719 Cloned File 329 E jhotdraw Clone 1719 Cloned File app Clone 117 Cloned File 33 beans Clone 1 Cloned File 1 color Clone 116 Cloned File 2 draw Clone 546 Cloned File 10 geom Clans 75 Clanad File Ri Bezie Open Clone List Beziel Open Clone File List Conv Doub Geom Analyze Overlapping Gro Show TreeMap Insets Polyg ScatterPlotView gui Clot Hierarchical Dependency Graph io Clone xro cnore nat Clana N Clanad Fila Mi w Select a target directory Right click on the selected
35. i Clone 86 Cloned File Metrics io Clone 10 Cloned File 3 net Clone 0 Cloned File 0 samples Clone 723 Clone Show TreeMap text Clone 13 Cloned File searrerPlotView undo Clone 3 Cloned File 7 i util Clone 15 Cloned File Hierarchical Dependency Graph xml Clone 14 Cloned File 5 resources Clone 0 Cloned File 0 Open Clone List Analyze Overlapping Select a directory from the system navigation tree and right click on it to open a popup menu Click on the Hierarchical Dependency Graph menu item VisCad User Guide 41 Configure the graph _ Enable edge width encoding hoice Number of Common Clone Classes w Number of Common Clone Classes Number of Clone Pairs Common _ Enable node size encoding None Node Height Coupling Y Node Width ox cana Edge width can represent number clone classes clone pairs distribued between a pair of directories Nodes width and height can represent cohesion and coupling value Click on the ok button when you are done VisCad User Guide 42 An example Hierarchical Dependency Graph Zoomin Zoom out Mode Picking v Selected directory is represnted as a diamond shaped node A rectangle reprents a directory where the clone files are collapsed in it Suppose we want to unde
36. iltering Distance 174 175 176 177 172 73 71 169 170 Click on the ok button Distance from lead 0 4 VisCad User Guide 69 Filter the result Continued Viewer 2 xy zu Similarity Browser r Sort By Clone Fragment Filter JHotDraw7 6 E Clone Classes 737 Bef CC 1 Fragments 2 Circles with the red color represent other clones Y PCID 1 Path JHotDraw7 6 Source jhotdraw7 src main java org jhdtdraw Lf PCID 2 Path JHotDraw7 6 Source jhotdraw src main java org jhdtdraw 2 ES CC 2 Fragments a gt L of PCID 3 Path of PCID 4 Path Circle with blue color indicates leading node for the selected clone 0 0 E CC 3 Fragmen EMM ear oooO ja of PCID 5 Path a BE of PCID 6 Path ES CC 4 Fragments 2 M 880Research E Downloads A javadoc L of PCID 7 Path JHotDraw 6 Source jhotdraw7 src main java org jh Components Dropbox Ef jtxldb 0 12 af PCID 8 Path JHotDraw7 6 Source jhotdraw7 src main java org jhd E CC 5 Fragments 3 core dwhelper kdiff3 app Lf PCID 11 Path JHotDraw7 6 Source jhotdraw7 src main java org j cyclone examples latest api diffs PCID 9 Path JHotDraw7 6 Source jhotdraw src main java org jhd 2 k I bn PCID 10 Path JHotDraw7 6 Source jhotdraw7 src main java org j ll ca k
37. k on the Cancel button to cancel the import operation VisCad User Guide 14 Import RCF file IIN HHI Import Project Getting Result From RCF Language ACTIONSCRIPT x Granularity Function w CY Source Path z RCF File _ Interproject Clones Ok Cancel E For this example we have used GNU Wget Download both the subject system and the RCF file from here The RCF file is packaged with the source code of the subject system Follow the steps listed below 1 Extract the content of the archive and rename the folder to rcfResult You now have two folders inside the rcfResult folder One is the wget that contains the source code of seven different versions of the system Another one is the wget rcf that contains the clone detection results of those systems in the RCF format 2 Select the Import RCF menu item from the Project menu located on the top left of the VisCad interface This opens a dialog to import the result 3 Click on the Source Path button and select the wget folder located inside the rcfResult folder 4 Now click on the RCF File button and select the wget rcf file 5 Select the language of the subject system and also the granularity of clone detection If you are not sure you can leave them as default 6 Now click on the Ok button to load all seven subject subjects by VisCad The loading time may vary depending on the number of subject systems 7 You can click on the Cance
38. l button to cancel the import operation VisCad User Guide 15 Import result from CCFinder Import Project Getting Result From CCFinder ie nie ACTIONSCRIPT x Granularity Function v Source Path PO Rest Fite PY exp Dir _ Interproject Clones Ok Cancel During the clone detection CCFinder creates a directory ccfxprepdir If you apply clone detection on JHotDraw7 6 directory then the ccfxprepdir will be created right inside that directory Follow the steps listed below 1 Unzip the jhotdraw 7 6 nested zip file and rename the folder to JHotDraw7 6 Detect clones with CCFinder and then rename the ccfxprepdir directory to ccfxprepdir 2 The output file is a binary one such as a ccfxd You need to convert that into a text file see here From now we will refer the text file as the result file 3 Put the clone detection result file in the same directory where JHotDraw7 6 folder resides 4 Select the Import CCFinder Project menu item from the Project menu located on the top left of the VisCad interface This opens a dialog to import the result 5 Click on the Source Path button and select the source code directory In this case JHotDraw7 6 folder This should be the folder on which you apply clone detection 6 Now click on the Result File button and select the clone detection result file 7 Click on the Ccfxprep Dir button and select the ccfxprepdir directory 8 Select the lan
39. lone O Cloned File 0 Samples Clone 0 Cloned File 0 Source Clone 1758 Cloned File 342 jhotdraw7 Clone 1758 Cloned File 342 lib Clone 0 Cloned File 0 nbproject Clone 0 Cloned File 0 src Clone 1758 Cloned File 342 documentation Clone 0 Cloned File 0 main Clone 1758 Cloned File 342 java Clone 1758 Cloned File 342 UHHH Templates Clone 0 Clghed File 0 Selected directory Click on a target directory to select it from the system navigation tree Metrics will be computed for all clone directories within it VisCad User Guide 55 Open the popup menu and select the operation nm pr UJELt LRMVIIC U KLIUIICTCU Tine UY src Clone 1758 Cloned File 342 documentation Clone 0 Cloned File 0 3 main Clone 1758 Cloned File 342 java Clone 1758 Cloned File 342 net Clone 39 Cloned File 13 org Clone 1719 Cloned File 329 resources Clone Open Clone List test Clone O Cloned Templates Clone 0 Cle Metrics Analyze Overlapping Show TreeMap ScatterPlotView Open Clone File List Hierarchical Dependency Graph Select this menu item y Metrics for directories Right click on the selected directory to open the popup menu Select Metrics gt Metrics for directories from the menu DViewer 2 xy ae
40. lt File File Click on this button Ir gt _ Interproject Clones C1 Click on this button Cancel Cancel CI Complete the import opeation Import Project Click on the ok button finish the import op Language JAVA w Granularity Both w Users muhammad 880Research Simian JHotDraw Source Path Users muhammad 880Research Simian jhotdrawResultSim Mt Result File _j Interproject Clones VisCad User Guide 11 ox cance Loading clone detection result Project Loader Please wait while VisCad is indexing code clones 40 VisCad is now loading the clone detection result Complete the loading operation l VisCad Analyzing Clones With Visualization O System Navigatio Systems JHotDraw7 6 Clone 1758 Cloned File 342 Documentation Clone 0 Cloned File 0 JavaDoc Clone 0 Cloned File 0 Samples Clone 0 Cloned File 0 Source Clone 1758 Cloned File 342 El Clone Class Tree 4 X JHotDraw7 6 Clone Classes 737 The result is loaded into VisCad VisCad User Guide 12 processedFiles duplicatedLines tool Similarity Ana duplicatedFiles 1414 processedLines 61258 i 3 150sec Import result from SimScan Import Project Getting Result From SimScan Language ACTIONSCRIPT Y Granularity Function CF Source path Cd ResultFolder e _ Inte
41. of zoom in operation on the samples directory We can select the zoom out operation to move one step back or can select the unzoom to root option to move back to the beginning state Obtaining source code of the clone fragment Zoom in Zoom out Unzoom To Root Right click on a rectangle and select the Get Source menu item This will open the clone code fragments of the file s in a new tab using the clone code browser For details about the code browser see VisCad User Guide 39 Obtaining clone distribution information Treemap SystemJHotDraw7 6 TreeMap of JHotDraw7 6 El JHotDraw7 6 Clone 1758 Cloned File 342 Documentation Clone 0 Cloned File 0 JavaDoc Clone O Cloned File 0 EH Samples Clone O Cloned File 0 EJ Source Clone 1758 Cloned File 342 Clone files containing the clones of the selected clone class Select a clone class y C 724 Fragments a y E Cer CC 725 Fragments 2 CC 727 Fragments 4 CC 728 Fragments 20 CC 730 Fragments 2 CC 731 Fragments 2 CC 732 Fragments 2 CC 733 Fragments 2 CC 734 Fragments 2 CC 735 Fragments 3 CC 736 Fragments 2 CC 737 Fragments 2 E You can understand how the clone fragments of a clone class are distributed with the help of a treemap Select a clone class from the bottom left panel and the files containing those clones will be marked
42. on Metrics samples Clone 7 text Clone 13 Clq Analyze Overlapping undo Clone 3 Cld Show TreeMap util Clone 15 Clo xml Clone 14 Cld resources Clone 0 Cloned Hierarchical Dependency Graph test Clone 0 Cloned File 0 Templates Clone 0 Cloned File 0 ScatterPlotView If we want to analyze the clone fragments on the geom directory we need to select the directory right click on the mouse button to bring up the popup menu and select the Open clone list menu item VisCad User Guide 23 The code browser E Viewer z X Clone Code Browser First tab in the code browser shows the clone files and the fragments within the files Clone Files and Fragments a BezierPath j JHotDraw7 6 Source jhotdraw BezierPathit JHotDraw7 6 Source jhotdraw Status 80 JHotDraw7 219 JHotDraw7 219 JHotDraw7 243 JHotDraw7 325 JHotDraw7 325 JHotDraw 439 HotDraw7 439 JHotDraw 439 JHotDraw 612 JHotDraw 612 JHotDraw 635 JHotDraw7 635 JHotDraw7 ConvexHull JHotDraw7 6 Source jhotdraw DoubleStro JHotDraw7 6 Source jhotdraw Geom java JHotDraw7 6 Source jhotdraw GrowStroke JHotDraw7 6 Source jhotdraw a insets2D java JHotDraw7 6 Source jhotdraw a Polygon2D j HotDraw 7 6 Source jhotdraw SIEJAJEJSJEJ IA LISS SSS SSS SSS Gifferencer Clone Files Shows the clone
43. osel else i result null return result Code Clone Metrics VisCad User Guide 47 Introduction For supporting in depth clone analysis VisCad can compute a set of metrics We can divide the metrics into two broard categories The first set of metrics clone system metric set relate clones with the organizational structure of the subject system and can be computed for different system boundaries such as for the entire system for subsystems directories or for source files as per the user s choice Depending on the granularity of operation we can again subdivide them into two groups the file metric set and the directory metric set The next set of metrics clone class metrics set deals with the clone classes VisCad supports four operations for each metric set These are 1 Exporting Results of metric computations can be exported in CSV comma separated values format 2 Plotting Although metrics are important for quantitative analysis identifying important patterns from a large set of data is difficult To avoid such difficulties users can plot the metrics values with a bar chart which helps in identifying an anomaly within clone patterns easily 3 Browsing Clone Code Depending on the metrics values user may be interested to explore the clone fragments located within a file or directory VisCad also supports such operation 4 Sorting Values can be sorted to locate the maximum or the minimum value easily
44. ou can change the selection to plot different metric values Putting the cursor over a bar provides the detail path information VisCad User Guide 53 Browsing clone code fragments File Metric Values 2 Export Metric values Plot Browse Code e one A AAA AA AA CRFL p 30 i i AMLParserbactOry java 2 LU 0 24 hi 10 XMLAttribute java 1 151 44 0 29139072 J po piReaderjaa Sa 07133758 Ji l CDATAReader java 4 193 172 0 8911917 J Ro ContentReaderjava 212 8G 16981132 y 3 ibarra 7 6 St amp Xipuilderjava E 3362 bosmas e ValidatorPlugimgava Jez ia o 03275357 B stdtMtReaderjna 2 1 ear Jo o 06379585 a Nonvalidator java as s or osema p JstdxMparserjwa a 696 a ot2068966 13 XMLUtiljava 1 763 14 0 018348623 11 XMI Flement iava 5 1138 144 0 12H53778 IH Step 1 Select one or more rows by holding the command key in MAC or control key in Windows Step 2 Now click on the Browse Code Button to analyze the clone code fragments in the selected file s with the source code browser VisCad User Guide 54 Obtaining Metrics For Directories This section discusses the steps for obtaining various metrics values for all clone directories within a selected directory A clone directory is a directory that contains at least one clone fragment Select a directory O System Navigation Tree Z X a DX Systems E JHotDraw7 6 Clone 1758 Cloned File 342 Documentation Clone 0 Cloned File 0 JavaDoc C
45. ping threshold to perform filtering 7 0 10 20 30 40 50 60 70 80 90 100 Pl 2 JHotDra JHotDra JHotDra JHotDra JHotDra UHotDra JHotDra JHotDra JHotDra JHotDra JHotDra JHotDra JHotDra 14 JHotDra 15 JHotDra 16 JHotora 17 IHatDra Wl orn an vil amp WwW N a 0 14 265 656 483 494 268 664 1492 500 0 14 265 656 483 494 339 836 492 501 0 47 268 664 492 500 1339 836 1492 501 0 28 286 701 135 144 552 1330 137 ss Jol wl walo w me el oanl e e VisCad User Guide 65 Saving the result A Filter Overlapped Clones bounds getOwnerl get TRANSFORM createTransformedShapel bounds 142 y 143 bounds view getDrawingToviewTransformi createTransformedShape bounds 144 Stroke strokel 145 Color strokeColor1 146 Stroke stroke2 147 Color 148 149 Click on the Yes button to open a save dialog box 150 151 152 153 154 155 Regult of filtering Source PLO 1 JHotDra 6 0 23 ant to export the result 1427 145 2 JHotDra 10 0 34 3 JHotDra 3 0 11 4 HotDra 1 0 02 5 JHotDra 10 0 45 6 JHotDra 1 0 05 7 JHotDra 1 0 05 8 JHotDra 6 0 24 9 JHotDra 1 0 04 10 JHotDra 1 0 03 203 506 519 535 11 JHotDra 8 0 38 207 514 323 330 12 JHotDra 8 0 25 207 514 323 330 13 JHotDra 6 0
46. rproject Clones Ok Cancel SimScan creates a folder that contains the output of the clone detection A sample clone detection result jhotdrawReportSimScan zip for JHotDraw Version 7 6 is included in the VisCadBeta zip file You can also find the source code of the subject system in a zip file jhotdraw 7 6 nested zip Follow the steps listed below 1 Unzip the jhotdraw 7 6 nested zip file and rename the folder to JHotDraw7 6 2 Unzip the jnotdrawReportSimScan zip file This will create a folder jnotdrawReportSimScan that contains the clone detection results Put the folder in the same place where JHotDraw7 6 folder resides 3 Select the Import Result from SimScan menu item from the Project menu located on the top left of the VisCad interface This opens a dialog to import the result 4 Click on the Source Path button and select the source code directory In this case JHotDraw7 6 folder This should be the folder on which you apply clone detection 5 Now click on the Result Folder button and select the clone detection result folder In this case jhotdrawReportSimScan 6 Select the language of the subject system and also the granularity of clone detection If you are not sure you can leave them as default 7 Now click on the Ok button to load the subject system by VisCad The loading time may vary depending on the size of the system 8 You can click on the Cancel button to cancel the import operation VisCad
47. rstand which directories in the system contain the external clones of the color directory We select the color directory from the system navigation tree open the popup menu and select the Hierarchical Dependency Graph With the default settings we get a graph as shown in the above figure From the figure we can understand that the color directory has external cloning relationship with the gui undo and beans directories VisCad visualizes the graph by filtering those nodes that do not have any cloning relation with the selected directory VisCad User Guide 43 Another example Hierarchical Dependency Graph _ Zoom in Zoom out Mode Picking The above figure shows the hierarchical dependency graph for the jhotdraw draw directory In this case node s represnting the directory width and height represent the clone cohesion and coupling value Node color value represent the external cloning relation level with the target directory Two mode of interaction Hierarchical Dependency Graph s R i de Picki v Click to zoom in or y i a zoom out Click here to change the mode of interaction E In the picking mode you can select individual node and move them In the transforming mode you can move the entire graph VisCad User Guide 44 Obtaining external or internal clone pairs Y nn WOW WWW W WWW WW WWW a a
48. s for directories Analyze Overlapping 4 Metrics for Files i Show TreeMap ScatterPlotView Hierarchical Dependency Graph Select this menu item Right click on the selected directory to open the popup menu Select Metrics gt Metrics for files from the menu Result EViewer_2 x fa 8x File Metric Values x A New Tab Panel l Export Metric values Browse Code _ O O Total Clone fragments Total LOC Clone LOC CRFL 1 CDATAReaterjava d la 193 172 0 8911917 2 ContentReader java nanoxml ContentReader java 12 212 36 0 16981132 3 Ladino ico adi da i 216 12 0 055555556 4 1633 491 0 7756714 5 r 157 112 0 7133758 A Buttons for three operations ET T 03714287 7 1 Exporting 2 Plotting 3 Browsing clone code fragment 696 78 0 112068966 8 627 40 0 06379585 EA 422 14 0 033175357 10 XMLAttribute java JHotDraw 7 6 Source jhotdraw src main java net n3 nanoxml XMLAttribute java 151 44 0 29139072 11 7 XMLElement java JHotDraw7 6 Source jhotdraw7 src main java net n3 nanoxml XMLElementjava 1138 F 144 0 12653778 12 XMLParserFactory java HotDraw7 6 Source jhotdraw7 src main java net n3 nanoxml XMLParserFactory java 2 150 36 0 24 13 XMLUtil java HotDraw7 6 Source jhotdraw7 src main java net n3 nanoxml XMLUtil java 11 763 14 0 018348623 The computed metrics values for all clone files will be displayed as a new tab panel
49. ser Guide 8 Importing clone detection result of Simian Continued Select the granularity of operation If you are not sure just leave it as default Import Select the language z Getting Result From Simian Source Path Language Result File _ Interproject Clones Ok Cancel pres ee 8 x This opens the above dialog box VisCad User Guide 9 Select subject system Open e tm A E YP Navigatio x NJ o Click on the open button File Name Users muhammad 880Research Simian JHotDraw N 3 Files of Type All Files w Open Cancel Simian Click F a on this button Language WA O Granularity TEA Cd ResultFile _ Interproject Clones Ok Cancel Import Project Select the location of the subject system lass Tree 7 mi VisCad User Guide 10 Select the clone detection result file JHotDraw7 6 jhotdrawResultSimian txt Look In Gj Simian v 5 KI EJ EJ Open File Name jhotdrawResultSimian txt Files of Type all Files locate the result file mpo Projec gt Getting Result From Simian A L anguage Td Granularity Both w pe A Users muhammad 880Research Simian JHotDraw7 6 Source Path a Resu
50. tedException e 3 InternalError error new InternalError 4 error initCausele E r that l 2 catch CloneNotSupportedException ej 3 InternalError error new InternalError 4 error initCausele throw error 5 throw error 6 F 7 7 Override Override Selected clone file Users muhammad 880Research Simian JHotDraw Source jhotdraw Users muhammad 880Research Simian JHotDraw7 6 Source jhotdraw7 src main java ord fUsers muhammad 880Research Simian JHotDraw7 6 Source jhotdraw7 src main java orc Users muhammad 880Research Simian JHotDraw7 6 Source jhotdraw7 src main java orc fUsers muhammad 880Research Simian JHotDraw7 6 Source jhotdraw src main java orc Users muhammad 880Research Simian JHotDraw7 6 Source jhotdraw7 src main java orc Users muhammad 880Research Simian JHotDraw7 6 Source jhotdraw7 src main java orc Users muhammad 880Research Simian JHotDraw7 6 Source jhotdraw7 src main java orc J loned Fragments Within Same File PCID 190 Path JHotDraw7 6 Source jhotdraw7 src main ja Path Users muhammad 880Research Simian JHotDraw7 6 Source jhotdraw7 sr Path Users muhammad 880Research Simian JHotDraw7 6 Source jhotdraw7 srt Path Users muhammad 880Research Simian JHotDraw7 6 Source jhotdraw7 sr Path Users muhammad 880Research Simian JHotDraw7 6 Source jhotdraw7 sr Path Users muhammad 880Research Simian JHotDraw7 6 Source jhotdraw7 sr el PCID 190 Pat
51. the clone detection result file In this case resultViscadlnputF ile txt 6 Select the language of the subject system and also the granularity of clone detection If you are not sure you can leave them as default 7 Now click on the Ok button to load the subject system by VisCad The loading time may vary depending on the size of the system 8 You can click on the Cancel button to cancel the import operation VisCad User Guide 17 User Interface Components The main user interface of VisCad can be divided into three parts 1 Left Part The left part accommodates the clone browser The clone browser has two parts one of which displays the distribution of clones over the directories and sub directories in the subject system known as System Navigation Tree The other part located on the bottom of the clone browser lists all clone classes and the number of clone snippets in each class called Clone Class Tree 2 Middle Part The middle part of VisCad accommodates different views in separate tabs We will refers this part as Viewer 3 Right Part The top right window shows the clone detection specific information VisCad obtained while parsing the result file for the selected subject system For any selected directory in the system navigation tree the bottom right window shows the distribution of clones in its sub directories through a pie chart System Navigation Tree ADO VisCad Analyzin
52. urce jhotdraw7 sr fh Users muhammad 880Research Simian JHotDraw7 6 Source jhotdraw7 src main java org Path Users muhammad 880Research Simian JHotDraw7 6 Source jhotdraw7 sr fh Users muhammad 880Research Simian JHotDraw7 6 Source jhotdraw7 src main java orc Path Users muhammad 880Research Simian JHotDraw7 6 Source jhotdraw7 sr fh Users muhammad 880Research Simian JHotDraw7 6 Source jhotdraw7 src main java orc Path Users muhammad 880Research Simian JHotDraw7 6 Source jhotdraw7 srgfh Users muhammad 880Research Simian JHotDraw7 6 Source jhotdraw src main java orc loned Fragments Within Same File PCID 190 Path JHotDraw7 6 Source jhotdraw7 si Cloned Fragments Within Same File PCID 190 Path JHotDraw7 6 Source jhotdraw7 src main jav We can select a clone file from the list of files VisCad User Guide 28 Features E Viewer X ax Browse Clone by Files loned i PA ints Within Same Class Source Path JHotDraw7 6 Source jhot PCID 189 Path JHotDraw7 6 Source jhotdrav jCloned Fragments Within Same Class PCID 190 Path JHotDraw7 6 Source jhotdraw src mail PCID 189 Path jJrotDraw7 6 Source jhotdra c main java org jhotdraw mples odg geom El PCID 190 Path JHotDraw7 6 Source jhotdraw7 src main java org jhotdraw geom BezierPath java java org jhotdraw geom BezierPath javi 7188 Enc return that 2 catch CloneNotSuppor
53. with red color in the treemap VisCad User Guide 40 Hierarchical Dependency Graph Clones are more problematic when members of a clone class scattered in different parts of a software system because this requires changes need to be made in different parts of the system Thus it is required to discover how clone fragments are distributed across subsystems directories Moreover understanding cloning relationships among different subsystems can also reveal their dependencies VisCad can render the hierarchical organization of a software system along with the distribution of clones using a hierarchical dependency graph Opening the graph EJ System Navigation Tree 4 X a Dx HViewer 4 x pi Systems E JHotDraw7 6 Clone 1758 Cloned File 342 Documentation Clone 0 Cloned File 0 JavaDoc Clone 0 Cloned File 0 Samples Clone 0 Cloned File 0 Source Clone 1758 Cloned File 342 E jhotdraw7 Clone 1758 Cloned File 342 lib Clone 0 Cloned File 0 nbproject Clone 0 Cloned File 0 src Clone 1758 Cloned File 342 documentation Clone 0 Cloned File 0 3 main Clone 1758 Cloned File 342 java Clone 1758 Cloned File 342 net Clone 39 Cloned File 13 3 org Clone 1719 Cloned File 329 E jhotdraw Clone 1719 Cloned File 329 app Clone 117 Cloned File 33 beans Clone 1 Cloned File 1 color Clone 116 Cloned F draw Clone 546 Cloned F geom Clone 75 Cloned Fil Open Clone File List gu

Download Pdf Manuals

image

Related Search

Related Contents

Analyseur portable de combustion  Epson 3100Z Digital Camera User Manual  Instrunction Sheet  VALFRI Double oven  NDIR方式CO2 センサ - エースポイントシステムズ株式会社  Telekurs iD html Mode d`emploi rapide  取扱説明書  Fiery カラーリファレンス  USER MANUAL md4-200 Version 2.2  Bedienungsanleitung als PDF Datei  

Copyright © All rights reserved.
Failed to retrieve file