File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/cognitive/ui/AddToDoItemDialog.java | File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/uml/ui/UMLAddDialog.java | |||
Method name: void doAdd()
|
Method name: List getSelectedChoices()
|
|||
Number of AST nodes: 2 | Number of AST nodes: 2 | |||
1 | private void doAdd() { | 1 | /** | |
2 | Designer designer = Designer.theDesigner(); | 2 | * Returns the selected elements in the selected list | |
3 | String headline = headLineTextField.getText(); | 3 | * | |
4 | int priority = ToDoItem.HIGH_PRIORITY; | 4 | * @return List | |
5 | switch (priorityComboBox.getSelectedIndex()) { | 5 | */ | |
6 | case 0: | 6 | private List getSelectedChoices() { | |
7 | priority = ToDoItem.HIGH_PRIORITY; | 7 | List result = new ArrayList(); | |
8 | break; | 8 | for (int index : selectedList.getSelectedIndices()) { | |
9 | case 1: | 9 | result.add(selectedList.getModel().getElementAt(index)); | |
10 | priority = ToDoItem.MED_PRIORITY; | 10 | } | |
11 | break; | 11 | return result; | |
12 | case 2: | 12 | } | |
13 | priority = ToDoItem.LOW_PRIORITY; | |||
14 | break; | |||
15 | } | |||
16 | String desc = descriptionTextArea.getText(); | |||
17 | String moreInfoURL = moreinfoTextField.getText(); | |||
18 | ListSet newOffenders = new ListSet(); | |||
19 | for (int i = 0; i < offenderList.getModel().getSize(); i++) { | |||
20 | newOffenders.add(offenderList.getModel().getElementAt(i)); | |||
21 | } | |||
22 | ToDoItem item = | |||
23 | new UMLToDoItem(designer, headline, priority, | |||
24 | desc, moreInfoURL, newOffenders); | |||
25 | designer.getToDoList().addElement(item); //? inform() | |||
26 | Designer.firePropertyChange(Designer.MODEL_TODOITEM_ADDED, null, item); | |||
27 | } | |||
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.714 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
17 | for (int i = 0; i < offenderList.getModel().getSize(); i++) |
| 2 | for (int index : selectedList.getSelectedIndices()) | ||||||||||||||||||||||
18 | newOffenders.add(offenderList.getModel().getElementAt(i)); |
| 3 | result.add(selectedList.getModel().getElementAt(index)); |
Row | Violation |
---|---|
1 | Type javax.swing.ListModel of variable offenderList.getModel() does not match with type int[] of variable selectedList.getSelectedIndices() |
2 | Expression i cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression index cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Type org.argouml.cognitive.ListSet of variable newOffenders does not match with type java.util.List of variable result |