AzimuthFF 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 lat1 = v1.getDouble(); double lon1 = v2.getDouble(); double lat2 = v3.getDouble(); double lon2 = v4.getDouble(); double radians = Azimuth.find(lat1, lon1, lat2, lon2); return NodeValue.makeDouble(radians); } 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(0); NodeValue v2 = NodeValue.makeDouble(0); NodeValue v3 = NodeValue.makeDouble(0); NodeValue v4 = NodeValue.makeDouble(10); AzimuthFF instance = new AzimuthFF(); NodeValue expResult = NodeValue.makeDouble(1.5707963267948966); NodeValue result = instance.exec(v1, v2, v3, v4); assertEquals(expResult, result); }