File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/ui/explorer/PerspectiveConfigurator.java | File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/uml/ui/UMLAddDialog.java | |||
Method name: void sortJListModel(JList)
|
Method name: List getSelectedChoices()
|
|||
Number of AST nodes: 2 | Number of AST nodes: 2 | |||
1 | /** | 1 | /** | |
2 | * @param list the JList to be sorted | 2 | * Returns the selected elements in the selected list | |
3 | */ | 3 | * | |
4 | private void sortJListModel(JList list) { | 4 | * @return List | |
5 | DefaultListModel model = (DefaultListModel) list.getModel(); | 5 | */ | |
6 | List all = new ArrayList(); | 6 | private List getSelectedChoices() { | |
7 | for (int i = 0; i < model.getSize(); i++) { | 7 | List result = new ArrayList(); | |
8 | all.add(model.getElementAt(i)); | 8 | for (int index : selectedList.getSelectedIndices()) { | |
9 | } | 9 | result.add(selectedList.getModel().getElementAt(index)); | |
10 | model.clear(); | 10 | } | |
11 | Collections.sort(all, new Comparator() { | 11 | return result; | |
12 | public int compare(Object o1, Object o2) { | 12 | } | |
13 | return o1.toString().compareTo(o2.toString()); | |||
14 | } | |||
15 | }); | |||
16 | for (Object obj : all) { | |||
17 | model.addElement(obj); | |||
18 | } | |||
19 | } | |||
See real code fragment | See real code fragment |
Number of mapped statements | 2 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 0.0 |
Similarity Score | 0.375 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | for (int i = 0; i < model.getSize(); i++) |
| 2 | for (int index : selectedList.getSelectedIndices()) | ||||||||||||||||||
4 | all.add(model.getElementAt(i)); |
| 3 | result.add(selectedList.getModel().getElementAt(index)); |
Row | Violation |
---|---|
1 | Type javax.swing.DefaultListModel of variable model does not match with type int[] of variable selectedList.getSelectedIndices() |
2 | Type javax.swing.DefaultListModel of variable model does not match with type int[] of variable selectedList.getSelectedIndices() |
3 | Expression i cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression index cannot be parameterized, because it has dependencies to/from statements that will be extracted |