com.amazon.redshift.geometric

## Class RedshiftPoint

- java.lang.Object
- - com.amazon.redshift.util.RedshiftObject
  - - com.amazon.redshift.geometric.RedshiftPoint

All Implemented Interfaces:
  RedshiftBinaryObject, Serializable, Cloneable

    public class RedshiftPoint
    extends RedshiftObject
    implements RedshiftBinaryObject, Serializable, Cloneable

It maps to the point datatype in com.amazon.redshift.

This implements a version of java.awt.Point, except it uses double to represent the coordinates.

See Also:
  Serialized Form

### Field Summary

Fields
`double` `x` The X coordinate of the point.
`double` `y` The Y coordinate of the point.

### Fields inherited from class com.amazon.redshift.util.RedshiftObject

`type, value`

### Constructor Summary

Constructors
Constructor and Description
`RedshiftPoint()` Required by the driver.
`RedshiftPoint(double x, double y)`
`RedshiftPoint(String value)` This is called mainly from the other geometric types, when a point is embedded within their definition.

### Method Summary

All Methods Instance Methods Concrete Methods
`Object` `clone()` This must be overidden to allow the object to be cloned.
`boolean` `equals(Object obj)` This must be overidden to allow comparisons of objects.
`String` `getValue()` This must be overidden, to return the value of the object, in the form required by com.amazon.redshift.
`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 com.amazon.redshift.
`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(Point p)` Moves the point to the supplied java.awt.Point refer to java.awt.Point for description of this.
`void` `setValue(String s)` This method sets the value of this object.
`void` `toBytes(byte[] b, int offset)` Populate the byte array with RedshiftPoint in the binary syntax expected by com.amazon.redshift.
`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.

### Methods inherited from class com.amazon.redshift.util.RedshiftObject

`getType, setType, toString`

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

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

### Field Detail

#### x

    public double x

The X coordinate of the point.

#### y

    public double y

The Y coordinate of the point.

### Constructor Detail

#### RedshiftPoint

    public RedshiftPoint(double x,
                         double y)

Parameters:
  `x` - coordinate
  `y` - coordinate

#### RedshiftPoint

    public RedshiftPoint(String value)
                  throws SQLException

This is called mainly from the other geometric types, when a point is embedded within their definition.

Parameters:
  `value` - Definition of this point in Redshift's syntax
Throws:
  `SQLException` - if something goes wrong

#### RedshiftPoint

    public RedshiftPoint()

Required by the driver.

### Method Detail

#### setValue

    public void setValue(String s)
                  throws SQLException

Description copied from class: `RedshiftObject`
This method sets the value of this object. It must be overridden.

Overrides:
  `setValue` in class `RedshiftObject`
Parameters:
  `s` - Definition of this point in Redshift's syntax
Throws:
  `SQLException` - on conversion failure

#### setByteValue

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

Description copied from interface: `RedshiftBinaryObject`
This method is called to set the value of this object.

Specified by:
  `setByteValue` in interface `RedshiftBinaryObject`
Parameters:
  `b` - Definition of this point in Redshift's binary syntax
  `offset` - the offset in the byte array where object data starts

#### equals

    public boolean equals(Object obj)

Description copied from class: `RedshiftObject`
This must be overidden to allow comparisons of objects.

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

#### hashCode

    public int hashCode()

Description copied from class: `RedshiftObject`
Compute hash. As equals() use only value. Return the same hash for the same value.

Overrides:
  `hashCode` in class `RedshiftObject`
Returns:
  Value hashcode, 0 if value is null `Objects.hashCode(Object)`

#### getValue

    public String getValue()

Description copied from class: `RedshiftObject`
This must be overidden, to return the value of the object, in the form required by com.amazon.redshift.

Overrides:
  `getValue` in class `RedshiftObject`
Returns:
  the RedshiftPoint in the syntax expected by com.amazon.redshift

#### lengthInBytes

    public int lengthInBytes()

Description copied from interface: `RedshiftBinaryObject`
This method is called to return the number of bytes needed to store this object in the binary form required by com.amazon.redshift.

Specified by:
  `lengthInBytes` in interface `RedshiftBinaryObject`
Returns:
  the number of bytes needed to store this object

#### toBytes

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

Populate the byte array with RedshiftPoint in the binary syntax expected by com.amazon.redshift.

Specified by:
  `toBytes` in interface `RedshiftBinaryObject`
Parameters:
  `b` - the array to store the value, it is guaranteed to be at lest `RedshiftBinaryObject.lengthInBytes()` in size.
  `offset` - the offset in the byte array where object must be stored

#### translate

    public void translate(int x,
                          int y)

Translate the point by the supplied amount.

Parameters:
  `x` - integer amount to add on the x axis
  `y` - 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 axis
  `y` - 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 coordinate
  `y` - integer coordinate

#### move

    public void move(double x,
                     double y)

Moves the point to the supplied coordinates.

Parameters:
  `x` - double coordinate
  `y` - 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 coordinate
  `y` - integer coordinate
See Also:
  `Point`

#### setLocation

    public void setLocation(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`

#### clone

    public Object clone()
                 throws CloneNotSupportedException

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

Overrides:
  `clone` in class `RedshiftObject`
Throws:
  `CloneNotSupportedException`