/** * <p>This returns a new tokenizer based on one of our tokens.</p> * * <p>The geometric datatypes use this to process nested tokens (usually PGpoint).</p> * * @param n Token number ( 0 ... getSize()-1 ) * @param delim The delimiter to use * @return A new instance of PGtokenizer based on the token */ public PGtokenizer tokenizeToken(int n, char delim) { return new PGtokenizer(getToken(n), delim); }
public PGtokenizer tokenizeToken(int n, char delim) { return new PGtokenizer(getToken(n), delim); }
/** * @param s Definition of this point in PostgreSQL's syntax * @exception SQLException on conversion failure */ public void setValue(String s) throws SQLException { PGtokenizer t = new PGtokenizer(PGtokenizer.removePara(s), ','); try { x = Double.valueOf(t.getToken(0)).doubleValue(); y = Double.valueOf(t.getToken(1)).doubleValue(); } catch (NumberFormatException e) { throw new PSQLException(GT.tr("Conversion to type {0} failed: {1}.", new Object[]{type,s}), PSQLState.DATA_TYPE_MISMATCH, e); } }
/** * @param s Definition of this point in PostgreSQL's syntax * @throws SQLException on conversion failure */ @Override public void setValue(String s) throws SQLException { PGtokenizer t = new PGtokenizer(PGtokenizer.removePara(s), ','); try { x = Double.parseDouble(t.getToken(0)); y = Double.parseDouble(t.getToken(1)); } catch (NumberFormatException e) { throw new PSQLException(GT.tr("Conversion to type {0} failed: {1}.", type, s), PSQLState.DATA_TYPE_MISMATCH, e); } }
/** * @param s Definition of the polygon in PostgreSQL's syntax * @throws SQLException on conversion failure */ public void setValue(String s) throws SQLException { PGtokenizer t = new PGtokenizer(PGtokenizer.removePara(s), ','); int npoints = t.getSize(); points = new PGpoint[npoints]; for (int p = 0; p < npoints; p++) { points[p] = new PGpoint(t.getToken(p)); } }
/** * @param s Definition of the polygon in PostgreSQL's syntax * @exception SQLException on conversion failure */ public void setValue(String s) throws SQLException { PGtokenizer t = new PGtokenizer(PGtokenizer.removePara(s), ','); int npoints = t.getSize(); points = new PGpoint[npoints]; for (int p = 0;p < npoints;p++) points[p] = new PGpoint(t.getToken(p)); }
/** * @param s Definition of the path in PostgreSQL's syntax * @throws SQLException on conversion failure */ public void setValue(String s) throws SQLException { // First test to see if were open if (s.startsWith("[") && s.endsWith("]")) { open = true; s = PGtokenizer.removeBox(s); } else if (s.startsWith("(") && s.endsWith(")")) { open = false; s = PGtokenizer.removePara(s); } else { throw new PSQLException(GT.tr("Cannot tell if path is open or closed: {0}.", s), PSQLState.DATA_TYPE_MISMATCH); } PGtokenizer t = new PGtokenizer(s, ','); int npoints = t.getSize(); points = new PGpoint[npoints]; for (int p = 0; p < npoints; p++) { points[p] = new PGpoint(t.getToken(p)); } }
/** * @param s Definition of the path in PostgreSQL's syntax * @exception SQLException on conversion failure */ public void setValue(String s) throws SQLException { // First test to see if were open if (s.startsWith("[") && s.endsWith("]")) { open = true; s = PGtokenizer.removeBox(s); } else if (s.startsWith("(") && s.endsWith(")")) { open = false; s = PGtokenizer.removePara(s); } else throw new PSQLException(GT.tr("Cannot tell if path is open or closed: {0}.", s), PSQLState.DATA_TYPE_MISMATCH); PGtokenizer t = new PGtokenizer(s, ','); int npoints = t.getSize(); points = new PGpoint[npoints]; for (int p = 0;p < npoints;p++) points[p] = new PGpoint(t.getToken(p)); }
/** * @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; } }
/** * @param s definition of the circle in PostgreSQL's syntax. * @exception SQLException on conversion failure */ public void setValue(String s) throws SQLException { PGtokenizer t = new PGtokenizer(PGtokenizer.removeAngle(s), ','); if (t.getSize() != 2) throw new PSQLException(GT.tr("Conversion to type {0} failed: {1}.", new Object[]{type,s}), PSQLState.DATA_TYPE_MISMATCH); try { center = new PGpoint(t.getToken(0)); radius = Double.valueOf(t.getToken(1)).doubleValue(); } catch (NumberFormatException e) { throw new PSQLException(GT.tr("Conversion to type {0} failed: {1}.", new Object[]{type,s}), PSQLState.DATA_TYPE_MISMATCH, e); } }
/** * @param s definition of the circle in PostgreSQL's syntax. * @throws SQLException on conversion failure */ @Override public void setValue(String s) throws SQLException { PGtokenizer t = new PGtokenizer(PGtokenizer.removeAngle(s), ','); if (t.getSize() != 2) { throw new PSQLException(GT.tr("Conversion to type {0} failed: {1}.", type, s), PSQLState.DATA_TYPE_MISMATCH); } try { center = new PGpoint(t.getToken(0)); radius = Double.parseDouble(t.getToken(1)); } catch (NumberFormatException e) { throw new PSQLException(GT.tr("Conversion to type {0} failed: {1}.", type, s), PSQLState.DATA_TYPE_MISMATCH, e); } }
/** * This method sets the value of this object. It should be overidden, * but still called by subclasses. * * @param value a string representation of the value of the object * @exception SQLException thrown if value is invalid for this type */ public void setValue(String value) throws SQLException { PGtokenizer t = new PGtokenizer(value, ','); if (t.getSize() != 2) throw new PSQLException(GT.tr("Conversion to type {0} failed: {1}.", new Object[]{type,value}), PSQLState.DATA_TYPE_MISMATCH); point[0] = new PGpoint(t.getToken(0)); point[1] = new PGpoint(t.getToken(1)); }
/** * @param s Definition of the line in PostgreSQL's syntax * @exception SQLException on conversion failure */ public void setValue(String s) throws SQLException { PGtokenizer t = new PGtokenizer(PGtokenizer.removeBox(s), ','); if (t.getSize() != 2) throw new PSQLException(GT.tr("Conversion to type {0} failed: {1}.", new Object[]{type,s}), PSQLState.DATA_TYPE_MISMATCH); point[0] = new PGpoint(t.getToken(0)); point[1] = new PGpoint(t.getToken(1)); }
/** * @param s Definition of the line segment in PostgreSQL's syntax * @exception SQLException on conversion failure */ public void setValue(String s) throws SQLException { PGtokenizer t = new PGtokenizer(PGtokenizer.removeBox(s), ','); if (t.getSize() != 2) throw new PSQLException(GT.tr("Conversion to type {0} failed: {1}.", new Object[]{type,s}), PSQLState.DATA_TYPE_MISMATCH); point[0] = new PGpoint(t.getToken(0)); point[1] = new PGpoint(t.getToken(1)); }
/** * This method sets the value of this object. It should be overidden, but still called by * subclasses. * * @param value a string representation of the value of the object * @throws SQLException thrown if value is invalid for this type */ @Override public void setValue(String value) throws SQLException { PGtokenizer t = new PGtokenizer(value, ','); if (t.getSize() != 2) { throw new PSQLException( GT.tr("Conversion to type {0} failed: {1}.", type, value), PSQLState.DATA_TYPE_MISMATCH); } point[0] = new PGpoint(t.getToken(0)); point[1] = new PGpoint(t.getToken(1)); }
/** * @param s Definition of the line segment in PostgreSQL's syntax * @throws SQLException on conversion failure */ @Override public void setValue(String s) throws SQLException { 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); } point[0] = new PGpoint(t.getToken(0)); point[1] = new PGpoint(t.getToken(1)); }
/** * @param s Definition of the polygon in PostgreSQL's syntax * @exception SQLException on conversion failure */ public void setValue(String s) throws SQLException { PGtokenizer t = new PGtokenizer(PGtokenizer.removePara(s), ','); int npoints = t.getSize(); points = new PGpoint[npoints]; for (int p = 0;p < npoints;p++) points[p] = new PGpoint(t.getToken(p)); }
/** * @param s Definition of the polygon in PostgreSQL's syntax * @exception SQLException on conversion failure */ public void setValue(String s) throws SQLException { PGtokenizer t = new PGtokenizer(PGtokenizer.removePara(s), ','); int npoints = t.getSize(); points = new PGpoint[npoints]; for (int p = 0;p < npoints;p++) points[p] = new PGpoint(t.getToken(p)); }
/** * @param s Definition of the line in PostgreSQL's syntax * @exception SQLException on conversion failure */ public void setValue(String s) throws SQLException { PGtokenizer t = new PGtokenizer(PGtokenizer.removeBox(s), ','); if (t.getSize() != 2) throw new PSQLException(GT.tr("Conversion to type {0} failed: {1}.", new Object[]{type,s}), PSQLState.DATA_TYPE_MISMATCH); point[0] = new PGpoint(t.getToken(0)); point[1] = new PGpoint(t.getToken(1)); }
/** * @param s Definition of the line in PostgreSQL's syntax * @exception SQLException on conversion failure */ public void setValue(String s) throws SQLException { PGtokenizer t = new PGtokenizer(PGtokenizer.removeBox(s), ','); if (t.getSize() != 2) throw new PSQLException(GT.tr("Conversion to type {0} failed: {1}.", new Object[]{type,s}), PSQLState.DATA_TYPE_MISMATCH); point[0] = new PGpoint(t.getToken(0)); point[1] = new PGpoint(t.getToken(1)); }