Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>this test case should mimic your problem</p> <pre><code>package com.sg2net.test; public class TestCast { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub TestCast tc= new TestCast(); tc.funcEval(); } public double funcEval(){ return ((Long) eval()).doubleValue(); } private Object eval() { return new Long(1); } } </code></pre> <p>It runs without problems. Is the code you posted the code that gives you the exception?</p> <p>here is you code with the Long modification</p> <pre><code>import org.apache.commons.jexl2.*; public class NelderMead { // контсанты private static int M = 3; private static double E = 0.005; private static double A = 1.000; private static double B = 0.500; private static double Y = 2.000; // переменные private JexlEngine jexl; private Expression func; private String funcString = ""; private MapContext[] iterations; public NelderMead(){ this.jexl = new JexlEngine(); } public NelderMead(String funcString){ this.jexl = new JexlEngine(); this.setFunc(funcString); } public void setFunc(String funcString){ this.funcString = funcString; this.func = this.jexl.createExpression(funcString); } public double funcEval(MapContext args){ return ((Long) this.func.evaluate(args)).doubleValue(); } public boolean checkCriterian(){ return true; } } </code></pre> <p>It runs with no problems. The evaluate functions returns a Long which is an Object. The evaluate function can return any class since Object is the root class in Java.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload