Class GraphStatistics.BoundingBox

  • Enclosing class:
    GraphStatistics

    public static class GraphStatistics.BoundingBox
    extends java.lang.Object
    Class representing a bounding box for a graph (a rectangle that contains all nodes in the graph).
    • Constructor Detail

      • BoundingBox

        public BoundingBox​(Point topLeft,
                           Point bottomRight)
        Create a new BoundingBox represented by the given top-left and bottom-right points.
        Parameters:
        topLeft - Top left corner of the bounding box.
        bottomRight - Bottom right corner of the bounding box.
    • Method Detail

      • getBottomRightPoint

        public Point getBottomRightPoint()
        Returns:
        Bottom-right point of this bounding box.
      • getTopLeftPoint

        public Point getTopLeftPoint()
        Returns:
        Top-left point of this bounding box.
      • extend

        public GraphStatistics.BoundingBox extend​(float left,
                                                  float top,
                                                  float right,
                                                  float bottom)
        Create a new bounding box by extending the current one according to the given value for each side.
        Parameters:
        left - Extra size to add to the left of the box.
        top - Extra size to add to the top of the box.
        right - Extra size to add to the right of the box.
        bottom - Extra size to add to the bottom of the box.
        Returns:
        New bounding box corresponding to an extension of the current one.
      • extend

        public GraphStatistics.BoundingBox extend​(float size)
        Create a new bounding box by extending the current one according by the given value on each side.
        Parameters:
        size - Extra size to add to each side of this box.
        Returns:
        New bounding box corresponding to an extension of the current one.
      • contains

        public boolean contains​(Point point)
        Parameters:
        point - Point to check
        Returns:
        true if this box contains the given point.
      • contains

        public boolean contains​(GraphStatistics.BoundingBox other)
        Parameters:
        other - Box to intersect.
        Returns:
        true if this box contains the given box.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object