Top Fields Constructors Methods
com.jogamp.nativewindow.util

public Class Rectangle

extends Object
implements Cloneable, RectangleImmutable
Class Inheritance
All Implemented Interfaces
com.jogamp.nativewindow.util.RectangleImmutable, java.lang.Comparable, com.jogamp.common.type.WriteCloneable, java.lang.Cloneable
Imports
java.util.List

Field Summary

Modifier and TypeField and Description
pack-priv int
pack-priv int
pack-priv int
x

pack-priv int
y

Constructor Summary

AccessConstructor and Description
public
public
Rectangle(final int x, final int y, final int width, final int height)

public

Method Summary

Modifier and TypeMethod and Description
protected Object
clone()

Overrides java.lang.Object.clone.

Creates and returns a copy of this object.
public Object
cloneMutable()

Implements com.jogamp.common.type.WriteCloneable.cloneMutable.

Get a mutable clone from this instance.
public int
compareTo(final RectangleImmutable
the object to be compared.
d
)

Implements com.jogamp.nativewindow.util.RectangleImmutable.compareTo.

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

public final float
coverage(final RectangleImmutable r)

Implements com.jogamp.nativewindow.util.RectangleImmutable.coverage.

Returns the coverage of given rectangle w/ this this one, i.e. between 0.0 and 1.0.
public boolean
equals(final Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Implements com.jogamp.nativewindow.util.RectangleImmutable.equals.

Checks whether two rect objects are equal.
public final int
public final int
public final int
public final int
public int
hashCode()

Overrides java.lang.Object.hashCode.

Implements com.jogamp.nativewindow.util.RectangleImmutable.hashCode.

Returns a hash code value for this object.
public final RectangleImmutable
intersection(final RectangleImmutable r)

Implements com.jogamp.nativewindow.util.RectangleImmutable.intersection.

Returns the intersection of this rectangleand the given rectangle.
public final RectangleImmutable
intersection(final int rx1, final int ry1, final int rx2, final int ry2)

Implements com.jogamp.nativewindow.util.RectangleImmutable.intersection.

Returns the intersection of this rectangleand the given coordinates.
public final Rectangle

Returns:

this instance for scaling
scale
(final int
scale factor for x
sx
,
final int
scale factor for y
sy
)

Scale this instance's components, i.e. multiply them by the given scale factors.

public final Rectangle

Returns:

this instance for scaling
scaleInv
(final int
inverse scale factor for x
sx
,
final int
inverse scale factor for y
sy
)

Inverse scale this instance's components, i.e. divide them by the given scale factors.

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

public final void
set(final Rectangle s)

public final void
public final void
setHeight(final int height)

public final void
setWidth(final int width)

public final void
setX(final int x)

public final void
setY(final int y)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public final RectangleImmutable
union(final RectangleImmutable r)

Implements com.jogamp.nativewindow.util.RectangleImmutable.union.

Returns the union of this rectangle and the given rectangle.
public final RectangleImmutable
union(final int rx1, final int ry1, final int rx2, final int ry2)

Implements com.jogamp.nativewindow.util.RectangleImmutable.union.

Returns the union of this rectangleand the given coordinates.
public final Rectangle

Returns:

this instance holding the union of given rectangles.
union
(final List<RectangleImmutable>
given list of rectangles
rectangles
)

Calculates the union of the given rectangles, stores it in this instance and returns this instance.

Inherited from java.lang.Object:
finalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

heightback to summary
pack-priv int height
widthback to summary
pack-priv int width
xback to summary
pack-priv int x
yback to summary
pack-priv int y

Constructor Detail

Rectangleback to summary
public Rectangle()
Rectangleback to summary
public Rectangle(final int x, final int y, final int width, final int height)
Rectangleback to summary
public Rectangle(final RectangleImmutable s)

Method Detail

cloneback to summary
protected Object clone()

Overrides java.lang.Object.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Returns:Object

a clone of this instance.

Annotations
@Override
cloneMutableback to summary
public Object cloneMutable()

Implements com.jogamp.common.type.WriteCloneable.cloneMutable.

Doc from com.jogamp.common.type.WriteCloneable.cloneMutable.

Get a mutable clone from this instance.

Annotations
@Override
compareToback to summary
public int compareTo(final RectangleImmutable d)

Implements com.jogamp.nativewindow.util.RectangleImmutable.compareTo.

Doc from com.jogamp.nativewindow.util.RectangleImmutable.compareTo.

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

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Parameters
d:RectangleImmutable

Doc from java.lang.Comparable.compareTo.

the object to be compared.

Returns:int

Doc from java.lang.Comparable.compareTo.

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Annotations
@Override
coverageback to summary
public final float coverage(final RectangleImmutable r)

Implements com.jogamp.nativewindow.util.RectangleImmutable.coverage.

Doc from com.jogamp.nativewindow.util.RectangleImmutable.coverage.

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 ) ;

Annotations
@Override
equalsback to summary
public boolean equals(final Object obj)

Overrides java.lang.Object.equals.

Implements com.jogamp.nativewindow.util.RectangleImmutable.equals.

Doc from com.jogamp.nativewindow.util.RectangleImmutable.equals.

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.

Parameters
obj:Object

Doc from java.lang.Object.equals.

the reference object with which to compare.

Returns:boolean

true if the two rectangles are equal; otherwise false.

Annotations
@Override
getHeightback to summary
public final int getHeight()

Implements com.jogamp.nativewindow.util.RectangleImmutable.getHeight.

Annotations
@Override
getWidthback to summary
public final int getWidth()

Implements com.jogamp.nativewindow.util.RectangleImmutable.getWidth.

Annotations
@Override
getXback to summary
public final int getX()

Implements com.jogamp.nativewindow.util.RectangleImmutable.getX.

Annotations
@Override
getYback to summary
public final int getY()

Implements com.jogamp.nativewindow.util.RectangleImmutable.getY.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Implements com.jogamp.nativewindow.util.RectangleImmutable.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
intersectionback to summary
public final RectangleImmutable intersection(final RectangleImmutable r)

Implements com.jogamp.nativewindow.util.RectangleImmutable.intersection.

Doc from com.jogamp.nativewindow.util.RectangleImmutable.intersection.

Returns the intersection of this rectangleand the given rectangle.

Annotations
@Override
intersectionback to summary
public final RectangleImmutable intersection(final int rx1, final int ry1, final int rx2, final int ry2)

Implements com.jogamp.nativewindow.util.RectangleImmutable.intersection.

Doc from com.jogamp.nativewindow.util.RectangleImmutable.intersection.

Returns the intersection of this rectangleand the given coordinates.

Annotations
@Override
scaleback to summary
public final Rectangle scale(final int sx, final int sy)

Scale this instance's components, i.e. multiply them by the given scale factors.

Parameters
sx:int

scale factor for x

sy:int

scale factor for y

Returns:Rectangle

this instance for scaling

scaleInvback to summary
public final Rectangle scaleInv(final int sx, final int sy)

Inverse scale this instance's components, i.e. divide them by the given scale factors.

Parameters
sx:int

inverse scale factor for x

sy:int

inverse scale factor for y

Returns:Rectangle

this instance for scaling

setback to summary
public final void set(final int x, final int y, final int width, final int height)
setback to summary
public final void set(final Rectangle s)
setback to summary
public final void set(final RectangleImmutable s)
setHeightback to summary
public final void setHeight(final int height)
setWidthback to summary
public final void setWidth(final int width)
setXback to summary
public final void setX(final int x)
setYback to summary
public final void setY(final int y)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override
unionback to summary
public final RectangleImmutable union(final RectangleImmutable r)

Implements com.jogamp.nativewindow.util.RectangleImmutable.union.

Doc from com.jogamp.nativewindow.util.RectangleImmutable.union.

Returns the union of this rectangle and the given rectangle.

Annotations
@Override
unionback to summary
public final RectangleImmutable union(final int rx1, final int ry1, final int rx2, final int ry2)

Implements com.jogamp.nativewindow.util.RectangleImmutable.union.

Doc from com.jogamp.nativewindow.util.RectangleImmutable.union.

Returns the union of this rectangleand the given coordinates.

Annotations
@Override
unionback to summary
public final Rectangle union(final List<RectangleImmutable> rectangles)

Calculates the union of the given rectangles, stores it in this instance and returns this instance.

Parameters
rectangles:List<RectangleImmutable>

given list of rectangles

Returns:Rectangle

this instance holding the union of given rectangles.