Interface RectangleImmutable

    • Method Detail

      • getHeight

        int getHeight()
      • getWidth

        int getWidth()
      • getX

        int getX()
        x-position, left of rectangle.
      • getY

        int getY()
        y-position, top of rectangle.
      • union

        Rectangle union​(int rx1,
                        int ry1,
                        int rx2,
                        int ry2)
        Returns a new Rectangle instance containing the union of this rectangle and the given coordinates.
      • union

        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

        Rectangle intersection​(int rx1,
                               int ry1,
                               int rx2,
                               int ry2)
        Returns a new Rectangle instance containing the intersection of this rectangle and the given coordinates.
      • coverage

        float coverage​(RectangleImmutable r)
        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 ) ;
         

      • equals

        boolean equals​(Object obj)
        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.
        Overrides:
        equals in class Object
        Returns:
        true if the two rectangles are equal; otherwise false.