Previous CloneSet | Next CloneSet | Back to Main Report |
Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
---|---|---|---|---|
28 | 2 | 1 | 0.995 | class_body_declaration |
Clone Abstraction | Parameter Bindings |
Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
---|---|---|---|
1 | 28 | 83 | plugins/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/comment/CommentFormatterUtil.java |
2 | 28 | 363 | plugins/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/CodeFormatterUtil.java |
| ||||
/** * Returns a document with the given content and the given positions * registered with the {@link DefaultPositionUpdater}. * * @param content the content * @param positions the positions * @return the document * @throws IllegalArgumentException */ private static Document createDocument(String content, Position[] positions) throws IllegalArgumentException { Document doc = new Document(content); try { if (positions != null) { final String POS_CATEGORY = "myCategory"; //$NON-NLS-1$ doc.addPositionCategory(POS_CATEGORY); doc.addPositionUpdater(new DefaultPositionUpdater(POS_CATEGORY) { protected boolean notDeleted() { if (fOffset < fPosition.offset && (fPosition.offset + fPosition.length < fOffset + fLength)) { fPosition.offset = fOffset + fLength; // deleted positions: set to end of remove return false; } return true; } } ); for (int i = 0; i < positions.length; i++) { try { doc.addPosition(POS_CATEGORY, positions[i]); } catch (BadLocationException e) { throw new IllegalArgumentException("Position outside of string. offset: " + positions[i].offset + ", length: " + positions[i].length + ", string size: " + content.length()); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ } } } } catch (BadPositionCategoryException cannotHappen) { // can not happen: category is correctly set up } return doc; } |
| ||||
private static Document createDocument(String string, Position[] positions) throws IllegalArgumentException { Document doc = new Document(string); try { if (positions != null) { final String POS_CATEGORY = "myCategory"; //$NON-NLS-1$ doc.addPositionCategory(POS_CATEGORY); doc.addPositionUpdater(new DefaultPositionUpdater(POS_CATEGORY) { protected boolean notDeleted() { if (fOffset < fPosition.offset && (fPosition.offset + fPosition.length < fOffset + fLength)) { fPosition.offset = fOffset + fLength; // deleted positions: set to end of remove return false; } return true; } } ); for (int i = 0; i < positions.length; i++) { try { doc.addPosition(POS_CATEGORY, positions[i]); } catch (BadLocationException e) { throw new IllegalArgumentException("Position outside of string. offset: " + positions[i].offset + ", length: " + positions[i].length + ", string size: " + string.length()); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ } } } } catch (BadPositionCategoryException cannotHappen) { // can not happen: category is correctly set up } return doc; } |
| |||
/** * Returns a document with the given content and the given positions * registered with the {@link DefaultPositionUpdater}. * * @param content the content * @param positions the positions * @return the document * @throws IllegalArgumentException */ private static Document createDocument(String [[#variable52b08700]], Position[] positions) throws IllegalArgumentException { Document doc = new Document( [[#variable52b08700]]); try { if (positions != null) { final String POS_CATEGORY = "myCategory"; //$NON-NLS-1$ doc.addPositionCategory(POS_CATEGORY); doc.addPositionUpdater(new DefaultPositionUpdater(POS_CATEGORY) { protected boolean notDeleted() { if (fOffset < fPosition.offset && (fPosition.offset + fPosition.length < fOffset + fLength)) { fPosition.offset = fOffset + fLength; // deleted positions: set to end of remove return false; } return true; } } ); for (int i = 0; i < positions.length; i++) { try { doc.addPosition(POS_CATEGORY, positions[i]); } catch (BadLocationException e) { throw new IllegalArgumentException("Position outside of string. offset: " + positions[i].offset + ", length: " + positions[i].length + ", string size: " + [[#variable52b08700]].length()); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ } } } } catch (BadPositionCategoryException cannotHappen) { // can not happen: category is correctly set up } return doc; } |
CloneAbstraction |
Parameter Index | Clone Instance | Parameter Name | Value |
---|---|---|---|
1 | 1 | [[#52b08700]] | string |
1 | 2 | [[#52b08700]] | content |