
- Added a private api layer (org.postgresql.core.Base*) - Cleaned up public api (org.postgresql.PG*) - Added consistent headers and copywrite info - Removed deprecated Serialize functionality - Cleaned up imports - Moved some files to more appropriate locations Modified Files: jdbc/org/postgresql/Driver.java.in jdbc/org/postgresql/PGConnection.java jdbc/org/postgresql/PGNotification.java jdbc/org/postgresql/PGStatement.java jdbc/org/postgresql/core/Encoding.java jdbc/org/postgresql/core/Notification.java jdbc/org/postgresql/core/QueryExecutor.java jdbc/org/postgresql/core/StartupPacket.java jdbc/org/postgresql/fastpath/Fastpath.java jdbc/org/postgresql/fastpath/FastpathArg.java jdbc/org/postgresql/geometric/PGbox.java jdbc/org/postgresql/geometric/PGcircle.java jdbc/org/postgresql/geometric/PGline.java jdbc/org/postgresql/geometric/PGlseg.java jdbc/org/postgresql/geometric/PGpath.java jdbc/org/postgresql/geometric/PGpoint.java jdbc/org/postgresql/geometric/PGpolygon.java jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSetMetaData.java jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java jdbc/org/postgresql/jdbc1/Jdbc1CallableStatement.java jdbc/org/postgresql/jdbc1/Jdbc1Connection.java jdbc/org/postgresql/jdbc1/Jdbc1DatabaseMetaData.java jdbc/org/postgresql/jdbc1/Jdbc1PreparedStatement.java jdbc/org/postgresql/jdbc1/Jdbc1ResultSet.java jdbc/org/postgresql/jdbc1/Jdbc1ResultSetMetaData.java jdbc/org/postgresql/jdbc1/Jdbc1Statement.java jdbc/org/postgresql/jdbc2/AbstractJdbc2Blob.java jdbc/org/postgresql/jdbc2/AbstractJdbc2Clob.java jdbc/org/postgresql/jdbc2/AbstractJdbc2Connection.java jdbc/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java jdbc/org/postgresql/jdbc2/Array.java jdbc/org/postgresql/jdbc2/Jdbc2CallableStatement.java jdbc/org/postgresql/jdbc2/Jdbc2Connection.java jdbc/org/postgresql/jdbc2/Jdbc2PreparedStatement.java jdbc/org/postgresql/jdbc2/Jdbc2ResultSet.java jdbc/org/postgresql/jdbc2/Jdbc2ResultSetMetaData.java jdbc/org/postgresql/jdbc2/Jdbc2Statement.java jdbc/org/postgresql/jdbc3/AbstractJdbc3ResultSet.java jdbc/org/postgresql/jdbc3/Jdbc3CallableStatement.java jdbc/org/postgresql/jdbc3/Jdbc3Connection.java jdbc/org/postgresql/jdbc3/Jdbc3PreparedStatement.java jdbc/org/postgresql/jdbc3/Jdbc3ResultSet.java jdbc/org/postgresql/jdbc3/Jdbc3ResultSetMetaData.java jdbc/org/postgresql/jdbc3/Jdbc3Statement.java jdbc/org/postgresql/largeobject/BlobInputStream.java jdbc/org/postgresql/largeobject/BlobOutputStream.java jdbc/org/postgresql/largeobject/LargeObject.java jdbc/org/postgresql/largeobject/LargeObjectManager.java jdbc/org/postgresql/test/jdbc2/Jdbc2TestSuite.java jdbc/org/postgresql/test/jdbc2/optional/BaseDataSourceTest.java jdbc/org/postgresql/util/MD5Digest.java jdbc/org/postgresql/util/MessageTranslator.java jdbc/org/postgresql/util/PGbytea.java jdbc/org/postgresql/util/PGmoney.java jdbc/org/postgresql/util/PGobject.java jdbc/org/postgresql/util/PGtokenizer.java jdbc/org/postgresql/util/PSQLException.java jdbc/org/postgresql/util/UnixCrypt.java Added Files: jdbc/org/postgresql/core/BaseConnection.java jdbc/org/postgresql/core/BaseResultSet.java jdbc/org/postgresql/core/BaseStatement.java jdbc/org/postgresql/core/Field.java jdbc/org/postgresql/core/PGStream.java Removed Files: jdbc/org/postgresql/Field.java jdbc/org/postgresql/PG_Stream.java jdbc/org/postgresql/test/jdbc2/SerializeObject.java jdbc/org/postgresql/test/jdbc2/SerializeTest.java jdbc/org/postgresql/util/Serialize.java
117 lines
2.7 KiB
Java
117 lines
2.7 KiB
Java
/*-------------------------------------------------------------------------
|
|
*
|
|
* PGline.java
|
|
* This implements a line consisting of two points.
|
|
*
|
|
* Copyright (c) 2003, PostgreSQL Global Development Group
|
|
*
|
|
* IDENTIFICATION
|
|
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/geometric/Attic/PGline.java,v 1.4 2003/03/07 18:39:42 barry Exp $
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
package org.postgresql.geometric;
|
|
|
|
import java.io.Serializable;
|
|
import java.sql.SQLException;
|
|
import org.postgresql.util.PGobject;
|
|
import org.postgresql.util.PGtokenizer;
|
|
import org.postgresql.util.PSQLException;
|
|
|
|
/*
|
|
* Currently line is not yet implemented in the backend, but this class
|
|
* ensures that when it's done were ready for it.
|
|
*/
|
|
public class PGline extends PGobject implements Serializable, Cloneable
|
|
{
|
|
/*
|
|
* These are the two points.
|
|
*/
|
|
public PGpoint point[] = new PGpoint[2];
|
|
|
|
/*
|
|
* @param x1 coordinate for first point
|
|
* @param y1 coordinate for first point
|
|
* @param x2 coordinate for second point
|
|
* @param y2 coordinate for second point
|
|
*/
|
|
public PGline(double x1, double y1, double x2, double y2)
|
|
{
|
|
this(new PGpoint(x1, y1), new PGpoint(x2, y2));
|
|
}
|
|
|
|
/*
|
|
* @param p1 first point
|
|
* @param p2 second point
|
|
*/
|
|
public PGline(PGpoint p1, PGpoint p2)
|
|
{
|
|
this();
|
|
this.point[0] = p1;
|
|
this.point[1] = p2;
|
|
}
|
|
|
|
/*
|
|
* @param s definition of the circle in PostgreSQL's syntax.
|
|
* @exception SQLException on conversion failure
|
|
*/
|
|
public PGline(String s) throws SQLException
|
|
{
|
|
this();
|
|
setValue(s);
|
|
}
|
|
|
|
/*
|
|
* reuired by the driver
|
|
*/
|
|
public PGline()
|
|
{
|
|
setType("line");
|
|
}
|
|
|
|
/*
|
|
* @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("postgresql.geo.line", s);
|
|
|
|
point[0] = new PGpoint(t.getToken(0));
|
|
point[1] = new PGpoint(t.getToken(1));
|
|
}
|
|
|
|
/*
|
|
* @param obj Object to compare with
|
|
* @return true if the two boxes are identical
|
|
*/
|
|
public boolean equals(Object obj)
|
|
{
|
|
if (obj instanceof PGline)
|
|
{
|
|
PGline p = (PGline)obj;
|
|
return (p.point[0].equals(point[0]) && p.point[1].equals(point[1])) ||
|
|
(p.point[0].equals(point[1]) && p.point[1].equals(point[0]));
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/*
|
|
* This must be overidden to allow the object to be cloned
|
|
*/
|
|
public Object clone()
|
|
{
|
|
return new PGline((PGpoint)point[0].clone(), (PGpoint)point[1].clone());
|
|
}
|
|
|
|
/*
|
|
* @return the PGline in the syntax expected by org.postgresql
|
|
*/
|
|
public String getValue()
|
|
{
|
|
return "[" + point[0] + "," + point[1] + "]";
|
|
}
|
|
}
|