public class PGpoint extends PGobject implements 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.
Modifier and Type | Field and Description |
---|---|
boolean |
isNull
True if the point represents
null::point . |
double |
x
The X coordinate of the point.
|
double |
y
The Y coordinate of the point.
|
Constructor and Description |
---|
PGpoint()
Required by the driver.
|
PGpoint(double x,
double y) |
PGpoint(java.lang.String value)
This is called mainly from the other geometric types, when a point is embedded within their
definition.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
This must be overridden to allow the object to be cloned.
|
boolean |
equals(java.lang.Object obj)
This must be overridden to allow comparisons of objects.
|
java.lang.String |
getValue()
This must be overridden, to return the value of the object, in the form required by
org.postgresql.
|
int |
hashCode()
Compute hash.
|
int |
lengthInBytes()
This method is called to return the number of bytes needed to store this object in the binary
form required by org.postgresql.
|
void |
move(double x,
double y)
Moves the point to the supplied coordinates.
|
void |
move(int x,
int y)
Moves the point to the supplied coordinates.
|
void |
setByteValue(byte[] b,
int offset)
This method is called to set the value of this object.
|
void |
setLocation(int x,
int y)
Moves the point to the supplied coordinates.
|
void |
setLocation(java.awt.Point p)
Deprecated.
Will be removed for avoiding a dependency to the
java.desktop module. |
void |
setValue(java.lang.String s)
This method sets the value of this object.
|
void |
toBytes(byte[] b,
int offset)
Populate the byte array with PGpoint in the binary syntax expected by org.postgresql.
|
void |
translate(double x,
double y)
Translate the point by the supplied amount.
|
void |
translate(int x,
int y)
Translate the point by the supplied amount.
|
public double x
public double y
public boolean isNull
null::point
.public PGpoint(double x, double y)
x
- coordinatey
- coordinatepublic PGpoint(java.lang.String value) throws java.sql.SQLException
value
- Definition of this point in PostgreSQL's syntaxjava.sql.SQLException
- if something goes wrongpublic PGpoint()
public void setValue(java.lang.String s) throws java.sql.SQLException
PGobject
public void setByteValue(byte[] b, int offset)
PGBinaryObject
setByteValue
in interface PGBinaryObject
b
- Definition of this point in PostgreSQL's binary syntaxoffset
- the offset in the byte array where object data startspublic boolean equals(java.lang.Object obj)
PGobject
public int hashCode()
PGobject
public java.lang.String getValue()
PGobject
public int lengthInBytes()
PGBinaryObject
lengthInBytes
in interface PGBinaryObject
public void toBytes(byte[] b, int offset)
toBytes
in interface PGBinaryObject
b
- the array to store the value, it is guaranteed to be at lest
PGBinaryObject.lengthInBytes()
in size.offset
- the offset in the byte array where object must be storedpublic void translate(int x, int y)
x
- integer amount to add on the x axisy
- integer amount to add on the y axispublic void translate(double x, double y)
x
- double amount to add on the x axisy
- double amount to add on the y axispublic void move(int x, int y)
x
- integer coordinatey
- integer coordinatepublic void move(double x, double y)
x
- double coordinatey
- double coordinatepublic void setLocation(int x, int y)
x
- integer coordinatey
- integer coordinatePoint
@Deprecated public void setLocation(java.awt.Point p)
java.desktop
module.p
- Point to move toPoint
Copyright © 2024 PostgreSQL Global Development Group. All rights reserved.