javax.media.nativewindow.util

## Class Rectangle

- java.lang.Object
- - javax.media.nativewindow.util.Rectangle

- All Implemented Interfaces:
    WriteCloneable, Cloneable, Comparable<RectangleImmutable>, RectangleImmutable

      public class Rectangle
      extends Object
      implements Cloneable, RectangleImmutable

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Rectangle()`
    `Rectangle(int x, int y, int width, int height)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object` | `cloneMutable()`
    `int` | `compareTo(RectangleImmutable d)` Compares square of size 1st, if equal the square of position.
    `float` | `coverage(RectangleImmutable r)` Returns the coverage of given rectangle w/ this this one, i.e.
    `boolean` | `equals(Object obj)` Checks whether two rect objects are equal.
    `int` | `getHeight()`
    `int` | `getWidth()`
    `int` | `getX()`
    `int` | `getY()`
    `int` | `hashCode()`
    `RectangleImmutable` | `intersection(int rx1, int ry1, int rx2, int ry2)` Returns the intersection of this rectangleand the given coordinates.
    `RectangleImmutable` | `intersection(RectangleImmutable r)` Returns the intersection of this rectangleand the given rectangle.
    `Rectangle` | `scale(int sx, int sy)` Scale this instance's components, i.e.
    `Rectangle` | `scaleInv(int sx, int sy)` Inverse scale this instance's components, i.e.
    `void` | `set(int x, int y, int width, int height)`
    `void` | `setHeight(int height)`
    `void` | `setWidth(int width)`
    `void` | `setX(int x)`
    `void` | `setY(int y)`
    `String` | `toString()`
    `RectangleImmutable` | `union(int rx1, int ry1, int rx2, int ry2)` Returns the union of this rectangleand the given coordinates.
    `Rectangle` | `union(List<RectangleImmutable> rectangles)` Calculates the union of the given rectangles, stores it in this instance and returns this instance.
    `RectangleImmutable` | `union(RectangleImmutable r)` Returns the union of this rectangle and the given rectangle.

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

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

- - ### Constructor Detail

    - #### Rectangle

          public Rectangle()

    - #### Rectangle

          public Rectangle(int x,
                   int y,
                   int width,
                   int height)

  - ### Method Detail

    - #### cloneMutable

          public Object cloneMutable()

      Specified by:
        `cloneMutable` in interface `WriteCloneable`

    - #### getX

          public final int getX()

      Specified by:
        `getX` in interface `RectangleImmutable`

    - #### getY

          public final int getY()

      Specified by:
        `getY` in interface `RectangleImmutable`

    - #### getWidth

          public final int getWidth()

      Specified by:
        `getWidth` in interface `RectangleImmutable`

    - #### getHeight

          public final int getHeight()

      Specified by:
        `getHeight` in interface `RectangleImmutable`

    - #### set

          public final void set(int x,
                 int y,
                 int width,
                 int height)

    - #### setX

          public final void setX(int x)

    - #### setY

          public final void setY(int y)

    - #### setWidth

          public final void setWidth(int width)

    - #### setHeight

          public final void setHeight(int height)

    - #### union

          public final RectangleImmutable union(RectangleImmutable r)

      Description copied from interface: `RectangleImmutable`
      Returns the union of this rectangle and the given rectangle.
      Specified by:
        `union` in interface `RectangleImmutable`

    - #### union

          public final RectangleImmutable union(int rx1,
                                 int ry1,
                                 int rx2,
                                 int ry2)

      Description copied from interface: `RectangleImmutable`
      Returns the union of this rectangleand the given coordinates.
      Specified by:
        `union` in interface `RectangleImmutable`

    - #### union

          public final Rectangle union(List<RectangleImmutable> rectangles)

      Calculates the union of the given rectangles, stores it in this instance and returns this instance.
      Parameters:
        `rectangles` - given list of rectangles
      Returns:
        this instance holding the union of given rectangles.

    - #### intersection

          public final RectangleImmutable intersection(RectangleImmutable r)

      Description copied from interface: `RectangleImmutable`
      Returns the intersection of this rectangleand the given rectangle.
      Specified by:
        `intersection` in interface `RectangleImmutable`

    - #### intersection

          public final RectangleImmutable intersection(int rx1,
                                        int ry1,
                                        int rx2,
                                        int ry2)

      Description copied from interface: `RectangleImmutable`
      Returns the intersection of this rectangleand the given coordinates.
      Specified by:
        `intersection` in interface `RectangleImmutable`

    - #### coverage

          public final float coverage(RectangleImmutable r)

      Description copied from interface: `RectangleImmutable`
      Returns the coverage of given rectangle w/ this this one, i.e. between `0.0` and `1.0`.

      Coverage is computed by:

              isect = this.intersection(r);
              coverage = area( isect ) / area( this ) ;

      Specified by:
        `coverage` in interface `RectangleImmutable`

    - #### scale

          public final Rectangle scale(int sx,
                        int sy)

      Scale this instance's components, i.e. multiply them by the given scale factors.
      Parameters:
        `sx` - scale factor for x
        `sy` - scale factor for y
      Returns:
        this instance for scaling

    - #### scaleInv

          public final Rectangle scaleInv(int sx,
                           int sy)

      Inverse scale this instance's components, i.e. divide them by the given scale factors.
      Parameters:
        `sx` - inverse scale factor for x
        `sy` - inverse scale factor for y
      Returns:
        this instance for scaling

    - #### compareTo

          public int compareTo(RectangleImmutable d)

      Description copied from interface: `RectangleImmutable`

      Compares square of size 1st, if equal the square of position.

      Specified by:
        `compareTo` in interface `Comparable<RectangleImmutable>`
      Specified by:
        `compareTo` in interface `RectangleImmutable`

    - #### equals

          public boolean equals(Object obj)

      Description copied from interface: `RectangleImmutable`
      Checks whether two rect objects are equal. Two instances of `Rectangle` are equal if the four integer values of the fields `y`, `x`, `height`, and `width` are all equal.
      Specified by:
        `equals` in interface `RectangleImmutable`
      Overrides:
        `equals` in class `Object`
      Returns:
        `true` if the two rectangles are equal; otherwise `false`.

    - #### hashCode

          public int hashCode()

      Specified by:
        `hashCode` in interface `RectangleImmutable`
      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright 2010 JogAmp Community.