Package org.postgresql.geometric
Class PGbox
java.lang.Object
org.postgresql.util.PGobject
org.postgresql.geometric.PGbox
- All Implemented Interfaces:
Serializable
,Cloneable
,PGBinaryObject
This represents the box datatype within org.postgresql.
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
This must be overridden to allow the object to be cloned.boolean
This must be overridden to allow comparisons of objects.@Nullable 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
This method is called to return the number of bytes needed to store this object in the binary form required by org.postgresql.void
setByteValue
(byte[] b, int offset) This method is called to set the value of this object.void
This method sets the value of this object.void
toBytes
(byte[] bytes, int offset) This method is called the to store the value of the object, in the binary form required by org.postgresql.
-
Field Details
-
point
These are the two points.
-
-
Constructor Details
-
PGbox
public PGbox(double x1, double y1, double x2, double y2) - Parameters:
x1
- first x coordinatey1
- first y coordinatex2
- second x coordinatey2
- second y coordinate
-
PGbox
- Parameters:
p1
- first pointp2
- second point
-
PGbox
- Parameters:
s
- Box definition in PostgreSQL syntax- Throws:
SQLException
- if definition is invalid
-
PGbox
public PGbox()Required constructor.
-
-
Method Details
-
setValue
This method sets the value of this object. It should be overridden, but still called by subclasses.- Overrides:
setValue
in classPGobject
- Parameters:
value
- a string representation of the value of the object- Throws:
SQLException
- thrown if value is invalid for this type
-
setByteValue
public void setByteValue(byte[] b, int offset) Description copied from interface:PGBinaryObject
This method is called to set the value of this object.- Specified by:
setByteValue
in interfacePGBinaryObject
- Parameters:
b
- Definition of this point in PostgreSQL's binary syntaxoffset
- the offset in the byte array where object data starts
-
equals
Description copied from class:PGobject
This must be overridden to allow comparisons of objects. -
hashCode
public int hashCode()Description copied from class:PGobject
Compute hash. As equals() use only value. Return the same hash for the same value.- Overrides:
hashCode
in classPGobject
- Returns:
- Value hashcode, 0 if value is null
Objects.hashCode(Object)
-
clone
Description copied from class:PGobject
This must be overridden to allow the object to be cloned.- Overrides:
clone
in classPGobject
- Throws:
CloneNotSupportedException
-
getValue
Description copied from class:PGobject
This must be overridden, to return the value of the object, in the form required by org.postgresql. -
lengthInBytes
public int lengthInBytes()Description copied from interface:PGBinaryObject
This method is called to return the number of bytes needed to store this object in the binary form required by org.postgresql.- Specified by:
lengthInBytes
in interfacePGBinaryObject
- Returns:
- the number of bytes needed to store this object
-
toBytes
public void toBytes(byte[] bytes, int offset) Description copied from interface:PGBinaryObject
This method is called the to store the value of the object, in the binary form required by org.postgresql.- Specified by:
toBytes
in interfacePGBinaryObject
- Parameters:
bytes
- the array to store the value, it is guaranteed to be at lestPGBinaryObject.lengthInBytes()
in size.offset
- the offset in the byte array where object must be stored
-