/** * @param s Definition of the line in PostgreSQL's syntax * @throws SQLException on conversion failure */ @Override public void setValue(String s) throws SQLException { if (s.trim().startsWith("{")) { PGtokenizer t = new PGtokenizer(PGtokenizer.removeCurlyBrace(s), ','); if (t.getSize() != 3) { throw new PSQLException(GT.tr("Conversion to type {0} failed: {1}.", type, s), PSQLState.DATA_TYPE_MISMATCH); } a = Double.parseDouble(t.getToken(0)); b = Double.parseDouble(t.getToken(1)); c = Double.parseDouble(t.getToken(2)); } else if (s.trim().startsWith("[")) { PGtokenizer t = new PGtokenizer(PGtokenizer.removeBox(s), ','); if (t.getSize() != 2) { throw new PSQLException(GT.tr("Conversion to type {0} failed: {1}.", type, s), PSQLState.DATA_TYPE_MISMATCH); } PGpoint point1 = new PGpoint(t.getToken(0)); PGpoint point2 = new PGpoint(t.getToken(1)); a = point2.x - point1.x; b = point2.y - point1.y; c = point1.y; } }