Skip to content

Commit

Permalink
some tweaks related to java 16 stuff
Browse files Browse the repository at this point in the history
this is some prep for assisting with 1.17 update.
  • Loading branch information
Thutmose committed Jul 30, 2021
1 parent 485b9d0 commit 631c901
Show file tree
Hide file tree
Showing 45 changed files with 66 additions and 69 deletions.
6 changes: 3 additions & 3 deletions src/main/java/org/nfunk/jep/JEP.java
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ public void addFunction(String functionName, PostfixMathCommandI function)
public void addStandardConstants()
{
// add constants to Symbol Table
this.symTab.addConstant("pi", new Double(Math.PI));
this.symTab.addConstant("e", new Double(Math.E));
this.symTab.addConstant("pi", Double.valueOf(Math.PI));
this.symTab.addConstant("e", Double.valueOf(Math.E));
}

/**
Expand Down Expand Up @@ -306,7 +306,7 @@ public void addStandardFunctions()
*/
public Double addVariable(String name, double value)
{
final Double object = new Double(value);
final Double object = Double.valueOf(value);
this.symTab.makeVarIfNeeded(name, object);
return object;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/nfunk/jep/JJTParserState.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ boolean nodeCreated()

void openNodeScope(Node n)
{
this.marks.push(new Integer(this.mk));
this.marks.push(Integer.valueOf(this.mk));
this.mk = this.sp;
n.jjtOpen();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/nfunk/jep/Variable.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class Variable extends Observable
private Object value;
private boolean isConstant = false;
private boolean validValue = false;
// private static final Double ZERO = new Double(0.0);
// private static final Double ZERO = Double.valueOf(0.0);

/**
* Constructors are protected. Variables should only
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/nfunk/jep/function/Abs.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public Abs()

public Object abs(Object param) throws ParseException
{
if (param instanceof Complex) return new Double(((Complex) param).abs());
else if (param instanceof Number) return new Double(Math.abs(((Number) param).doubleValue()));
if (param instanceof Complex) return Double.valueOf(((Complex) param).abs());
else if (param instanceof Number) return Double.valueOf(Math.abs(((Number) param).doubleValue()));

throw new ParseException("Invalid parameter type");
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/nfunk/jep/function/Add.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public Complex add(Complex c, Number d)

public Double add(Number d1, Number d2)
{
return new Double(d1.doubleValue() + d2.doubleValue());
return Double.valueOf(d1.doubleValue() + d2.doubleValue());
}

public Object add(Object param1, Object param2) throws ParseException
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/nfunk/jep/function/ArcCosine.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public ArcCosine()
public Object acos(Object param) throws ParseException
{
if (param instanceof Complex) return ((Complex) param).acos();
else if (param instanceof Number) return new Double(Math.acos(((Number) param).doubleValue()));
else if (param instanceof Number) return Double.valueOf(Math.acos(((Number) param).doubleValue()));

throw new ParseException("Invalid parameter type");
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/nfunk/jep/function/ArcCosineH.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ else if (param instanceof Number)
if (val >= 1.0)
{
final double res = Math.log(val + Math.sqrt(val * val - 1));
return new Double(res);
return Double.valueOf(res);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/nfunk/jep/function/ArcSine.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public ArcSine()
public Object asin(Object param) throws ParseException
{
if (param instanceof Complex) return ((Complex) param).asin();
else if (param instanceof Number) return new Double(Math.asin(((Number) param).doubleValue()));
else if (param instanceof Number) return Double.valueOf(Math.asin(((Number) param).doubleValue()));

throw new ParseException("Invalid parameter type");
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/nfunk/jep/function/ArcSineH.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ else if (param instanceof Number)
{
final double val = ((Number) param).doubleValue();
final double res = Math.log(val + Math.sqrt(val * val + 1));
return new Double(res);
return Double.valueOf(res);
// Complex temp = new Complex(((Number)param).doubleValue(),0.0);
// return temp.asinh();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/nfunk/jep/function/ArcTanH.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ else if (param instanceof Number)
if (val > -1.0 && val < 1)
{
final double res = Math.log((1 + val) / (1 - val)) / 2;
return new Double(res);
return Double.valueOf(res);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/nfunk/jep/function/ArcTangent.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public ArcTangent()
public Object atan(Object param) throws ParseException
{
if (param instanceof Complex) return ((Complex) param).atan();
else if (param instanceof Number) return new Double(Math.atan(((Number) param).doubleValue()));
else if (param instanceof Number) return Double.valueOf(Math.atan(((Number) param).doubleValue()));

throw new ParseException("Invalid parameter type");
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/nfunk/jep/function/ArcTangent2.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void run(Stack inStack) throws ParseException
{
final double y = ((Number) param1).doubleValue();
final double x = ((Number) param2).doubleValue();
inStack.push(new Double(Math.atan2(y, x)));// push the result on the
inStack.push(Double.valueOf(Math.atan2(y, x)));// push the result on the
// inStack
}
else throw new ParseException("Invalid parameter type");
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/nfunk/jep/function/Arg.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
@SuppressWarnings({ "rawtypes", "unchecked" })
public class Arg extends PostfixMathCommand
{
private static final Double ONE = new Double(1.0);
private static final Double ONE = Double.valueOf(1.0);

public Arg()
{
Expand All @@ -29,7 +29,7 @@ public Arg()

public Number arg(Object param) throws ParseException
{
if (param instanceof Complex) return new Double(((Complex) param).arg());
if (param instanceof Complex) return Double.valueOf(((Complex) param).arg());
else if (param instanceof Number) return Arg.ONE;
throw new ParseException("Invalid parameter type");
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/nfunk/jep/function/Ceil.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public Ceil()

public Object abs(Object param) throws ParseException
{
if (param instanceof Complex) return Math.ceil(new Double(((Complex) param).abs()));
else if (param instanceof Number) return Math.ceil(new Double(Math.abs(((Number) param).doubleValue())));
if (param instanceof Complex) return Math.ceil(Double.valueOf(((Complex) param).abs()));
else if (param instanceof Number) return Math.ceil(Double.valueOf(Math.abs(((Number) param).doubleValue())));

throw new ParseException("Invalid parameter type");
}
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/org/nfunk/jep/function/Comparative.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
* @since 2.3.0 beta 2 changed the internal lt,gt,le,ge,ne and eq method to
* return boolean.
* If this breaks anything use
* if(lt(obj1,obj2)) inStack.push(new Double(1));
* else inStack.push(new Double(0));
* if(lt(obj1,obj2)) inStack.push(Double.valueOf(1));
* else inStack.push(Double.valueOf(0));
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public class Comparative extends PostfixMathCommand
Expand Down Expand Up @@ -80,7 +80,7 @@ public boolean ge(Object param1, Object param2) throws ParseException
* double x = ((Number)param1).doubleValue();
* double y = ((Number)param2).doubleValue();
* int r = (x>=y) ? 1 : 0;
* return new Double(r);
* return Double.valueOf(r);
* }
* throw new
* ParseException(">= not defined for object of type "+param1.getClass().
Expand All @@ -99,7 +99,7 @@ public boolean ge(Object param1, Object param2) throws ParseException
* default:
* throw new ParseException("Relational operator type error");
* }
* inStack.push(new Double(r));//push the result on the inStack
* inStack.push(Double.valueOf(r));//push the result on the inStack
* }
* else if ((param1 instanceof Number) && (param2 instanceof Number))
* {
Expand Down Expand Up @@ -129,7 +129,7 @@ public boolean ge(Object param1, Object param2) throws ParseException
* default:
* throw new ParseException("Unknown relational operator");
* }
* inStack.push(new Double(r));//push the result on the inStack
* inStack.push(Double.valueOf(r));//push the result on the inStack
* }
* else if ((param1 instanceof String) && (param2 instanceof String))
* {
Expand All @@ -145,7 +145,7 @@ public boolean ge(Object param1, Object param2) throws ParseException
* default:
* throw new ParseException("Relational operator type error");
* }
* inStack.push(new Double(r));//push the result on the inStack
* inStack.push(Double.valueOf(r));//push the result on the inStack
* } else
* {
* throw new ParseException("Invalid parameter type");
Expand Down Expand Up @@ -243,8 +243,8 @@ public void run(Stack inStack) throws ParseException
res = this.eq(param1, param2);
break;
}
if (res) inStack.push(new Double(1));
else inStack.push(new Double(0));
if (res) inStack.push(Double.valueOf(1));
else inStack.push(Double.valueOf(0));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/nfunk/jep/function/Cosine.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public Cosine()
public Object cos(Object param) throws ParseException
{
if (param instanceof Complex) return ((Complex) param).cos();
else if (param instanceof Number) return new Double(Math.cos(((Number) param).doubleValue()));
else if (param instanceof Number) return Double.valueOf(Math.cos(((Number) param).doubleValue()));

throw new ParseException("Invalid parameter type");
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/nfunk/jep/function/CosineH.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public Object cosh(Object param) throws ParseException
else if (param instanceof Number)
{
final double value = ((Number) param).doubleValue();
return new Double((Math.exp(value) + Math.exp(-value)) / 2);
return Double.valueOf((Math.exp(value) + Math.exp(-value)) / 2);
}

throw new ParseException("Invalid parameter type");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/nfunk/jep/function/Divide.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public Complex div(Number d, Complex c)

public Double div(Number d1, Number d2)
{
return new Double(d1.doubleValue() / d2.doubleValue());
return Double.valueOf(d1.doubleValue() / d2.doubleValue());
}

public Vector div(Number d, Vector v)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/nfunk/jep/function/Exp.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public Object exp(Object param) throws ParseException
final double mod = Math.exp(x);
return new Complex(mod * Math.cos(y), mod * Math.sin(y));
}
else if (param instanceof Number) return new Double(Math.exp(((Number) param).doubleValue()));
else if (param instanceof Number) return Double.valueOf(Math.exp(((Number) param).doubleValue()));

throw new ParseException("Invalid parameter type");
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/nfunk/jep/function/Floor.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public Floor()

public Object abs(Object param) throws ParseException
{
if (param instanceof Complex) return Math.floor(new Double(((Complex) param).abs()));
else if (param instanceof Number) return Math.floor(new Double(Math.abs(((Number) param).doubleValue())));
if (param instanceof Complex) return Math.floor(Double.valueOf(((Complex) param).abs()));
else if (param instanceof Number) return Math.floor(Double.valueOf(Math.abs(((Number) param).doubleValue())));

throw new ParseException("Invalid parameter type");
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/nfunk/jep/function/Guassian.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public Guassian()
public void run(Stack inStack) throws ParseException
{
this.checkStack(inStack);// check the stack
inStack.push(new Double(this.rand.nextGaussian()));
inStack.push(Double.valueOf(this.rand.nextGaussian()));
return;
}
}
4 changes: 2 additions & 2 deletions src/main/java/org/nfunk/jep/function/Imaginary.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public Imaginary()
public Number im(Object param) throws ParseException
{

if (param instanceof Complex) return new Double(((Complex) param).im());
else if (param instanceof Number) return new Double(0);
if (param instanceof Complex) return Double.valueOf(((Complex) param).im());
else if (param instanceof Number) return Double.valueOf(0);

throw new ParseException("Invalid parameter type");
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/nfunk/jep/function/Logarithm.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public Object log(Object param) throws ParseException
else if (param instanceof Number)
{
final double num = ((Number) param).doubleValue();
if (num > 0) return new Double(Math.log(num) / Logarithm.LOG10);
if (num > 0) return Double.valueOf(Math.log(num) / Logarithm.LOG10);
else
{
final Complex temp = new Complex(num);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/nfunk/jep/function/Logical.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void run(Stack inStack) throws ParseException
r = 0;
}

inStack.push(new Double(r)); // push the result on the inStack
inStack.push(Double.valueOf(r)); // push the result on the inStack
}
else throw new ParseException("Invalid parameter type");
return;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/nfunk/jep/function/Modulus.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void run(Stack inStack) throws ParseException

final double result = dividend % divisor;

inStack.push(new Double(result));
inStack.push(Double.valueOf(result));
}
else throw new ParseException("Invalid parameter type");
return;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/nfunk/jep/function/Multiply.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public Complex mul(Complex c, Number d)

public Double mul(Number d1, Number d2)
{
return new Double(d1.doubleValue() * d2.doubleValue());
return Double.valueOf(d1.doubleValue() * d2.doubleValue());
}

public Object mul(Object param1, Object param2) throws ParseException
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/nfunk/jep/function/NaturalLogarithm.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ else if (param instanceof Number)
{
// Now returns Complex if param is <0
final double num = ((Number) param).doubleValue();
if (num > 0) return new Double(Math.log(num));
if (num > 0) return Double.valueOf(Math.log(num));
else
{
final Complex temp = new Complex(num);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/nfunk/jep/function/Not.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void run(Stack inStack) throws ParseException
if (param instanceof Number)
{
final int r = ((Number) param).doubleValue() == 0 ? 1 : 0;
inStack.push(new Double(r));// push the result on the inStack
inStack.push(Double.valueOf(r));// push the result on the inStack
}
else throw new ParseException("Invalid parameter type");
return;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/nfunk/jep/function/Power.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ public Object power(Complex c1, Complex c2)
{
final Complex temp = c1.power(c2);

if (temp.im() == 0) return new Double(temp.re());
if (temp.im() == 0) return Double.valueOf(temp.re());
else return temp;
}

public Object power(Complex c, Number d)
{
final Complex temp = c.power(d.doubleValue());

if (temp.im() == 0) return new Double(temp.re());
if (temp.im() == 0) return Double.valueOf(temp.re());
else return temp;
}

Expand All @@ -40,7 +40,7 @@ public Object power(Number d, Complex c)
final Complex base = new Complex(d.doubleValue(), 0.0);
final Complex temp = base.power(c);

if (temp.im() == 0) return new Double(temp.re());
if (temp.im() == 0) return Double.valueOf(temp.re());
else return temp;
}

Expand All @@ -51,7 +51,7 @@ public Object power(Number d1, Number d2)
final Complex c = new Complex(d1.doubleValue(), 0.0);
return c.power(d2.doubleValue());
}
else return new Double(Math.pow(d1.doubleValue(), d2.doubleValue()));
else return Double.valueOf(Math.pow(d1.doubleValue(), d2.doubleValue()));
}

public Object power(Object param1, Object param2) throws ParseException
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/nfunk/jep/function/Random.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public Random()
public void run(Stack inStack) throws ParseException
{
this.checkStack(inStack);// check the stack
inStack.push(new Double(Math.random()));
inStack.push(Double.valueOf(Math.random()));
return;
}
}
2 changes: 1 addition & 1 deletion src/main/java/org/nfunk/jep/function/Real.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public Real()

public Number re(Object param) throws ParseException
{
if (param instanceof Complex) return new Double(((Complex) param).re());
if (param instanceof Complex) return Double.valueOf(((Complex) param).re());
else if (param instanceof Number) return (Number) param;

throw new ParseException("Invalid parameter type");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/nfunk/jep/function/Sine.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void run(Stack inStack) throws ParseException
public Object sin(Object param) throws ParseException
{
if (param instanceof Complex) return ((Complex) param).sin();
else if (param instanceof Number) return new Double(Math.sin(((Number) param).doubleValue()));
else if (param instanceof Number) return Double.valueOf(Math.sin(((Number) param).doubleValue()));

throw new ParseException("Invalid parameter type");
}
Expand Down
Loading

0 comments on commit 631c901

Please sign in to comment.