diff --git a/src/main/java/org/lwjglx/opengl/DisplayMode.java b/src/main/java/org/lwjglx/opengl/DisplayMode.java
index cad16f8..1862a81 100644
--- a/src/main/java/org/lwjglx/opengl/DisplayMode.java
+++ b/src/main/java/org/lwjglx/opengl/DisplayMode.java
@@ -83,11 +83,10 @@ public final class DisplayMode {
* @see java.lang.Object#equals(Object)
*/
public boolean equals(Object obj) {
- if (obj == null || !(obj instanceof DisplayMode)) {
+ if (obj == null || !(obj instanceof DisplayMode dm)) {
return false;
}
- DisplayMode dm = (DisplayMode) obj;
return dm.width == width && dm.height == height && dm.bpp == bpp && dm.freq == freq;
}
diff --git a/src/main/java/org/lwjglx/util/Dimension.java b/src/main/java/org/lwjglx/util/Dimension.java
index b5499ee..54d879a 100644
--- a/src/main/java/org/lwjglx/util/Dimension.java
+++ b/src/main/java/org/lwjglx/util/Dimension.java
@@ -19,7 +19,7 @@ import java.io.Serializable;
/**
* A 2D integer Dimension class, which looks remarkably like an AWT one.
- *
+ *
* @author $Author$
* @version $Revision$ $Id$
*/
@@ -74,8 +74,7 @@ public final class Dimension implements Serializable, ReadableDimension, Writabl
* Checks whether two dimension objects have equal values.
*/
public boolean equals(Object obj) {
- if (obj instanceof ReadableDimension) {
- ReadableDimension d = (ReadableDimension) obj;
+ if (obj instanceof ReadableDimension d) {
return (width == d.getWidth()) && (height == d.getHeight());
}
return false;
@@ -105,7 +104,7 @@ public final class Dimension implements Serializable, ReadableDimension, Writabl
/**
* Gets the height.
- *
+ *
* @return Returns a int
*/
public int getHeight() {
@@ -114,7 +113,7 @@ public final class Dimension implements Serializable, ReadableDimension, Writabl
/**
* Sets the height.
- *
+ *
* @param height The height to set
*/
public void setHeight(int height) {
@@ -123,7 +122,7 @@ public final class Dimension implements Serializable, ReadableDimension, Writabl
/**
* Gets the width.
- *
+ *
* @return Returns a int
*/
public int getWidth() {
@@ -132,7 +131,7 @@ public final class Dimension implements Serializable, ReadableDimension, Writabl
/**
* Sets the width.
- *
+ *
* @param width The width to set
*/
public void setWidth(int width) {
diff --git a/src/main/java/org/lwjglx/util/Point.java b/src/main/java/org/lwjglx/util/Point.java
index e5c39e2..76582b9 100644
--- a/src/main/java/org/lwjglx/util/Point.java
+++ b/src/main/java/org/lwjglx/util/Point.java
@@ -19,7 +19,7 @@ import java.io.Serializable;
/**
* A 2D integer point class, which looks remarkably like an AWT one.
- *
+ *
* @author $Author$
* @version $Revision$ $Id$
*/
@@ -71,7 +71,7 @@ public final class Point implements ReadablePoint, WritablePoint, Serializable {
/**
* Translate a point.
- *
+ *
* @param dx The translation to apply
* @param dy The translation to apply
*/
@@ -82,7 +82,7 @@ public final class Point implements ReadablePoint, WritablePoint, Serializable {
/**
* Translate a point.
- *
+ *
* @param p The translation to apply
*/
public void translate(ReadablePoint p) {
@@ -92,7 +92,7 @@ public final class Point implements ReadablePoint, WritablePoint, Serializable {
/**
* Un-translate a point.
- *
+ *
* @param p The translation to apply
*/
public void untranslate(ReadablePoint p) {
@@ -104,14 +104,13 @@ public final class Point implements ReadablePoint, WritablePoint, Serializable {
* Determines whether an instance of Point2D is equal to this point. Two instances of
* Point2D are equal if the values of their x and y member fields,
* representing their position in the coordinate space, are the same.
- *
+ *
* @param obj an object to be compared with this point
* @return true if the object to be compared is an instance of Point and has the same
* values; false otherwise
*/
public boolean equals(Object obj) {
- if (obj instanceof Point) {
- Point pt = (Point) obj;
+ if (obj instanceof Point pt) {
return (x == pt.x) && (y == pt.y);
}
return super.equals(obj);
diff --git a/src/main/java/org/lwjglx/util/Rectangle.java b/src/main/java/org/lwjglx/util/Rectangle.java
index d88f16b..6cac829 100644
--- a/src/main/java/org/lwjglx/util/Rectangle.java
+++ b/src/main/java/org/lwjglx/util/Rectangle.java
@@ -19,7 +19,7 @@ import java.io.Serializable;
/**
* A 2D integer Rectangle class which looks remarkably like an AWT one.
- *
+ *
* @author $Author$
* @version $Revision$ $Id$
*/
@@ -134,7 +134,7 @@ public final class Rectangle implements ReadableRectangle, WritableRectangle, Se
/**
* Translate the rectangle by an amount.
- *
+ *
* @param x The translation amount on the x axis
* @param y The translation amount on the y axis
*/
@@ -145,7 +145,7 @@ public final class Rectangle implements ReadableRectangle, WritableRectangle, Se
/**
* Translate the rectangle by an amount.
- *
+ *
* @param point The translation amount
*/
public void translate(ReadablePoint point) {
@@ -155,7 +155,7 @@ public final class Rectangle implements ReadableRectangle, WritableRectangle, Se
/**
* Un-translate the rectangle by an amount.
- *
+ *
* @param point The translation amount
*/
public void untranslate(ReadablePoint point) {
@@ -165,7 +165,7 @@ public final class Rectangle implements ReadableRectangle, WritableRectangle, Se
/**
* Checks whether or not this Rectangle contains the specified Point.
- *
+ *
* @param p the Point to test
* @return true if the Point (x, y) is inside this
* Rectangle; false otherwise.
@@ -177,7 +177,7 @@ public final class Rectangle implements ReadableRectangle, WritableRectangle, Se
/**
* Checks whether or not this Rectangle contains the point at the specified location
* (x, y).
- *
+ *
* @param X the specified x coordinate
* @param Y the specified y coordinate
* @return true if the point (x, y) is inside this Rectangle;
@@ -204,7 +204,7 @@ public final class Rectangle implements ReadableRectangle, WritableRectangle, Se
/**
* Checks whether or not this Rectangle entirely contains the specified Rectangle.
- *
+ *
* @param r the specified Rectangle
* @return true if the Rectangle is contained entirely inside this Rectangle;
* false otherwise.
@@ -216,7 +216,7 @@ public final class Rectangle implements ReadableRectangle, WritableRectangle, Se
/**
* Checks whether this Rectangle entirely contains the Rectangle at the specified location
* (X, Y) with the specified dimensions (W, H).
- *
+ *
* @param X the specified x coordinate
* @param Y the specified y coordinate
* @param W the width of the Rectangle
@@ -331,7 +331,7 @@ public final class Rectangle implements ReadableRectangle, WritableRectangle, Se
/**
* Computes the union of this Rectangle with the specified Rectangle. Returns a new
* Rectangle that represents the union of the two rectangles
- *
+ *
* @param r the specified Rectangle
* @return the smallest Rectangle containing both the specified Rectangle and this
* Rectangle.
@@ -354,7 +354,7 @@ public final class Rectangle implements ReadableRectangle, WritableRectangle, Se
* return true. The contains method does not return true for points on the
* right or bottom edges of a Rectangle. Therefore, if the added point falls on the right or bottom
* edge of the enlarged Rectangle, contains returns false for that point.
- *
+ *
* @param newx the x coordinates of the new point
* @param newy the y coordinates of the new point
*/
@@ -379,7 +379,7 @@ public final class Rectangle implements ReadableRectangle, WritableRectangle, Se
* true for points on the right or bottom edges of a Rectangle. Therefore if the added
* Point falls on the right or bottom edge of the enlarged Rectangle,
* contains returns false for that Point.
- *
+ *
* @param pt the new Point to add to this Rectangle
*/
public void add(ReadablePoint pt) {
@@ -389,7 +389,7 @@ public final class Rectangle implements ReadableRectangle, WritableRectangle, Se
/**
* Adds a Rectangle to this Rectangle. The resulting Rectangle is the union
* of the two rectangles.
- *
+ *
* @param r the specified Rectangle
*/
public void add(ReadableRectangle r) {
@@ -416,7 +416,7 @@ public final class Rectangle implements ReadableRectangle, WritableRectangle, Se
* If negative values are supplied for h and v, the size of the Rectangle
* decreases accordingly. The grow method does not check whether the resulting values of
* width and height are non-negative.
- *
+ *
* @param h the horizontal expansion
* @param v the vertical expansion
*/
@@ -430,7 +430,7 @@ public final class Rectangle implements ReadableRectangle, WritableRectangle, Se
/**
* Determines whether or not this Rectangle is empty. A Rectangle is empty if its width or
* its height is less than or equal to zero.
- *
+ *
* @return true if this Rectangle is empty; false otherwise.
*/
public boolean isEmpty() {
@@ -443,13 +443,12 @@ public final class Rectangle implements ReadableRectangle, WritableRectangle, Se
* The result is true if and only if the argument is not null and is a
* Rectangle object that has the same top-left corner, width, and height as this
* Rectangle.
- *
+ *
* @param obj the Object to compare with this Rectangle
* @return true if the objects are equal; false otherwise.
*/
public boolean equals(Object obj) {
- if (obj instanceof Rectangle) {
- Rectangle r = (Rectangle) obj;
+ if (obj instanceof Rectangle r) {
return ((x == r.x) && (y == r.y) && (width == r.width) && (height == r.height));
}
return super.equals(obj);
@@ -457,7 +456,7 @@ public final class Rectangle implements ReadableRectangle, WritableRectangle, Se
/**
* Debugging
- *
+ *
* @return a String
*/
public String toString() {
@@ -466,7 +465,7 @@ public final class Rectangle implements ReadableRectangle, WritableRectangle, Se
/**
* Gets the height.
- *
+ *
* @return Returns a int
*/
public int getHeight() {
@@ -475,7 +474,7 @@ public final class Rectangle implements ReadableRectangle, WritableRectangle, Se
/**
* Sets the height.
- *
+ *
* @param height The height to set
*/
public void setHeight(int height) {
@@ -484,7 +483,7 @@ public final class Rectangle implements ReadableRectangle, WritableRectangle, Se
/**
* Gets the width.
- *
+ *
* @return Returns a int
*/
public int getWidth() {
@@ -493,7 +492,7 @@ public final class Rectangle implements ReadableRectangle, WritableRectangle, Se
/**
* Sets the width.
- *
+ *
* @param width The width to set
*/
public void setWidth(int width) {
@@ -502,7 +501,7 @@ public final class Rectangle implements ReadableRectangle, WritableRectangle, Se
/**
* Gets the x.
- *
+ *
* @return Returns a int
*/
public int getX() {
@@ -511,7 +510,7 @@ public final class Rectangle implements ReadableRectangle, WritableRectangle, Se
/**
* Sets the x.
- *
+ *
* @param x The x to set
*/
public void setX(int x) {
@@ -520,7 +519,7 @@ public final class Rectangle implements ReadableRectangle, WritableRectangle, Se
/**
* Gets the y.
- *
+ *
* @return Returns a int
*/
public int getY() {
@@ -529,7 +528,7 @@ public final class Rectangle implements ReadableRectangle, WritableRectangle, Se
/**
* Sets the y.
- *
+ *
* @param y The y to set
*/
public void setY(int y) {