CloneSet412


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
42220.995class_body_declarations[2]
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
14269
plugins/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/comment/HTMLEntity2JavaReader.java
239284
plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/HTML2TextReader.java
Clone Instance
1
Line Count
42
Source Line
69
Source File
plugins/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/comment/HTMLEntity2JavaReader.java

        /**
         * Replaces an HTML entity body (without & and ;) with its
         * plain/text (or plain/java) counterpart.
         * 
         * @param symbol the entity body to resolve
         * @return the plain/text counterpart of <code>symbol</code>
         */
        protected String entity2Text(String symbol) {
                if (symbol.length() > 1 && symbol.charAt(0) == '#') {
                        int ch;
                        try {
                                if (symbol.charAt(1) == 'x') {
                                        ch = Integer.parseInt(symbol.substring(2), 16);
                                }
                                else   {
                                        ch = Integer.parseInt(symbol.substring(1), 10);
                                }
                                return " " + (char) ch; //$NON-NLS-1$
                        } catch (NumberFormatException e) {
                                // ignore
                          }
                }
                else   {
                        String str = (String) fgEntityLookup.get(symbol);
                        if (str != null) {
                                return str;
                        }
                }
                return "&" + symbol; // not found //$NON-NLS-1$
        }

        /**
         * Reads an HTML entity from the stream and returns its plain/text
         * counterpart.
         * 
         * @return an entity read from the stream, or the stream content.
         * @throws IOException if the underlying reader throws one
         */
        private String processEntity() throws IOException {
                StringBuffer buf = new StringBuffer();
                int ch = nextChar();
                while (ScannerHelper.isLetterOrDigit((char) ch) || ch == '#') {
                        buf.append((char) ch);
                        ch = nextChar();
                }
                if (ch == ';')
                        return entity2Text(buf.toString());
                buf.insert(0, '&');
                if (ch != -1)
                        buf.append((char) ch);
                return buf.toString();
        }


Clone Instance
2
Line Count
39
Source Line
284
Source File
plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/HTML2TextReader.java

        protected String entity2Text(String symbol) {
                if (symbol.length() > 1 && symbol.charAt(0) == '#') {
                        int ch;
                        try {
                                if (symbol.charAt(1) == 'x') {
                                        ch = Integer.parseInt(symbol.substring(2), 16);
                                }
                                else   {
                                        ch = Integer.parseInt(symbol.substring(1), 10);
                                }
                                return EMPTY_STRING + (char) ch;
                        } catch (NumberFormatException e) {
                          }
                }
                else   {
                        String str = (String) fgEntityLookup.get(symbol);
                        if (str != null) {
                                return str;
                        }
                }
                return "&" + symbol; // not found //$NON-NLS-1$
        }

        /*
         * A '&' has been read. Process a entity
         */
        private String processEntity() throws IOException {
                StringBuffer buf = new StringBuffer();
                int ch = nextChar();
                while (Character.isLetterOrDigit((char) ch) || ch == '#') {
                        buf.append((char) ch);
                        ch = nextChar();
                }

                if (ch == ';')
                        return entity2Text(buf.toString());

                buf.insert(0, '&');
                if (ch != -1)
                        buf.append((char) ch);
                return buf.toString();
        }


Clone AbstractionParameter Count: 2Parameter Bindings

/**
         * Replaces an HTML entity body (without &amp; and ;) with its
         * plain/text (or plain/java) counterpart.
         * 
         * @param symbol the entity body to resolve
         * @return the plain/text counterpart of <code>symbol</code>
         */
protected String entity2Text(String symbol) {
  if (symbol.length() > 1 && symbol.charAt(0) == '#') {
    int ch;
    try {
      if (symbol.charAt(1) == 'x') {
        ch = Integer.parseInt(symbol.substring(2), 16);
      }
      else {
        ch = Integer.parseInt(symbol.substring(1), 10);
      }
      return [[#variableb4961040]] + (char) ch; //$NON-NLS-1$
    }
    catch (NumberFormatException e) {
    // ignore
    }
  }
  else {
    String str = (String) fgEntityLookup.get(symbol);
    if (str != null) {
      return str;
    }
  }
  return "&" + symbol; // not found //$NON-NLS-1$
}

/**
         * Reads an HTML entity from the stream and returns its plain/text
         * counterpart.
         * 
         * @return an entity read from the stream, or the stream content.
         * @throws IOException if the underlying reader throws one
         */
/*
         * A '&' has been read. Process a entity
         */
private String processEntity() throws IOException {
  StringBuffer buf = new StringBuffer();
  int ch = nextChar();
  while ( [[#variableb49610a0]].isLetterOrDigit((char) ch) || ch == '#') {
    buf.append((char) ch);
    ch = nextChar();
  }
  if (ch == ';')
    return entity2Text(buf.toString());
  buf.insert(0, '&');
  if (ch != -1)
    buf.append((char) ch);
  return buf.toString();
}
 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#b4961040]]
" " 
12[[#b4961040]]
EMPTY_STRING 
21[[#b49610a0]]
ScannerHelper 
22[[#b49610a0]]
Character