/** NOTE: the connection from java to matlab */ public RCvalue java2Matlab() throws EvalException { if (rc == null) { if (poly != null) { Value[] v = new Value[poly.degree()]; for (int i = 0; i < v.length; i++) { Point pt = poly.point(i); assert pt.type() == CohoDouble.type : "The result type is not CohoDouble, it is " + pt.type(); // if(pt.type()!=CohoDouble.type){ // throw new RuntimeException("The result type is not CohoDouble, it is "+pt.type() ); // } v[i] = RCvalue.factory() .create( new Value[] { DoubleValue.factory() .create(new Double(((CohoDouble) pt.x()).doubleValue()), null), DoubleValue.factory() .create(new Double(((CohoDouble) pt.y()).doubleValue()), null) }, false); } rc = (RCvalue) (RCvalue.factory().create(v, true)); } else { // empty polygon rc = (RCvalue) (RCvalue.factory().create(new Value[0], true)); } } return (rc); }
void ckDoubleValue(Value retValue) { Field theValueField = targetClass.fieldByName("edoubleValue"); DoubleValue theValue = (DoubleValue) targetClass.getValue(theValueField); double vv = theValue.value(); double rv = ((DoubleValue) retValue).value(); if (vv != rv) { failure("failure: double: expected " + vv + ", got " + rv); } else { System.out.println("Passed: double " + rv); earlyReturns++; } }
@Override public void visit(DoubleValue dv) { ValueExpression ve = new ValueSpecification(_dblConv, dv.getValue()); _exprStack.push(ve); }