Package org.postgresql.geometric
Class PGpoint
- java.lang.Object
-
- org.postgresql.util.PGobject
-
- org.postgresql.geometric.PGpoint
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,org.postgresql.util.PGBinaryObject
public class PGpoint extends PGobject implements org.postgresql.util.PGBinaryObject, java.io.Serializable, java.lang.Cloneable
It maps to the point datatype in org.postgresql. This implements a version of java.awt.Point, except it uses double to represent the coordinates.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)This must be overidden to allow comparisons of objectsjava.lang.StringgetValue()This must be overidden, to return the value of the object, in the form required by org.postgresql.inthashCode()Compute hash.intlengthInBytes()voidmove(double x, double y)Moves the point to the supplied coordinates.voidmove(int x, int y)Moves the point to the supplied coordinates.voidsetByteValue(byte[] b, int offset)voidsetLocation(int x, int y)Moves the point to the supplied coordinates.voidsetLocation(java.awt.Point p)Moves the point to the supplied java.awt.Point refer to java.awt.Point for description of thisvoidsetValue(java.lang.String s)This method sets the value of this object.voidtoBytes(byte[] b, int offset)Populate the byte array with PGpoint in the binary syntax expected by org.postgresqlvoidtranslate(double x, double y)Translate the point by the supplied amount.voidtranslate(int x, int y)Translate the point by the supplied amount.
-
-
-
Constructor Detail
-
PGpoint
public PGpoint(double x, double y)- Parameters:
x- coordinatey- coordinate
-
PGpoint
public PGpoint(java.lang.String value) throws java.sql.SQLExceptionThis is called mainly from the other geometric types, when a point is embedded within their definition.- Parameters:
value- Definition of this point in PostgreSQL's syntax- Throws:
java.sql.SQLException
-
PGpoint
public PGpoint()
Required by the driver
-
-
Method Detail
-
setValue
public void setValue(java.lang.String s) throws java.sql.SQLExceptionDescription copied from class:PGobjectThis method sets the value of this object. It must be overidden.
-
setByteValue
public void setByteValue(byte[] b, int offset)- Specified by:
setByteValuein interfaceorg.postgresql.util.PGBinaryObject- Parameters:
b- Definition of this point in PostgreSQL's binary syntax
-
equals
public boolean equals(java.lang.Object obj)
Description copied from class:PGobjectThis must be overidden to allow comparisons of objects
-
hashCode
public int hashCode()
Description copied from class:PGobjectCompute hash. As equals() use only value. Return the same hash for the same value.
-
getValue
public java.lang.String getValue()
Description copied from class:PGobjectThis must be overidden, to return the value of the object, in the form required by org.postgresql.
-
lengthInBytes
public int lengthInBytes()
- Specified by:
lengthInBytesin interfaceorg.postgresql.util.PGBinaryObject
-
toBytes
public void toBytes(byte[] b, int offset)Populate the byte array with PGpoint in the binary syntax expected by org.postgresql- Specified by:
toBytesin interfaceorg.postgresql.util.PGBinaryObject
-
translate
public void translate(int x, int y)Translate the point by the supplied amount.- Parameters:
x- integer amount to add on the x axisy- integer amount to add on the y axis
-
translate
public void translate(double x, double y)Translate the point by the supplied amount.- Parameters:
x- double amount to add on the x axisy- double amount to add on the y axis
-
move
public void move(int x, int y)Moves the point to the supplied coordinates.- Parameters:
x- integer coordinatey- integer coordinate
-
move
public void move(double x, double y)Moves the point to the supplied coordinates.- Parameters:
x- double coordinatey- double coordinate
-
setLocation
public void setLocation(int x, int y)Moves the point to the supplied coordinates. refer to java.awt.Point for description of this- Parameters:
x- integer coordinatey- integer coordinate- See Also:
Point
-
setLocation
public void setLocation(java.awt.Point p)
Moves the point to the supplied java.awt.Point refer to java.awt.Point for description of this- Parameters:
p- Point to move to- See Also:
Point
-
-