package net.afterlifelochie.fontbox.api.layout;

import net.afterlifelochie.fontbox.api.formatting.layout.FloatMode;

public class ObjectBounds {
    public int x, y;
    public int width, height;
    public FloatMode floating;

    public ObjectBounds(int x, int y, int width, int height, FloatMode floating) {
        this.x = x;
        this.y = y;
        this.width = width;
        this.height = height;
        this.floating = floating;
    }

    public boolean floating() {
        return floating != FloatMode.NONE;
    }

    public FloatMode floatMode() {
        return floating;
    }

    public boolean intersects(ObjectBounds that) {
        boolean flag0 = (x < that.x + that.width && x + width > that.x);
        boolean flag1 = (y < that.y + that.height && y + height > that.y);
        return flag0 && flag1;
    }

    public boolean encloses(int x, int y) {
        boolean flag0 = (this.x <= x && this.x + width >= x);
        boolean flag1 = (this.y <= y && this.y + height >= y);
        return flag0 && flag1;
    }

    @Override
    public String toString() {
        return "[" + x + ", " + y + "] => [" + width + " x " + height + "]";
    }

    public boolean inside(ObjectBounds bounds) {
        return bounds.encloses(x, y) && bounds.encloses(x + width, y + height);
    }
}

@@ -111,16 +111,59 @@
 tMode;%0A%0A
+/**%0A * Defines the bounds of an object%0A */%0A
 public c
@@ -189,24 +189,30 @@
 %0A    public 
+final 
 int x, y;%0A  
@@ -220,16 +220,22 @@
  public 
+final 
 int widt
@@ -248,32 +248,38 @@
 ght;%0A    public 
+final 
 FloatMode floati
@@ -513,152 +513,435 @@
     
-public boolean floating() %7B%0A        return floating != FloatMode.NONE;%0A    %7D%0A%0A    public FloatMode floatMode() %7B%0A   
+/**%0A     * An object is floating when %7B@link #floating%7D is not equal to %7B@link FloatMode#NONE%7D%0A     *%0A     * @return whether the object is floating or not%0A     */%0A    public boolean floating() %7B%0A        return floating != FloatMode.NONE;%0A    %7D%0A%0A    /**%0A     * Check if this object intersects with that object%0A     *%0A     * @param that the object to check intersection with%0A
      
+* @
 return 
-floating;
+true when the objects intersect
 %0A    
-%7D%0A
+ */
 %0A   
@@ -996,31 +996,22 @@
         
-boolean flag0 =
+return
  (x %3C th
@@ -1050,17 +1050,16 @@
  that.x)
-;
 %0A       
@@ -1059,31 +1059,22 @@
         
-boolean flag1 =
+    &&
  (y %3C th
@@ -1125,41 +1125,208 @@
     
+%7D%0A%0A
     
-return flag0 && flag1;
+/**%0A     * Check if this object encloses a point%0A     *%0A     * @param x x coord of the point%0A     * @param y y coord of the point%0A     * @return true when the objects encloses the point
 %0A    
-%7D%0A
+ */
 %0A   
@@ -1378,23 +1378,14 @@
     
-boolean flag0 =
+return
  (th
@@ -1417,17 +1417,16 @@
 th %3E= x)
-;
 %0A       
@@ -1430,23 +1430,14 @@
     
-boolean flag1 =
+    &&
  (th
@@ -1476,39 +1476,8 @@
 y);%0A
-        return flag0 && flag1;%0A
     
@@ -1604,24 +1604,210 @@
 %22%5D%22;%0A    %7D%0A%0A
+    /**%0A     * Check if this object is inside the given bounds%0A     *%0A     * @param bounds bounds to be inside of%0A     * @return true when this object is inside the given bounds%0A     */%0A
     public b

document ObjectBounds