AngleDegreesFF extends FunctionBase4 { @Override public NodeValue exec(NodeValue v1, NodeValue v2, NodeValue v3, NodeValue v4) { try { if (!v1.isNumber()) { throw new ExprEvalException("Not a Number: " + FmtUtils.stringForNode(v1.asNode())); } if (!v2.isNumber()) { throw new ExprEvalException("Not a Number: " + FmtUtils.stringForNode(v2.asNode())); } if (!v3.isNumber()) { throw new ExprEvalException("Not a Number: " + FmtUtils.stringForNode(v3.asNode())); } if (!v4.isNumber()) { throw new ExprEvalException("Not a Number: " + FmtUtils.stringForNode(v4.asNode())); } double x1 = v1.getDouble(); double y1 = v2.getDouble(); double x2 = v3.getDouble(); double y2 = v4.getDouble(); double radians = Angle.find(x1, y1, x2, y2); double degrees = cleanUpPrecision(Math.toDegrees(radians)); return NodeValue.makeDouble(degrees); } catch (DatatypeFormatException ex) { throw new ExprEvalException(ex.getMessage(), ex); } }  @Override NodeValue exec(NodeValue v1, NodeValue v2, NodeValue v3, NodeValue v4);  }
@Test public void testExec() { NodeValue v1 = NodeValue.makeDouble(25); NodeValue v2 = NodeValue.makeDouble(45); NodeValue v3 = NodeValue.makeDouble(75); NodeValue v4 = NodeValue.makeDouble(100); AngleDegreesFF instance = new AngleDegreesFF(); NodeValue expResult = NodeValue.makeDouble(42.273689); NodeValue result = instance.exec(v1, v2, v3, v4); assertEquals(expResult, result); }