if ((index != -1) && ((index + 1) < text.length())) { // mnemonic found // ...and not at the end of the string (which doesn't make sence) char mnemonic = text.charAt(index + 1); StringBuffer buf = new StringBuffer(); // if mnemonic is first character of this string if (index == 0) { buf.append(text.substring(1)); } else { buf.append(text.substring(0, index)); buf.append(text.substring(index + 1)); } // set display text component.setText(buf.toString()); // set mnemonic component.setMnemonic(mnemonic); component.setDisplayedMnemonicIndex(index); } else { // no mnemonic found - just set the text on the menu item component.setText(text); }
if ((index != -1) && ((index + 1) < text.length())) { // mnemonic found // ...and not at the end of the string (which doesn't make sence) char mnemonic = text.charAt(index + 1); StringBuffer buf = new StringBuffer(); // if mnemonic is first character of this string if (index == 0) { buf.append(text.substring(1)); } else { buf.append(text.substring(0, index)); buf.append(text.substring(index + 1)); } // set display text label.setText(buf.toString()); // set mnemonic label.setDisplayedMnemonic(mnemonic); label.setDisplayedMnemonicIndex(index); } else { // no mnemonic found - just set the text on the menu item label.setText(text); }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/base/MnemonicSetter.java File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/base/MnemonicSetter.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
if ((index != -1) && ((index + 1) < text.length())) {
1
if ((index != -1) && ((index + 1) < text.length())) {
2
			// mnemonic found
2
			// mnemonic found
3
			// ...and not at the end of the string (which doesn't make sence)
3
			// ...and not at the end of the string (which doesn't make sence)
4
			char mnemonic = text.charAt(index + 1);
4
			char mnemonic = text.charAt(index + 1);
5
			StringBuffer buf = new StringBuffer();
5
			StringBuffer buf = new StringBuffer();
6
			// if mnemonic is first character of this string
6
			// if mnemonic is first character of this string
7
			if (index == 0) {
7
			if (index == 0) {
8
				buf.append(text.substring(1));
8
				buf.append(text.substring(1));
9
			} else {
9
			} else {
10
				buf.append(text.substring(0, index));
10
				buf.append(text.substring(0, index));
11
				buf.append(text.substring(index + 1));
11
				buf.append(text.substring(index + 1));
12
			}
12
			}
13
			// set display text
13
			// set display text
14
			component.setText(buf.toString());
14
			label.setText(buf.toString());
15
			// set mnemonic
15
			// set mnemonic
16
			component.setMnemonic(mnemonic);
16
			label.setDisplayedMnemonic(mnemonic);
17
			component.setDisplayedMnemonicIndex(index);
17
			label.setDisplayedMnemonicIndex(index);
18
		} else {
18
		} else {
19
			// no mnemonic found - just set the text on the menu item
19
			// no mnemonic found - just set the text on the menu item
20
			component.setText(text);
20
			label.setText(text);
21
		}
21
		}
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0