public final class Rectangle extends Object
Example usage:
try (Comparer comparer = new Comparer(sourceFile)) {
comparer.add(targetFile);
comparer.compare(resultFile);
final ChangeInfo[] changes = comparer.getChanges();
for (ChangeInfo change : changes) {
final Rectangle box = change.getBox();
// Print the changed area on page
System.out.println("Changed area on a page: "
+ box.getX() + ", " + box.getY() + ", " + box.getWidth() + ", " + box.getHeight());
}
}
Comparer,
ChangeInfo| Constructor and Description |
|---|
Rectangle()
Initializes a new instance of the Rectangle class.
|
Rectangle(double x,
double y,
double width,
double height)
Creates a new instance of the Rectangle class with the specified x, y, width, and height.
|
Rectangle(Rectangle other)
Creates a new Rectangle object that is a copy of the specified rectangle.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
double |
getHeight()
Gets the height of the rectangle.
|
double |
getWidth()
Gets the width of the rectangle.
|
double |
getX()
Gets the x-coordinate of the top-left corner of the rectangle.
|
double |
getY()
Gets the y-coordinate of the top-left corner of the rectangle.
|
int |
hashCode() |
void |
setHeight(double value)
Sets the height of the rectangle.
|
void |
setWidth(double value)
Sets the width of the rectangle.
|
void |
setX(double value)
Sets the x-coordinate of the top-left corner of the rectangle.
|
void |
setY(double value)
Sets the y-coordinate of the top-left corner of the rectangle.
|
String |
toString() |
public Rectangle()
Initializes a new instance of the Rectangle class.
public Rectangle(double x,
double y,
double width,
double height)
Creates a new instance of the Rectangle class with the specified x, y, width, and height.
x - The x-coordinate of the top-left corner of the rectangley - The y-coordinate of the top-left corner of the rectanglewidth - The width of the rectangleheight - The height of the rectanglepublic Rectangle(Rectangle other)
Creates a new Rectangle object that is a copy of the specified rectangle.
other - The rectangle to be copiedNullPointerException - if the specified rectangle is nullpublic double getHeight()
Gets the height of the rectangle.
public double getWidth()
Gets the width of the rectangle.
public double getX()
Gets the x-coordinate of the top-left corner of the rectangle.
public double getY()
Gets the y-coordinate of the top-left corner of the rectangle.
public void setHeight(double value)
Sets the height of the rectangle.
value - The height of the rectanglepublic void setWidth(double value)
Sets the width of the rectangle.
value - The width of the rectanglepublic void setX(double value)
Sets the x-coordinate of the top-left corner of the rectangle.
value - The x-coordinate of the top-left corner of the rectanglepublic void setY(double value)
Sets the y-coordinate of the top-left corner of the rectangle.
value - The y-coordinate of the top-left corner of the rectangleCopyright © 2024. All rights reserved.