Rectangle

Inheritance: java.lang.Object

public final class Rectangle

The Rectangle class represents changed area on a document.

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

Constructors

Constructor Description
Rectangle() Initializes a new instance of the Rectangle class.
Rectangle(Rectangle other) Creates a new Rectangle object that is a copy of the specified rectangle.
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.

Methods

Method Description
getHeight() Gets the height of the rectangle.
setHeight(double value) Sets the height of the rectangle.
getWidth() Gets the width of the rectangle.
setWidth(double value) Sets the width of the rectangle.
getX() Gets the x-coordinate of the top-left corner of the rectangle.
setX(double value) Sets the x-coordinate of the top-left corner of the rectangle.
getY() Gets the y-coordinate of the top-left corner of the rectangle.
setY(double value) Sets the y-coordinate of the top-left corner of the rectangle.
equals(Object o) {@inheritDoc}
hashCode() {@inheritDoc}
toString() {@inheritDoc}

Rectangle()

public Rectangle()

Initializes a new instance of the Rectangle class.

Rectangle(Rectangle other)

public Rectangle(Rectangle other)

Creates a new Rectangle object that is a copy of the specified rectangle.

Parameters:

Parameter Type Description
other Rectangle The rectangle to be copied

Rectangle(double x, double y, double width, double height)

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.

Parameters:

Parameter Type Description
x double The x-coordinate of the top-left corner of the rectangle
y double The y-coordinate of the top-left corner of the rectangle
width double The width of the rectangle
height double The height of the rectangle

getHeight()

public double getHeight()

Gets the height of the rectangle.

Returns: double - the height of the rectangle

setHeight(double value)

public void setHeight(double value)

Sets the height of the rectangle.

Parameters:

Parameter Type Description
value double The height of the rectangle

getWidth()

public double getWidth()

Gets the width of the rectangle.

Returns: double - the width of the rectangle

setWidth(double value)

public void setWidth(double value)

Sets the width of the rectangle.

Parameters:

Parameter Type Description
value double The width of the rectangle

getX()

public double getX()

Gets the x-coordinate of the top-left corner of the rectangle.

Returns: double - the x-coordinate of the top-left corner of the rectangle

setX(double value)

public void setX(double value)

Sets the x-coordinate of the top-left corner of the rectangle.

Parameters:

Parameter Type Description
value double The x-coordinate of the top-left corner of the rectangle

getY()

public double getY()

Gets the y-coordinate of the top-left corner of the rectangle.

Returns: double - the y-coordinate of the top-left corner of the rectangle

setY(double value)

public void setY(double value)

Sets the y-coordinate of the top-left corner of the rectangle.

Parameters:

Parameter Type Description
value double The y-coordinate of the top-left corner of the rectangle

equals(Object o)

public boolean equals(Object o)

Parameters:

Parameter Type Description
o java.lang.Object

Returns: boolean

hashCode()

public int hashCode()

Returns: int

toString()

public String toString()

Returns: java.lang.String