Class Border

  • All Implemented Interfaces:
    java.awt.Shape, java.io.Serializable

    public class Border
    extends java.awt.Polygon
    Class for polygons which have a method to check for lines intersecting with border
    Author:
    Klara Schöbel
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class java.awt.Polygon

        bounds, npoints, xpoints, ypoints
    • Constructor Summary

      Constructors 
      Constructor Description
      Border​(int[] xCoords, int[] yCoords, int numPoints, java.lang.String points)
      constructs a new polygon with x-, y- coordinates and the number of points
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getPoints()
      getter for points
      boolean intersects​(java.awt.geom.Line2D line)
      tests if a line intersects with polygon
      boolean intersects​(java.awt.geom.Point2D point)
      Tests if a point intersects the border's polygon
      • Methods inherited from class java.awt.Polygon

        addPoint, contains, contains, contains, contains, contains, contains, getBoundingBox, getBounds, getBounds2D, getPathIterator, getPathIterator, inside, intersects, intersects, invalidate, reset, translate
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Border

        public Border​(int[] xCoords,
                      int[] yCoords,
                      int numPoints,
                      java.lang.String points)
        constructs a new polygon with x-, y- coordinates and the number of points
        Parameters:
        xCoords - array of x coordinates
        yCoords - array of y coordinates
        numPoints - number of points in polygon
        points - space separated list of comma separated coordinates
    • Method Detail

      • intersects

        public boolean intersects​(java.awt.geom.Line2D line)
        tests if a line intersects with polygon
        Parameters:
        line - to be tested for intersecting with polygon
        Returns:
        if the line intersects with the borders of this polygon
      • intersects

        public boolean intersects​(java.awt.geom.Point2D point)
        Tests if a point intersects the border's polygon
        Parameters:
        point - to be tested for intersecting with polygon
        Returns:
        if the line intersects with the borders of this polygon
      • getPoints

        public java.lang.String getPoints()
        getter for points
        Returns:
        a space separated list of comma separated coordinates