Package org.eclipse.draw2d.geometry

# Class PrecisionRectangle

java.lang.Object
org.eclipse.draw2d.geometry.Rectangle
org.eclipse.draw2d.geometry.PrecisionRectangle

All Implemented Interfaces:
  `Serializable`, `Cloneable`, `Translatable`

public final class PrecisionRectangle extends Rectangle
A Rectangle implementation using floating point values which are truncated into the inherited integer fields. The use of floating point prevents rounding errors from accumulating.

See Also:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`double`
`preciseHeight`
Deprecated, for removal: This API element is subject to removal in a future version.
Use `setPreciseHeight(double)` and `preciseHeight()` instead.
`double`
`preciseWidth`
Deprecated, for removal: This API element is subject to removal in a future version.
Use `setPreciseWidth(double)` and `preciseWidth()` instead.
`double`
`preciseX`
Deprecated, for removal: This API element is subject to removal in a future version.
Use `setPreciseX(double)` and `preciseX()` instead.
`double`
`preciseY`
Deprecated, for removal: This API element is subject to removal in a future version.
Use `setPreciseX(double)` and `preciseY()` instead.

### Fields inherited from class org.eclipse.draw2d.geometry.Rectangle

`height, SINGLETON, width, x, y`

## Constructor Summary

Constructors
Constructor
Description
`PrecisionRectangle()`
Constructs a new PrecisionRectangle with all values 0.
`PrecisionRectangle(double x, double y, double width, double height)`
Constructs a PrecisionRectangle with the provided values.
`PrecisionRectangle(Point p, Dimension d)`
Constructs a new PrecisionRectangle from a given Point and a Dimension
`PrecisionRectangle(Rectangle rect)`
Constructs a new PrecisionRectangle from the given integer Rectangle.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`contains(double x, double y)`
Returns whether the given coordinates are within the boundaries of this Rectangle.
`boolean`
`contains(int x, int y)`
Returns whether the given coordinates are within the boundaries of this Rectangle.
`boolean`
`contains(Point p)`
Returns whether the given point is within the boundaries of this Rectangle.
`boolean`
`contains(Rectangle rect)`
Returns `true` if the given rectangle is contained within the boundaries of this Rectangle.
`boolean`
`equals(Object o)`
Returns whether the input object is equal to this Rectangle or not.
`Rectangle`
`expand(double h, double v)`
Expands the horizontal and vertical sides of this Rectangle with the values provided as input, and returns this for convenience.
`Rectangle`
`expand(int h, int v)`
Expands the horizontal and vertical sides of this Rectangle with the values provided as input, and returns this for convenience.
`Rectangle`
`expand(Insets insets)`
Expands the horizontal and vertical sides of this Rectangle by the width and height of the given Insets, and returns this for convenience.
`Point`
`getBottom()`
Returns a new Point representing the middle point of the bottom side of this Rectangle.
`Point`
`getBottomLeft()`
Returns a new Point representing the bottom left point of this Rectangle.
`Point`
`getBottomRight()`
Returns a new Point representing the bottom right point of this Rectangle.
`Point`
`getCenter()`
Returns a new point representing the center of this Rectangle.
`Rectangle`
`getCopy()`
Returns a new Rectangle which has the exact same parameters as this Rectangle.
`PrecisionRectangle`
`getPreciseCopy()`
Returns a precise copy of this.
`Point`
`getTop()`
Returns a new Point which represents the middle point of the top side of this Rectangle.
`Point`
`getTopLeft()`
Returns a new Point which represents the top left hand corner of this Rectangle.
`Point`
`getTopRight()`
Returns a new Point which represents the top right hand corner of this Rectangle.
`Rectangle`
`intersect(Rectangle rect)`
Sets the size of this Rectangle to the intersection region with the Rectangle supplied as input, and returns this for convenience.
`void`
`performScale(double factor)`
Scales this object by the scale factor.
`void`
`performTranslate(int dx, int dy)`
Translates this object horizontally by `dx` and vertically by `dy`.
`double`
`preciseBottom()`
Returns the bottom coordinte in double precision.
`double`
`preciseHeight()`
Returns `double` height
`double`
`preciseRight()`
Returns the right side in double precision.
`double`
`preciseWidth()`
Returns `double` width
`double`
`preciseX()`
Returns `double` x coordinate
`double`
`preciseY()`
Returns `double` y coordinate
`Rectangle`
`resize(double w, double h)`
Resizes this Rectangle by the values supplied as input and returns this for convenience.
`Rectangle`
`resize(int w, int h)`
Resizes this Rectangle by the values supplied as input and returns this for convenience.
`Rectangle`
`resize(Dimension d)`
Resizes this Rectangle by the Dimension provided as input and returns this for convenience.
`Rectangle`
`setBounds(int x, int y, int width, int height)`
Sets the x, y, width, and height values of this Rectangle to the provided values.
`Rectangle`
`setBounds(Point location, Dimension size)`
Sets the location and size of this rectangle to the provided ones.
`Rectangle`
`setBounds(Rectangle rect)`
Sets the parameters of this Rectangle from the Rectangle passed in and returns this for convenience.
`void`
`setHeight(double value)`
Deprecated, for removal: This API element is subject to removal in a future version.
Use `setPreciseHeight(double)` instead.
`Rectangle`
`setHeight(int height)`
Sets the height of this Rectangle to the specified one.
`Rectangle`
`setLocation(int x, int y)`
Sets the location of this Rectangle to the coordinates given as input and returns this for convenience.
`Rectangle`
`setLocation(Point loc)`
Sets the location of this Rectangle to the point given as input and returns this for convenience.
`PrecisionRectangle`
`setPreciseBounds(double x, double y, double width, double height)`
Sets the preciseX, preciseY, preciseWidth, and preciseHeight values of this PrecisionRectangle to the provided values and updates the integer values of x, y, width, and height accordingly.
`PrecisionRectangle`
`setPreciseHeight(double value)`
Sets the height of this PrecisionRectangle to the specified value.
`PrecisionRectangle`
`setPreciseLocation(double x, double y)`
Sets the preciseX and preciseY values of this PrecisionRectangle to the provided values and updates the integer values of x and y accordingly.
`PrecisionRectangle`
`setPreciseLocation(PrecisionPoint loc)`
Sets the precise location of this PrecisionRectangle
`PrecisionRectangle`
`setPreciseSize(double w, double h)`
Sets the preciseWidth and preciseHeight values of this PrecisionRectangle to the provided values and updates the integer values of width and height accordingly.
`PrecisionRectangle`
`setPreciseSize(PrecisionDimension size)`
Set the size of this PrecisionRectangle to the given dimension's width and height.
`PrecisionRectangle`
`setPreciseWidth(double value)`
Sets the width of this PrecisionRectangle to the specified one.
`PrecisionRectangle`
`setPreciseX(double value)`
Sets the x value.
`PrecisionRectangle`
`setPreciseY(double value)`
Sets the y value.
`Rectangle`
`setSize(int w, int h)`
Sets the width of this Rectangle to w and the height of this Rectangle to h and returns this for convenience.
`Rectangle`
`setSize(Dimension d)`
Sets the width and height of this Rectangle to the width and height of the given Dimension and returns this for convenience.
`void`
`setWidth(double value)`
Deprecated, for removal: This API element is subject to removal in a future version.
Use `setPreciseWidth(double)` instead.
`Rectangle`
`setWidth(int width)`
Sets the width of this Rectangle to the specified one.
`void`
`setX(double value)`
Deprecated, for removal: This API element is subject to removal in a future version.
Use `setPreciseX(double)` instead.
`Rectangle`
`setX(int value)`
Sets the x value of the Rectangle and returns this for convenience.
`void`
`setY(double value)`
Deprecated, for removal: This API element is subject to removal in a future version.
Use `setPreciseX(double)` instead.
`Rectangle`
`setY(int value)`
Sets the y value of the Rectangle and returns this for convenience.
`Rectangle`
`shrink(double h, double v)`
Shrinks the sides of this Rectangle by the horizontal and vertical values provided as input, and returns this Rectangle for convenience.
`Rectangle`
`shrink(int h, int v)`
Shrinks the sides of this Rectangle by the horizontal and vertical values provided as input, and returns this Rectangle for convenience.
`Rectangle`
`shrink(Insets insets)`
Shrinks this rectangle by the amount specified in `insets`.
`boolean`
`touches(Rectangle rect)`
Returns `true` if the input Rectangle touches this Rectangle.
`Rectangle`
`translate(double dx, double dy)`
Moves this Rectangle horizontally by dx and vertically by dy, then returns this Rectangle for convenience.
`Rectangle`
`translate(int dx, int dy)`
Moves this Rectangle horizontally by dx and vertically by dy, then returns this Rectangle for convenience.
`Rectangle`
`translate(Point p)`
Moves this Rectangle horizontally by the x value of the given Point and vertically by the y value of the given Point, then returns this Rectangle for convenience.
`Rectangle`
`transpose()`
Switches the x and y values, as well as the width and height of this Rectangle.
`Rectangle`
`union(double x, double y)`
Updates this Rectangle's bounds to the minimum size which can hold both this Rectangle and the coordinate (x,y).
`Rectangle`
`union(double x, double y, double w, double h)`
Updates this Rectangle's dimensions to the minimum size which can hold both this Rectangle and the rectangle (x, y, w, h).
`Rectangle`
`union(int x, int y)`
Updates this Rectangle's bounds to the minimum size which can hold both this Rectangle and the coordinate (x,y).
`Rectangle`
`union(int x, int y, int w, int h)`
Updates this Rectangle's dimensions to the minimum size which can hold both this Rectangle and the rectangle (x, y, w, h).
`void`
`union(Point p)`
Updates this Rectangle's bounds to the minimum size which can hold both this Rectangle and the given Point.
`PrecisionRectangle`
`union(PrecisionRectangle rect)`
Deprecated, for removal: This API element is subject to removal in a future version.
Use `union(Rectangle)` instead
`Rectangle`
`union(Rectangle rect)`
Updates this Rectangle's dimensions to the minimum size which can hold both this Rectangle and the given Rectangle.
`void`
`updateInts()`
Deprecated, for removal: This API element is subject to removal in a future version.
This method should not be accessed by clients any more (it will be made private in future releases).

### Methods inherited from class org.eclipse.draw2d.geometry.Rectangle

`bottom, crop, equals, getCropped, getExpanded, getExpanded, getExpanded, getHorizontalInterval, getIntersection, getLeft, getLocation, getPosition, getResized, getResized, getResized, getRight, getShrinked, getShrinked, getShrinked, getSize, getTranslated, getTranslated, getTranslated, getTransposed, getUnion, getUnion, getVerticalInterval, hashCode, height, intersects, isEmpty, left, right, scale, scale, setBottom, setRight, shrinkLeft, shrinkTop, top, toString, union, width, x, y`

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

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

### Methods inherited from interface org.eclipse.draw2d.geometry.Translatable

`performTranslate, performTranslate, performTranslate`

## Field Details

### preciseHeight

@Deprecated(since="3.7", forRemoval=true) public double preciseHeight
Deprecated, for removal: This API element is subject to removal in a future version.
Use `setPreciseHeight(double)` and `preciseHeight()` instead. This field will become private in the future.
Double value for height

@noreference
  This field is not intended to be referenced by clients.

### preciseWidth

@Deprecated(since="3.7", forRemoval=true) public double preciseWidth
Deprecated, for removal: This API element is subject to removal in a future version.
Use `setPreciseWidth(double)` and `preciseWidth()` instead. This field will become private in the future.
Double value for width

@noreference
  This field is not intended to be referenced by clients.

### preciseX

@Deprecated(since="3.7", forRemoval=true) public double preciseX
Deprecated, for removal: This API element is subject to removal in a future version.
Use `setPreciseX(double)` and `preciseX()` instead. This field will become private in the future.
Double value for X

@noreference
  This field is not intended to be referenced by clients.

### preciseY

@Deprecated(since="3.7", forRemoval=true) public double preciseY
Deprecated, for removal: This API element is subject to removal in a future version.
Use `setPreciseX(double)` and `preciseY()` instead. This field will become private in the future.
Double value for Y

@noreference
  This field is not intended to be referenced by clients.

## Constructor Details

### PrecisionRectangle

public PrecisionRectangle()
Constructs a new PrecisionRectangle with all values 0.

### PrecisionRectangle

public PrecisionRectangle(double x, double y, double width, double height)
Constructs a PrecisionRectangle with the provided values.

Parameters:
  `x` - X location
  `y` - Y location
  `width` - Width of the rectangle
  `height` - Height of the rectangle
Since:
  3.7

### PrecisionRectangle

public PrecisionRectangle(Point p, Dimension d)
Constructs a new PrecisionRectangle from a given Point and a Dimension

Parameters:
  `p` - The Point to specify x and y location of the PrecisionRectangle
  `d` - The Dimension to use for width and height of the PrecisionRectangle
Since:
  3.7

### PrecisionRectangle

public PrecisionRectangle(Rectangle rect)
Constructs a new PrecisionRectangle from the given integer Rectangle.

Parameters:
  `rect` - the base rectangle

## Method Details

### contains

public boolean contains(double x, double y)
Description copied from class: `Rectangle`
Returns whether the given coordinates are within the boundaries of this Rectangle. The boundaries are inclusive of the top and left edges, but exclusive of the bottom and right edges.

Overrides:
  `contains` in class `Rectangle`
Parameters:
  `x` - X value
  `y` - Y value
Returns:
  true if the coordinates are within this Rectangle
See Also:
  - `Rectangle.contains(double, double)`

### contains

public boolean contains(int x, int y)
Description copied from class: `Rectangle`
Returns whether the given coordinates are within the boundaries of this Rectangle. The boundaries are inclusive of the top and left edges, but exclusive of the bottom and right edges.

Overrides:
  `contains` in class `Rectangle`
Parameters:
  `x` - X value
  `y` - Y value
Returns:
  true if the coordinates are within this Rectangle
See Also:
  - `Rectangle.contains(int, int)`

### contains

public boolean contains(Point p)
Description copied from class: `Rectangle`
Returns whether the given point is within the boundaries of this Rectangle. The boundaries are inclusive of the top and left edges, but exclusive of the bottom and right edges.

Overrides:
  `contains` in class `Rectangle`
Parameters:
  `p` - Point being tested for containment
Returns:
  true if the Point is within this Rectangle
See Also:
  - `Rectangle.contains(org.eclipse.draw2d.geometry.Point)`

### contains

public boolean contains(Rectangle rect)
Description copied from class: `Rectangle`
Returns `true` if the given rectangle is contained within the boundaries of this Rectangle.

Overrides:
  `contains` in class `Rectangle`
Parameters:
  `rect` - the Rectangle to test
Returns:
  true if the Rectangle is within this Rectangle
See Also:
  - `Rectangle.contains(org.eclipse.draw2d.geometry.Rectangle)`

### equals

public boolean equals(Object o)
Description copied from class: `Rectangle`
Returns whether the input object is equal to this Rectangle or not. Rectangles are equivalent if their x, y, height, and width values are the same.

Overrides:
  `equals` in class `Rectangle`
Parameters:
  `o` - Object being tested for equality
Returns:
  Returns the result of the equality test
See Also:
  - `Rectangle.equals(Object)`

### expand

public Rectangle expand(double h, double v)
Expands the horizontal and vertical sides of this Rectangle with the values provided as input, and returns this for convenience. The location of its center is kept constant.

Overrides:
  `expand` in class `Rectangle`
Parameters:
  `h` - Horizontal increment
  `v` - Vertical increment
Returns:
  `this` for convenience
Since:
  3.4

### expand

public Rectangle expand(Insets insets)
Description copied from class: `Rectangle`
Expands the horizontal and vertical sides of this Rectangle by the width and height of the given Insets, and returns this for convenience.

Overrides:
  `expand` in class `Rectangle`
Parameters:
  `insets` - contains the amounts to expand on each side
Returns:
  `this` for convenience
See Also:
  - `Rectangle.expand(org.eclipse.draw2d.geometry.Insets)`

### expand

public Rectangle expand(int h, int v)
Description copied from class: `Rectangle`
Expands the horizontal and vertical sides of this Rectangle with the values provided as input, and returns this for convenience. The location of its center is kept constant.

Overrides:
  `expand` in class `Rectangle`
Parameters:
  `h` - Horizontal increment
  `v` - Vertical increment
Returns:
  `this` for convenience
See Also:
  - `Rectangle.expand(int, int)`

### getBottom

public Point getBottom()
Description copied from class: `Rectangle`
Returns a new Point representing the middle point of the bottom side of this Rectangle.

Overrides:
  `getBottom` in class `Rectangle`
Returns:
  Point at the bottom of the Rectangle
See Also:
  - `Rectangle.getBottom()`

### getBottomLeft

public Point getBottomLeft()
Description copied from class: `Rectangle`
Returns a new Point representing the bottom left point of this Rectangle.

Overrides:
  `getBottomLeft` in class `Rectangle`
Returns:
  Point at the bottom left of the rectangle
See Also:
  - `Rectangle.getBottomLeft()`

### getBottomRight

public Point getBottomRight()
Description copied from class: `Rectangle`
Returns a new Point representing the bottom right point of this Rectangle.

Overrides:
  `getBottomRight` in class `Rectangle`
Returns:
  Point at the bottom right of the rectangle
See Also:
  - `Rectangle.getBottomRight()`

### getCenter

public Point getCenter()
Description copied from class: `Rectangle`
Returns a new point representing the center of this Rectangle.

Overrides:
  `getCenter` in class `Rectangle`
Returns:
  Point at the center of the rectangle
See Also:
  - `Rectangle.getCenter()`

### getCopy

public Rectangle getCopy()
Description copied from class: `Rectangle`
Returns a new Rectangle which has the exact same parameters as this Rectangle.

Overrides:
  `getCopy` in class `Rectangle`
Returns:
  Copy of this Rectangle
See Also:
  - `Rectangle.getCopy()`

### getPreciseCopy

public PrecisionRectangle getPreciseCopy()
Returns a precise copy of this.

Returns:
  a precise copy

### getTop

public Point getTop()
Description copied from class: `Rectangle`
Returns a new Point which represents the middle point of the top side of this Rectangle.

Overrides:
  `getTop` in class `Rectangle`
Returns:
  Point at the top of the Rectangle
See Also:
  - `Rectangle.getTop()`

### getTopLeft

public Point getTopLeft()
Description copied from class: `Rectangle`
Returns a new Point which represents the top left hand corner of this Rectangle.

Overrides:
  `getTopLeft` in class `Rectangle`
Returns:
  Point at the top left of the rectangle
See Also:
  - `Rectangle.getTopLeft()`

### getTopRight

public Point getTopRight()
Description copied from class: `Rectangle`
Returns a new Point which represents the top right hand corner of this Rectangle.

Overrides:
  `getTopRight` in class `Rectangle`
Returns:
  Point at the top right of the rectangle
See Also:
  - `Rectangle.getTopRight()`

### intersect

public Rectangle intersect(Rectangle rect)
Description copied from class: `Rectangle`
Sets the size of this Rectangle to the intersection region with the Rectangle supplied as input, and returns this for convenience. The location and dimensions are set to zero if there is no intersection with the input Rectangle.

Overrides:
  `intersect` in class `Rectangle`
Parameters:
  `rect` - Rectangle for the calculating intersection.
Returns:
  `this` for convenience
See Also:
  - `Rectangle.intersect(org.eclipse.draw2d.geometry.Rectangle)`

### performScale

public void performScale(double factor)
Description copied from interface: `Translatable`
Scales this object by the scale factor.

Specified by:
  `performScale` in interface `Translatable`
Overrides:
  `performScale` in class `Rectangle`
Parameters:
  `factor` - The scale factor
See Also:
  - `Rectangle.performScale(double)`

### performTranslate

public void performTranslate(int dx, int dy)
Description copied from interface: `Translatable`
Translates this object horizontally by `dx` and vertically by `dy`.

Specified by:
  `performTranslate` in interface `Translatable`
Overrides:
  `performTranslate` in class `Rectangle`
Parameters:
  `dx` - The amount to translate horizontally
  `dy` - The amount to translate vertically
See Also:
  - `Rectangle.performTranslate(int, int)`

### preciseBottom

public double preciseBottom()
Returns the bottom coordinte in double precision.

Returns:
  the precise bottom

### preciseHeight

public double preciseHeight()
Description copied from class: `Rectangle`
Returns `double` height

Overrides:
  `preciseHeight` in class `Rectangle`
Returns:
  `double` height
See Also:
  - `Rectangle.preciseHeight()`

### preciseRight

public double preciseRight()
Returns the right side in double precision.

Returns:
  the precise right

### preciseWidth

public double preciseWidth()
Description copied from class: `Rectangle`
Returns `double` width

Overrides:
  `preciseWidth` in class `Rectangle`
Returns:
  `double` width
See Also:
  - `Rectangle.preciseWidth()`

### preciseX

public double preciseX()
Description copied from class: `Rectangle`
Returns `double` x coordinate

Overrides:
  `preciseX` in class `Rectangle`
Returns:
  `double` x coordinate
See Also:
  - `Rectangle.preciseX()`

### preciseY

public double preciseY()
Description copied from class: `Rectangle`
Returns `double` y coordinate

Overrides:
  `preciseY` in class `Rectangle`
Returns:
  `double` y coordinate
See Also:
  - `Rectangle.preciseY()`

### resize

public Rectangle resize(Dimension d)
Description copied from class: `Rectangle`
Resizes this Rectangle by the Dimension provided as input and returns this for convenience. This Rectange's width will become this.width + sizeDelta.width. Likewise for height.

Overrides:
  `resize` in class `Rectangle`
Parameters:
  `d` - Resize data as a Dimension
Returns:
  `this` for convenience
See Also:
  - `Rectangle.resize(org.eclipse.draw2d.geometry.Dimension)`

### resize

public Rectangle resize(double w, double h)
Description copied from class: `Rectangle`
Resizes this Rectangle by the values supplied as input and returns this for convenience. This Rectangle's width will become this.width + dw. This Rectangle's height will become this.height + dh.

Overrides:
  `resize` in class `Rectangle`
Parameters:
  `w` - Amount by which width is to be resized
  `h` - Amount by which height is to be resized
Returns:
  `this` for convenience
See Also:
  - `Rectangle.resize(double, double)`

### resize

public Rectangle resize(int w, int h)
Description copied from class: `Rectangle`
Resizes this Rectangle by the values supplied as input and returns this for convenience. This Rectangle's width will become this.width + dw. This Rectangle's height will become this.height + dh.

Overrides:
  `resize` in class `Rectangle`
Parameters:
  `w` - Amount by which width is to be resized
  `h` - Amount by which height is to be resized
Returns:
  `this` for convenience
See Also:
  - `Rectangle.resize(int, int)`

### setBounds

public Rectangle setBounds(int x, int y, int width, int height)
Description copied from class: `Rectangle`
Sets the x, y, width, and height values of this Rectangle to the provided values.

Overrides:
  `setBounds` in class `Rectangle`
Parameters:
  `x` - The new x
  `y` - The new y
  `width` - The new width
  `height` - The new height
Returns:
  this for convenience
See Also:
  - `Rectangle.setBounds(int, int, int, int)`

### setBounds

public Rectangle setBounds(Point location, Dimension size)
Description copied from class: `Rectangle`
Sets the location and size of this rectangle to the provided ones.

Overrides:
  `setBounds` in class `Rectangle`
Parameters:
  `location` - The new location
  `size` - The new size
Returns:
  this for convenience
See Also:
  - `Rectangle.setBounds(org.eclipse.draw2d.geometry.Point, org.eclipse.draw2d.geometry.Dimension)`

### setBounds

public Rectangle setBounds(Rectangle rect)
Description copied from class: `Rectangle`
Sets the parameters of this Rectangle from the Rectangle passed in and returns this for convenience.

Overrides:
  `setBounds` in class `Rectangle`
Parameters:
  `rect` - Rectangle providing the bounding values
Returns:
  `this` for convenience
See Also:
  - `Rectangle.setBounds(org.eclipse.draw2d.geometry.Rectangle)`

### setHeight

@Deprecated(since="3.7", forRemoval=true) public void setHeight(double value)
Deprecated, for removal: This API element is subject to removal in a future version.
Use `setPreciseHeight(double)` instead.
Sets the height.

Parameters:
  `value` - the new height
@noreference
  This method is not intended to be referenced by clients.

### setHeight

public Rectangle setHeight(int height)
Description copied from class: `Rectangle`
Sets the height of this Rectangle to the specified one.

Overrides:
  `setHeight` in class `Rectangle`
Parameters:
  `height` - The new height
Returns:
  this for convenience.
See Also:
  - `Rectangle.setHeight(int)`

### setLocation

public Rectangle setLocation(int x, int y)
Description copied from class: `Rectangle`
Sets the location of this Rectangle to the coordinates given as input and returns this for convenience.

Overrides:
  `setLocation` in class `Rectangle`
Parameters:
  `x` - The new X coordinate
  `y` - The new Y coordinate
Returns:
  `this` for convenience
See Also:
  - `Rectangle.setLocation(int, int)`

### setLocation

public Rectangle setLocation(Point loc)
Description copied from class: `Rectangle`
Sets the location of this Rectangle to the point given as input and returns this for convenience.

Overrides:
  `setLocation` in class `Rectangle`
Parameters:
  `loc` - New position of this Rectangle
Returns:
  `this` for convenience
See Also:
  - `Rectangle.setLocation(org.eclipse.draw2d.geometry.Point)`

### setPreciseBounds

public PrecisionRectangle setPreciseBounds(double x, double y, double width, double height)
Sets the preciseX, preciseY, preciseWidth, and preciseHeight values of this PrecisionRectangle to the provided values and updates the integer values of x, y, width, and height accordingly.

Parameters:
  `x` - The new x
  `y` - The new y
  `width` - The new width
  `height` - The new height
Returns:
  this for convenience
Since:
  3.7

### setPreciseHeight

public PrecisionRectangle setPreciseHeight(double value)
Sets the height of this PrecisionRectangle to the specified value.

Parameters:
  `value` - The new height.
Returns:
  this for convenience
Since:
  3.7

### setPreciseLocation

public PrecisionRectangle setPreciseLocation(double x, double y)
Sets the preciseX and preciseY values of this PrecisionRectangle to the provided values and updates the integer values of x and y accordingly.

Parameters:
  `x` - The new x value
  `y` - The new y value
Returns:
  this for convenience
Since:
  3.7

### setPreciseLocation

public PrecisionRectangle setPreciseLocation(PrecisionPoint loc)
Sets the precise location of this PrecisionRectangle

Parameters:
  `loc` - The new location
Returns:
  this for convenience.
Since:
  3.7

### setPreciseSize

public PrecisionRectangle setPreciseSize(double w, double h)
Sets the preciseWidth and preciseHeight values of this PrecisionRectangle to the provided values and updates the integer values of width and height accordingly.

Parameters:
  `w` - The new width
  `h` - The new height
Returns:
  this for convenience.
Since:
  3.7

### setPreciseSize

public PrecisionRectangle setPreciseSize(PrecisionDimension size)
Set the size of this PrecisionRectangle to the given dimension's width and height. Returns this for convenience.

Parameters:
  `size` - The new size
Returns:
  this for convenience.
Since:
  3.7

### setPreciseWidth

public PrecisionRectangle setPreciseWidth(double value)
Sets the width of this PrecisionRectangle to the specified one.

Parameters:
  `value` - The new width
Returns:
  this for convenience
Since:
  3.7

### setPreciseX

public PrecisionRectangle setPreciseX(double value)
Sets the x value.

Parameters:
  `value` - The new x value
Returns:
  this for convenience
Since:
  3.7

### setPreciseY

public PrecisionRectangle setPreciseY(double value)
Sets the y value.

Parameters:
  `value` - the new y value
Returns:
  this for convenience
Since:
  3.7

### setSize

public Rectangle setSize(Dimension d)
Description copied from class: `Rectangle`
Sets the width and height of this Rectangle to the width and height of the given Dimension and returns this for convenience.

Overrides:
  `setSize` in class `Rectangle`
Parameters:
  `d` - The new Dimension
Returns:
  `this` for convenience
See Also:
  - `Rectangle.setSize(org.eclipse.draw2d.geometry.Dimension)`

### setSize

public Rectangle setSize(int w, int h)
Description copied from class: `Rectangle`
Sets the width of this Rectangle to w and the height of this Rectangle to h and returns this for convenience.

Overrides:
  `setSize` in class `Rectangle`
Parameters:
  `w` - The new width
  `h` - The new height
Returns:
  `this` for convenience
See Also:
  - `Rectangle.setSize(int, int)`

### setWidth

@Deprecated(since="3.7", forRemoval=true) public void setWidth(double value)
Deprecated, for removal: This API element is subject to removal in a future version.
Use `setPreciseWidth(double)` instead.
Sets the width.

Parameters:
  `value` - the new width
@noreference
  This method is not intended to be referenced by clients.

### setWidth

public Rectangle setWidth(int width)
Description copied from class: `Rectangle`
Sets the width of this Rectangle to the specified one.

Overrides:
  `setWidth` in class `Rectangle`
Parameters:
  `width` - The new width
Returns:
  this for convenience.
See Also:
  - `Rectangle.setWidth(int)`

### setX

@Deprecated(since="3.7", forRemoval=true) public void setX(double value)
Deprecated, for removal: This API element is subject to removal in a future version.
Use `setPreciseX(double)` instead.
Sets the x value.

Parameters:
  `value` - the new x value
@noreference
  This method is not intended to be referenced by clients.

### setX

public Rectangle setX(int value)
Description copied from class: `Rectangle`
Sets the x value of the Rectangle and returns this for convenience.

Overrides:
  `setX` in class `Rectangle`
Parameters:
  `value` - The new x value
Returns:
  `this` for convenience
See Also:
  - `Rectangle.setX(int)`

### setY

@Deprecated(since="3.7", forRemoval=true) public void setY(double value)
Deprecated, for removal: This API element is subject to removal in a future version.
Use `setPreciseX(double)` instead.
Sets the y value.

Parameters:
  `value` - the new y value
@noreference
  This method is not intended to be referenced by clients.

### setY

public Rectangle setY(int value)
Description copied from class: `Rectangle`
Sets the y value of the Rectangle and returns this for convenience.

Overrides:
  `setY` in class `Rectangle`
Parameters:
  `value` - The new y value
Returns:
  `this` for convenience
See Also:
  - `Rectangle.setY(int)`

### shrink

public Rectangle shrink(double h, double v)
Shrinks the sides of this Rectangle by the horizontal and vertical values provided as input, and returns this Rectangle for convenience. The center of this Rectangle is kept constant.

Overrides:
  `shrink` in class `Rectangle`
Parameters:
  `h` - Horizontal reduction amount
  `v` - Vertical reduction amount
Returns:
  `this` for convenience
Since:
  3.4

### shrink

public Rectangle shrink(Insets insets)
Description copied from class: `Rectangle`
Shrinks this rectangle by the amount specified in `insets`.

Overrides:
  `shrink` in class `Rectangle`
Parameters:
  `insets` - Insets to be removed from the Rectangle
Returns:
  `this` for convenience
See Also:
  - `Rectangle.shrink(org.eclipse.draw2d.geometry.Insets)`

### shrink

public Rectangle shrink(int h, int v)
Description copied from class: `Rectangle`
Shrinks the sides of this Rectangle by the horizontal and vertical values provided as input, and returns this Rectangle for convenience. If the given reduction amount of larger than the current `Rectangle.width()` or `Rectangle.height()` of the rectangle, `0` is used instead. The center of this Rectangle is kept constant.

Overrides:
  `shrink` in class `Rectangle`
Parameters:
  `h` - Horizontal reduction amount
  `v` - Vertical reduction amount
Returns:
  `this` for convenience
See Also:
  - `Rectangle.shrink(int, int)`

### touches

public boolean touches(Rectangle rect)
Description copied from class: `Rectangle`
Returns `true` if the input Rectangle touches this Rectangle.

Overrides:
  `touches` in class `Rectangle`
Parameters:
  `rect` - Rectangle being checked for contact
Returns:
  `true` if rect touches this Rectangle
See Also:
  - `Rectangle.touches(org.eclipse.draw2d.geometry.Rectangle)`

### translate

public Rectangle translate(double dx, double dy)
Description copied from class: `Rectangle`
Moves this Rectangle horizontally by dx and vertically by dy, then returns this Rectangle for convenience.

Overrides:
  `translate` in class `Rectangle`
Parameters:
  `dx` - Shift along X axis
  `dy` - Shift along Y axis
Returns:
  `this` for convenience
See Also:
  - `Rectangle.translate(double, double)`

### translate

public Rectangle translate(int dx, int dy)
Description copied from class: `Rectangle`
Moves this Rectangle horizontally by dx and vertically by dy, then returns this Rectangle for convenience.

Overrides:
  `translate` in class `Rectangle`
Parameters:
  `dx` - Shift along X axis
  `dy` - Shift along Y axis
Returns:
  `this` for convenience
See Also:
  - `Rectangle.translate(int, int)`

### translate

public Rectangle translate(Point p)
Description copied from class: `Rectangle`
Moves this Rectangle horizontally by the x value of the given Point and vertically by the y value of the given Point, then returns this Rectangle for convenience.

Overrides:
  `translate` in class `Rectangle`
Parameters:
  `p` - Point which provides translation information
Returns:
  `this` for convenience
See Also:
  - `Rectangle.translate(org.eclipse.draw2d.geometry.Point)`

### transpose

public Rectangle transpose()
Description copied from class: `Rectangle`
Switches the x and y values, as well as the width and height of this Rectangle. Useful for orientation changes.

Overrides:
  `transpose` in class `Rectangle`
Returns:
  `this` for convenience
See Also:
  - `Rectangle.transpose()`

### union

public Rectangle union(double x, double y)
Description copied from class: `Rectangle`
Updates this Rectangle's bounds to the minimum size which can hold both this Rectangle and the coordinate (x,y).

Overrides:
  `union` in class `Rectangle`
Parameters:
  `x` - X coordinate
  `y` - Y coordinate
Returns:
  `this` for convenience
See Also:
  - `Rectangle.union(double, double)`

### union

public Rectangle union(double x, double y, double w, double h)
Description copied from class: `Rectangle`
Updates this Rectangle's dimensions to the minimum size which can hold both this Rectangle and the rectangle (x, y, w, h).

Overrides:
  `union` in class `Rectangle`
Parameters:
  `x` - X coordinate of desired union.
  `y` - Y coordinate of desired union.
  `w` - Width of desired union.
  `h` - Height of desired union.
Returns:
  `this` for convenience
See Also:
  - `Rectangle.union(double, double, double, double)`

### union

public Rectangle union(int x, int y)
Description copied from class: `Rectangle`
Updates this Rectangle's bounds to the minimum size which can hold both this Rectangle and the coordinate (x,y).

Overrides:
  `union` in class `Rectangle`
Parameters:
  `x` - X coordinate
  `y` - Y coordinate
Returns:
  `this` for convenience
See Also:
  - `Rectangle.union(int, int)`

### union

public Rectangle union(int x, int y, int w, int h)
Description copied from class: `Rectangle`
Updates this Rectangle's dimensions to the minimum size which can hold both this Rectangle and the rectangle (x, y, w, h).

Overrides:
  `union` in class `Rectangle`
Parameters:
  `x` - X coordinate of desired union.
  `y` - Y coordinate of desired union.
  `w` - Width of desired union.
  `h` - Height of desired union.
Returns:
  `this` for convenience
See Also:
  - `Rectangle.union(int, int, int, int)`

### union

public void union(Point p)
Description copied from class: `Rectangle`
Updates this Rectangle's bounds to the minimum size which can hold both this Rectangle and the given Point.

Overrides:
  `union` in class `Rectangle`
Parameters:
  `p` - Point to be unioned with this Rectangle
See Also:
  - `Rectangle.union(org.eclipse.draw2d.geometry.Point)`

### union

@Deprecated(since="3.7", forRemoval=true) public PrecisionRectangle union(PrecisionRectangle rect)
Deprecated, for removal: This API element is subject to removal in a future version.
Use `union(Rectangle)` instead
Unions the given PrecisionRectangle with this rectangle and returns `this` for convenience.

Parameters:
  `rect` - the rectangle being unioned
Returns:
  `this` for convenience
Since:
  3.0
@noreference
  This method is not intended to be referenced by clients.

### union

public Rectangle union(Rectangle rect)
Description copied from class: `Rectangle`
Updates this Rectangle's dimensions to the minimum size which can hold both this Rectangle and the given Rectangle.

Overrides:
  `union` in class `Rectangle`
Parameters:
  `rect` - Rectangle to be unioned with this Rectangle
Returns:
  `this` for convenience
See Also:
  - `Rectangle.union(org.eclipse.draw2d.geometry.Rectangle)`

### updateInts

@Deprecated(since="3.7", forRemoval=true) public void updateInts()
Deprecated, for removal: This API element is subject to removal in a future version.
This method should not be accessed by clients any more (it will be made private in future releases). The update of integer and precision fields is performed automatically if `preciseX`, `preciseY`, `preciseWidth`, and `preciseHeight` field values are not manipulated directly, but only via respective methods offered by this class.
Updates the integer values based on the current precise values.

Since:
  3.0
@noreference
  This method is not intended to be referenced by clients.