| Previous CloneSet | Next CloneSet | Back to Main Report |
| Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
|---|---|---|---|---|
| 42 | 2 | 2 | 0.995 | class_body_declarations[2] |
| Clone Abstraction | Parameter Bindings |
| Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
|---|---|---|---|
| 1 | 42 | 69 | plugins/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/comment/HTMLEntity2JavaReader.java |
| 2 | 39 | 284 | plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/HTML2TextReader.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();
}
|
| ||||
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();
}
|
| |||
/**
* 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 [[#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 Index | Clone Instance | Parameter Name | Value |
|---|---|---|---|
| 1 | 1 | [[#b4961040]] | " " |
| 1 | 2 | [[#b4961040]] | EMPTY_STRING |
| 2 | 1 | [[#b49610a0]] | ScannerHelper |
| 2 | 2 | [[#b49610a0]] | Character |