com.foundationdb.sql.jdbc.geometric

## Class PGbox

- java.lang.Object
- - com.foundationdb.sql.jdbc.util.PGobject
  - - com.foundationdb.sql.jdbc.geometric.PGbox

All Implemented Interfaces:
  com.foundationdb.sql.jdbc.util.PGBinaryObject, java.io.Serializable, java.lang.Cloneable

    public class PGbox
    extends PGobject
    implements com.foundationdb.sql.jdbc.util.PGBinaryObject, java.io.Serializable, java.lang.Cloneable

This represents the box datatype within org.postgresql.

See Also:
  Serialized Form

### Field Summary

Fields
`PGpoint[]` `point` These are the two points.

### Fields inherited from class com.foundationdb.sql.jdbc.util.PGobject

`type, value`

### Constructor Summary

Constructors
Constructor and Description
`PGbox()` Required constructor
`PGbox(double x1, double y1, double x2, double y2)`
`PGbox(PGpoint p1, PGpoint p2)`
`PGbox(java.lang.String s)`

### Method Summary

Methods
`java.lang.Object` `clone()` This must be overidden to allow the object to be cloned
`boolean` `equals(java.lang.Object obj)` This must be overidden to allow comparisons of objects
`java.lang.String` `getValue()` This must be overidden, to return the value of the object, in the form required by org.postgresql.
`int` `hashCode()`
`int` `lengthInBytes()`
`void` `setByteValue(byte[] b, int offset)`
`void` `setValue(java.lang.String value)` This method sets the value of this object.
`void` `toBytes(byte[] bytes, int offset)`

### Methods inherited from class com.foundationdb.sql.jdbc.util.PGobject

`getType, setType, toString`

### Methods inherited from class java.lang.Object

`finalize, getClass, notify, notifyAll, wait, wait, wait`

### Field Detail

#### point

    public PGpoint[] point

These are the two points.

### Constructor Detail

#### PGbox

    public PGbox(double x1,
         double y1,
         double x2,
         double y2)

Parameters:
  `x1` - first x coordinate
  `y1` - first y coordinate
  `x2` - second x coordinate
  `y2` - second y coordinate

#### PGbox

    public PGbox(PGpoint p1,
         PGpoint p2)

Parameters:
  `p1` - first point
  `p2` - second point

#### PGbox

    public PGbox(java.lang.String s)
          throws java.sql.SQLException

Parameters:
  `s` - Box definition in PostgreSQL syntax
Throws:
  `java.sql.SQLException` - if definition is invalid

#### PGbox

    public PGbox()

Required constructor

### Method Detail

#### setValue

    public void setValue(java.lang.String value)
                  throws java.sql.SQLException

This method sets the value of this object. It should be overidden, but still called by subclasses.

Overrides:
  `setValue` in class `PGobject`
Parameters:
  `value` - a string representation of the value of the object
Throws:
  `java.sql.SQLException` - thrown if value is invalid for this type

#### setByteValue

    public void setByteValue(byte[] b,
                    int offset)

Specified by:
  `setByteValue` in interface `com.foundationdb.sql.jdbc.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: `PGobject`
This must be overidden to allow comparisons of objects

Overrides:
  `equals` in class `PGobject`
Parameters:
  `obj` - Object to compare with
Returns:
  true if the two boxes are identical

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `java.lang.Object`

#### clone

    public java.lang.Object clone()
                           throws java.lang.CloneNotSupportedException

Description copied from class: `PGobject`
This must be overidden to allow the object to be cloned

Overrides:
  `clone` in class `PGobject`
Throws:
  `java.lang.CloneNotSupportedException`

#### getValue

    public java.lang.String getValue()

Description copied from class: `PGobject`
This must be overidden, to return the value of the object, in the form required by org.postgresql.

Overrides:
  `getValue` in class `PGobject`
Returns:
  the PGbox in the syntax expected by org.postgresql

#### lengthInBytes

    public int lengthInBytes()

Specified by:
  `lengthInBytes` in interface `com.foundationdb.sql.jdbc.util.PGBinaryObject`

#### toBytes

    public void toBytes(byte[] bytes,
               int offset)

Specified by:
  `toBytes` in interface `com.foundationdb.sql.jdbc.util.PGBinaryObject`