Previous CloneSet | Next CloneSet | Back to Main Report |
Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
---|---|---|---|---|
84 | 2 | 6 | 0.983 | class_body_declarations[3] |
Clone Abstraction | Parameter Bindings |
Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
---|---|---|---|
1 | 84 | 21 | plugins/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoubleLiteral.java |
2 | 84 | 23 | plugins/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FloatLiteral.java |
| ||||
public DoubleLiteral(char[] token, int s, int e) { super(token, s, e); } public void computeConstant() { Double computedValue; try { computedValue = Double.valueOf(String.valueOf(source)); } catch (NumberFormatException e) { // hex floating point literal // being rejected by 1.4 libraries where Double.valueOf(...) doesn't handle hex decimal floats try { double v = FloatUtil.valueOfHexDoubleLiteral(source); if (v == Double.POSITIVE_INFINITY) { // error: the number is too large to represent return; } if (Double.isNaN(v)) { // error: the number is too small to represent return; } value = v; constant = DoubleConstant.fromValue(v); } catch (NumberFormatException e1) { // if the computation of the constant fails } return; } final double doubleValue = computedValue.doubleValue(); if (doubleValue > Double.MAX_VALUE) { // error: the number is too large to represent return; } if (doubleValue < Double.MIN_VALUE) { // see 1F6IGUU // a true 0 only has '0' and '.' in mantissa // 1.0e-5000d is non-zero, but underflows to 0 boolean isHexaDecimal = false; label: for (int i = 0; i < source.length; i++) { //it is welled formated so just test against '0' and potential . D d switch (source[i]) { case '0': case '.': break; case 'x': case 'X': isHexaDecimal = true; break; case 'e': case 'E': case 'f': case 'F': case 'd': case 'D': if (isHexaDecimal) { return; } // starting the exponent - mantissa is all zero // no exponent - mantissa is all zero break label; case 'p': case 'P': break label; default: // error: the number is too small to represent return; } } } value = doubleValue; constant = DoubleConstant.fromValue(value); } /** * Code generation for the double literak * * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream * @param valueRequired boolean */ public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) { int pc = codeStream.position; if (valueRequired) { codeStream.generateConstant(constant, implicitConversion); } codeStream.recordPositionsFrom(pc, this.sourceStart); } |
| ||||
public FloatLiteral(char[] token, int s, int e) { super(token, s, e); } public void computeConstant() { Float computedValue; try { computedValue = Float.valueOf(String.valueOf(source)); } catch (NumberFormatException e) { // hex floating point literal // being rejected by 1.4 libraries where Float.valueOf(...) doesn't handle hex decimal floats try { float v = FloatUtil.valueOfHexFloatLiteral(source); if (v == Float.POSITIVE_INFINITY) { // error: the number is too large to represent return; } if (Float.isNaN(v)) { // error: the number is too small to represent return; } value = v; constant = FloatConstant.fromValue(v); } catch (NumberFormatException e1) { // if the computation of the constant fails } return; } final float floatValue = computedValue.floatValue(); if (floatValue > Float.MAX_VALUE) { // error: the number is too large to represent return; } if (floatValue < Float.MIN_VALUE) { // see 1F6IGUU // a true 0 only has '0' and '.' in mantissa // 1.0e-5000d is non-zero, but underflows to 0 boolean isHexaDecimal = false; label: for (int i = 0; i < source.length; i++) { //it is welled formated so just test against '0' and potential . D d switch (source[i]) { case '0': case '.': break; case 'x': case 'X': isHexaDecimal = true; break; case 'e': case 'E': case 'f': case 'F': case 'd': case 'D': if (isHexaDecimal) { return; } // starting the exponent - mantissa is all zero // no exponent - mantissa is all zero break label; case 'p': case 'P': break label; default: // error: the number is too small to represent return; } } } value = floatValue; constant = FloatConstant.fromValue(value); } /** * Code generation for float literal * * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream * @param valueRequired boolean */ public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) { int pc = codeStream.position; if (valueRequired) { codeStream.generateConstant(constant, implicitConversion); } codeStream.recordPositionsFrom(pc, this.sourceStart); } |
| |||
public [[#variablebf96a660]](char[] token, int s, int e) { super(token, s, e); } public void computeConstant() { [[#variablebf96a5c0]] computedValue; try { computedValue = [[#variablebf96a5c0]].valueOf(String.valueOf(source)); } catch (NumberFormatException e) { // hex floating point literal // being rejected by 1.4 libraries where Double.valueOf(...) doesn't handle hex decimal floats // being rejected by 1.4 libraries where Float.valueOf(...) doesn't handle hex decimal floats try { [[#variablebf96a560]] v = FloatUtil. [[#variablebf96a460]](source); if (v == [[#variablebf96a5c0]].POSITIVE_INFINITY) { // error: the number is too large to represent return; } if ( [[#variablebf96a5c0]].isNaN(v)) { // error: the number is too small to represent return; } value = v; constant = [[#variablebf96a2e0]].fromValue(v); } catch (NumberFormatException e1) { // if the computation of the constant fails } return; } final [[#variablebf96a560]] [[#variablebf96a3e0]]= computedValue. [[#variablebf96a3e0]](); if ( [[#variablebf96a3e0]] > [[#variablebf96a5c0]].MAX_VALUE) { // error: the number is too large to represent return; } if ( [[#variablebf96a3e0]] < [[#variablebf96a5c0]].MIN_VALUE) { // see 1F6IGUU // a true 0 only has '0' and '.' in mantissa // 1.0e-5000d is non-zero, but underflows to 0 boolean isHexaDecimal = false; label: for (int i = 0; i < source.length; i++) { //it is welled formated so just test against '0' and potential . D d switch (source[i]) { case '0': case '.': break; case 'x': case 'X': isHexaDecimal = true; break; case 'e': case 'E': case 'f': case 'F': case 'd': case 'D': if (isHexaDecimal) { return; } // starting the exponent - mantissa is all zero // no exponent - mantissa is all zero break label; case 'p': case 'P': break label; default: // error: the number is too small to represent return; } } } value = [[#variablebf96a3e0]]; constant = [[#variablebf96a2e0]].fromValue(value); } /** * Code generation for the double literak * * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream * @param valueRequired boolean */ /** * Code generation for float literal * * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream * @param valueRequired boolean */ public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) { int pc = codeStream.position; if (valueRequired) { codeStream.generateConstant(constant, implicitConversion); } codeStream.recordPositionsFrom(pc, this.sourceStart); } |
CloneAbstraction |
Parameter Index | Clone Instance | Parameter Name | Value |
---|---|---|---|
1 | 1 | [[#bf96a660]] | DoubleLiteral |
1 | 2 | [[#bf96a660]] | FloatLiteral |
2 | 1 | [[#bf96a5c0]] | Double |
2 | 2 | [[#bf96a5c0]] | Float |
3 | 1 | [[#bf96a560]] | double |
3 | 2 | [[#bf96a560]] | float |
4 | 1 | [[#bf96a460]] | valueOfHexDoubleLiteral |
4 | 2 | [[#bf96a460]] | valueOfHexFloatLiteral |
5 | 1 | [[#bf96a2e0]] | DoubleConstant |
5 | 2 | [[#bf96a2e0]] | FloatConstant |
6 | 1 | [[#bf96a3e0]] | doubleValue |
6 | 2 | [[#bf96a3e0]] | floatValue |