Previous CloneSet | Next CloneSet | Back to Main Report |
Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
---|---|---|---|---|
98 | 2 | 1 | 0.999 | class_body_declarations[6] |
Clone Abstraction | Parameter Bindings |
Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
---|---|---|---|
1 | 98 | 446 | plugins/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/Scribe.java |
2 | 98 | 405 | plugins/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/Scribe2.java |
| ||||
Alignment getMemberAlignment() { return this.memberAlignment; } public String getNewLine() { if (this.nlsTagCounter > 0) { return EMPTY_STRING; } if (lastNumberOfNewLines >= 1) { column = 1; // ensure that the scribe is at the beginning of a new line return EMPTY_STRING; } line++; lastNumberOfNewLines = 1; column = 1; needSpace = false; this.pendingSpace = false; return this.lineSeparator; } /** * Answer next indentation level based on column estimated position * (if column is not indented, then use indentationLevel) */ public int getNextIndentationLevel(int someColumn) { int indent = someColumn - 1; if (indent == 0) return this.indentationLevel; if (this.tabChar == DefaultCodeFormatterOptions.TAB) { if (this.useTabsOnlyForLeadingIndents) { return indent; } int rem = indent % this.indentationSize; int addition = rem == 0 ? 0: this.indentationSize - rem; // round to superior return indent + addition; } else { return indent; } } private String getPreserveEmptyLines(int count) { if (count > 0) { if (this.formatter.preferences.number_of_empty_lines_to_preserve != 0) { int linesToPreserve = Math.min(count, this.formatter.preferences.number_of_empty_lines_to_preserve); return this.getEmptyLines(linesToPreserve); } else { return getNewLine(); } } return EMPTY_STRING; } public TextEdit getRootEdit() { MultiTextEdit edit = null; int length = this.textRegionEnd - this.textRegionStart + 1; if (this.textRegionStart <= 0) { if (length <= 0) { edit = new MultiTextEdit(0, 0); } else { edit = new MultiTextEdit(0, this.textRegionEnd + 1); } } else { edit = new MultiTextEdit(this.textRegionStart, this.textRegionEnd - this.textRegionStart + 1); } for (int i = 0,max = this.editsIndex; i < max; i++) { OptimizedReplaceEdit currentEdit = edits[i]; if (isValidEdit(currentEdit)) { edit.addChild(new ReplaceEdit(currentEdit.offset, currentEdit.length, currentEdit.replacement)); } } this.edits = null; return edit; } public void handleLineTooLong() { // search for closest breakable alignment, using tiebreak rules // look for outermost breakable one int relativeDepth = 0, outerMostDepth = -1; Alignment targetAlignment = this.currentAlignment; while (targetAlignment != null) { if (targetAlignment.tieBreakRule == Alignment.R_OUTERMOST && targetAlignment.couldBreak()) { outerMostDepth = relativeDepth; } targetAlignment = targetAlignment.enclosing; relativeDepth++; } if (outerMostDepth >= 0) { throw new AlignmentException(AlignmentException.LINE_TOO_LONG, outerMostDepth); } // look for innermost breakable one relativeDepth = 0; targetAlignment = this.currentAlignment; while (targetAlignment != null) { if (targetAlignment.couldBreak()) { throw new AlignmentException(AlignmentException.LINE_TOO_LONG, relativeDepth); } targetAlignment = targetAlignment.enclosing; relativeDepth++; } // did not find any breakable location - proceed } |
| ||||
Alignment2 getMemberAlignment() { return this.memberAlignment; } public String getNewLine() { if (this.nlsTagCounter > 0) { return EMPTY_STRING; } if (lastNumberOfNewLines >= 1) { column = 1; // ensure that the scribe is at the beginning of a new line return EMPTY_STRING; } line++; lastNumberOfNewLines = 1; column = 1; needSpace = false; this.pendingSpace = false; return this.lineSeparator; } /** * Answer next indentation level based on column estimated position * (if column is not indented, then use indentationLevel) */ public int getNextIndentationLevel(int someColumn) { int indent = someColumn - 1; if (indent == 0) return this.indentationLevel; if (this.tabChar == DefaultCodeFormatterOptions.TAB) { if (this.useTabsOnlyForLeadingIndents) { return indent; } int rem = indent % this.indentationSize; int addition = rem == 0 ? 0: this.indentationSize - rem; // round to superior return indent + addition; } else { return indent; } } private String getPreserveEmptyLines(int count) { if (count > 0) { if (this.formatter.preferences.number_of_empty_lines_to_preserve != 0) { int linesToPreserve = Math.min(count, this.formatter.preferences.number_of_empty_lines_to_preserve); return this.getEmptyLines(linesToPreserve); } else { return getNewLine(); } } return EMPTY_STRING; } public TextEdit getRootEdit() { MultiTextEdit edit = null; int length = this.textRegionEnd - this.textRegionStart + 1; if (this.textRegionStart <= 0) { if (length <= 0) { edit = new MultiTextEdit(0, 0); } else { edit = new MultiTextEdit(0, this.textRegionEnd + 1); } } else { edit = new MultiTextEdit(this.textRegionStart, this.textRegionEnd - this.textRegionStart + 1); } for (int i = 0,max = this.editsIndex; i < max; i++) { OptimizedReplaceEdit currentEdit = edits[i]; if (isValidEdit(currentEdit)) { edit.addChild(new ReplaceEdit(currentEdit.offset, currentEdit.length, currentEdit.replacement)); } } this.edits = null; return edit; } public void handleLineTooLong() { // search for closest breakable alignment, using tiebreak rules // look for outermost breakable one int relativeDepth = 0, outerMostDepth = -1; Alignment2 targetAlignment = this.currentAlignment; while (targetAlignment != null) { if (targetAlignment.tieBreakRule == Alignment.R_OUTERMOST && targetAlignment.couldBreak()) { outerMostDepth = relativeDepth; } targetAlignment = targetAlignment.enclosing; relativeDepth++; } if (outerMostDepth >= 0) { throw new AlignmentException(AlignmentException.LINE_TOO_LONG, outerMostDepth); } // look for innermost breakable one relativeDepth = 0; targetAlignment = this.currentAlignment; while (targetAlignment != null) { if (targetAlignment.couldBreak()) { throw new AlignmentException(AlignmentException.LINE_TOO_LONG, relativeDepth); } targetAlignment = targetAlignment.enclosing; relativeDepth++; } // did not find any breakable location - proceed } |
| |||
[[#variableb8c62ce0]] getMemberAlignment() { return this.memberAlignment; } public String getNewLine() { if (this.nlsTagCounter > 0) { return EMPTY_STRING; } if (lastNumberOfNewLines >= 1) { column = 1; // ensure that the scribe is at the beginning of a new line return EMPTY_STRING; } line++; lastNumberOfNewLines = 1; column = 1; needSpace = false; this.pendingSpace = false; return this.lineSeparator; } /** * Answer next indentation level based on column estimated position * (if column is not indented, then use indentationLevel) */ public int getNextIndentationLevel(int someColumn) { int indent = someColumn - 1; if (indent == 0) return this.indentationLevel; if (this.tabChar == DefaultCodeFormatterOptions.TAB) { if (this.useTabsOnlyForLeadingIndents) { return indent; } int rem = indent % this.indentationSize; int addition = rem == 0 ? 0: this.indentationSize - rem; // round to superior return indent + addition; } else { return indent; } } private String getPreserveEmptyLines(int count) { if (count > 0) { if (this.formatter.preferences.number_of_empty_lines_to_preserve != 0) { int linesToPreserve = Math.min(count, this.formatter.preferences.number_of_empty_lines_to_preserve); return this.getEmptyLines(linesToPreserve); } else { return getNewLine(); } } return EMPTY_STRING; } public TextEdit getRootEdit() { MultiTextEdit edit = null; int length = this.textRegionEnd - this.textRegionStart + 1; if (this.textRegionStart <= 0) { if (length <= 0) { edit = new MultiTextEdit(0, 0); } else { edit = new MultiTextEdit(0, this.textRegionEnd + 1); } } else { edit = new MultiTextEdit(this.textRegionStart, this.textRegionEnd - this.textRegionStart + 1); } for (int i = 0, max = this.editsIndex; i < max; i++) { OptimizedReplaceEdit currentEdit = edits[i]; if (isValidEdit(currentEdit)) { edit.addChild(new ReplaceEdit(currentEdit.offset, currentEdit.length, currentEdit.replacement)); } } this.edits = null; return edit; } public void handleLineTooLong() { // search for closest breakable alignment, using tiebreak rules // look for outermost breakable one int relativeDepth = 0, outerMostDepth = -1; [[#variableb8c62ce0]] targetAlignment = this.currentAlignment; while (targetAlignment != null) { if (targetAlignment.tieBreakRule == Alignment.R_OUTERMOST && targetAlignment.couldBreak()) { outerMostDepth = relativeDepth; } targetAlignment = targetAlignment.enclosing; relativeDepth++; } if (outerMostDepth >= 0) { throw new AlignmentException(AlignmentException.LINE_TOO_LONG, outerMostDepth); } // look for innermost breakable one relativeDepth = 0; targetAlignment = this.currentAlignment; while (targetAlignment != null) { if (targetAlignment.couldBreak()) { throw new AlignmentException(AlignmentException.LINE_TOO_LONG, relativeDepth); } targetAlignment = targetAlignment.enclosing; relativeDepth++; } // did not find any breakable location - proceed } |
CloneAbstraction |
Parameter Index | Clone Instance | Parameter Name | Value |
---|---|---|---|
1 | 1 | [[#b8c62ce0]] | Alignment2 |
1 | 2 | [[#b8c62ce0]] | Alignment |