public static Point2DArrays termToPoint2DArrays(Term value, ChoisePoint iX) { Term[] termArray = Converters.listToArray(value, iX); double[] xPoints = new double[termArray.length]; double[] yPoints = new double[termArray.length]; for (int n = 0; n < termArray.length; n++) { try { Term[] arguments = termArray[n].isStructure(SymbolCodes.symbolCode_E_p, 2, iX); xPoints[n] = Converters.argumentToReal(arguments[0], iX); yPoints[n] = Converters.argumentToReal(arguments[1], iX); } catch (Backtracking b) { throw new WrongArgumentIsNotAPoint2D(value); } } ; return new Point2DArrays(xPoints, yPoints); }
public Term getValue() { ActivePlainDocument activeDocument = (ActivePlainDocument) getDocument(); try { // return new PrologReal(new Double(activeDocument.getTextOrBacktrack())); String text = activeDocument.getTextOrBacktrack(); BigInteger number = Converters.stringToStrictInteger(text); return new PrologInteger(number); } catch (Backtracking b) { return new PrologString(activeDocument.getText()); } catch (TermIsNotAnInteger e) { return new PrologString(activeDocument.getText()); } }