CloneSet661


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
28210.995class_body_declaration
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
12883
plugins/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/comment/CommentFormatterUtil.java
228363
plugins/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/CodeFormatterUtil.java
Clone Instance
1
Line Count
28
Source Line
83
Source File
plugins/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/comment/CommentFormatterUtil.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;
        }


Clone Instance
2
Line Count
28
Source Line
363
Source File
plugins/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/CodeFormatterUtil.java

        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;
        }


Clone AbstractionParameter Count: 1Parameter Bindings

/**
         * 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 Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#52b08700]]
string 
12[[#52b08700]]
content