Address Integer().toString() and Double().toString() warnings.

This commit is contained in:
Neil 2020-03-16 15:24:50 -07:00 committed by Daniel Williams
parent 65a4698d37
commit 0f01a9c437

View File

@ -7,18 +7,18 @@ package de.congrace.exp4j;
* and vice-versa. * and vice-versa.
*/ */
public class Variable { public class Variable {
// The primary or preferred representation // The primary or preferred representation
public enum Primary {DOUBLE, ARRAY, PLACEHOLDER}; public enum Primary {DOUBLE, ARRAY, PLACEHOLDER};
private final Primary primary; private final Primary primary;
private final String name; private final String name;
private final double doubleValue; private final double doubleValue;
private final double[] arrayValue; private final double[] arrayValue;
private final double start, step; private final double start, step;
/* /*
* Initialize a new variable with a name only. This can be used as a place holder * Initialize a new variable with a name only. This can be used as a place holder
*/ */
@ -30,7 +30,7 @@ public class Variable {
this.start = Double.NaN; this.start = Double.NaN;
this.step = Double.NaN; this.step = Double.NaN;
} }
/* /*
* Initialize a new double variable * Initialize a new double variable
*/ */
@ -42,7 +42,7 @@ public class Variable {
this.start = Double.NaN; this.start = Double.NaN;
this.step = Double.NaN; this.step = Double.NaN;
} }
/* /*
* Initialize a new array variable * Initialize a new array variable
*/ */
@ -54,7 +54,7 @@ public class Variable {
this.start = Double.NaN; this.start = Double.NaN;
this.step = Double.NaN; this.step = Double.NaN;
} }
/* /*
* Initialize a new array variable, specifying the start and step values * Initialize a new array variable, specifying the start and step values
*/ */
@ -66,35 +66,35 @@ public class Variable {
this.start = start; this.start = start;
this.step = step; this.step = step;
} }
public String getName(){ public String getName(){
return name; return name;
} }
public Primary getPrimary(){ public Primary getPrimary(){
return this.primary; return this.primary;
} }
public double getDoubleValue(){ public double getDoubleValue(){
return doubleValue; return doubleValue;
} }
public double[] getArrayValue(){ public double[] getArrayValue(){
return arrayValue; return arrayValue;
} }
public double getStep(){ public double getStep(){
return step; return step;
} }
public double getStart(){ public double getStart(){
return start; return start;
} }
@Override @Override
public String toString(){ public String toString(){
if ( arrayValue.length > 1 ){ if ( arrayValue.length > 1 ){
String out = name + " is Array (length " + new Integer(arrayValue.length).toString() + ") : {"; String out = name + " is Array (length " + arrayValue.length + ") : {";
for (double x : arrayValue){ for (double x : arrayValue){
out = out + x + ","; out = out + x + ",";
} }
@ -102,7 +102,7 @@ public class Variable {
return out + "}"; return out + "}";
} }
else{ else{
return name + " is double : {" + new Double(doubleValue).toString() + "}"; return name + " is double : {" + doubleValue + "}";
} }
} }
} }