Class CheckerPolygon

java.lang.Object
com.luchersol.core.util.AbstractChecker<Polygon,CheckerPolygon>
com.luchersol.core.specialized_checkers.math.CheckerPolygon
All Implemented Interfaces:
InterfaceChecker<AbstractChecker<Polygon,CheckerPolygon>,Polygon>

public class CheckerPolygon extends AbstractChecker<Polygon,CheckerPolygon>
A specialized checker for Polygon instances, providing fluent API methods to assert properties of 2D polygonal shapes.

Typical usage:


 int[] xpoints = {0, 50, 100};
 int[] ypoints = {0, 100, 0};

 CheckerPolygon checker = CheckerPolygon.check(xpoints, ypoints, 3)
     // future validations can be chained here
     .self();
 

This class supports multiple factory methods to create a checker directly from a Polygon instance or from arrays of coordinates, making it flexible for geometric validations in a fluent and readable style.

See Also:
  • Constructor Details

    • CheckerPolygon

      protected CheckerPolygon(Polygon polygon, String name)
      Constructs a new CheckerPolygon with the specified polygon and name.
      Parameters:
      polygon - the Polygon to be used by this checker
      name - the name identifying this checker
  • Method Details

    • check

      public static CheckerPolygon check(Polygon polygon, String name)
      Creates a new CheckerPolygon for the given Polygon instance with a custom name.
      Parameters:
      polygon - the Polygon instance to be checked
      name - the name to identify this checker instance (useful for error messages)
      Returns:
      a new CheckerPolygon for the provided Polygon
    • check

      public static CheckerPolygon check(int[] xpoints, int[] ypoints, int npoints, String name)
      Creates a new CheckerPolygon for the given Polygon from the specified parameters with a custom name.
      Parameters:
      xpoints - an array of X coordinates
      ypoints - an array of Y coordinates
      npoints - the total number of points in the Polygon
      name - the name to identify this checker instance (useful for error messages)
      Returns:
      a new CheckerPolygon for the provided Polygon
    • check

      public static CheckerPolygon check(Polygon polygon)
      Creates a new CheckerPolygon for the given Polygon instance with a default name.
      Parameters:
      polygon - the Polygon instance to be checked
      Returns:
      a new CheckerPolygon for the provided Polygon
    • check

      public static CheckerPolygon check(int[] xpoints, int[] ypoints, int npoints)
      Creates a new CheckerPolygon for the given Polygon from the specified parameters.
      Parameters:
      xpoints - an array of X coordinates
      ypoints - an array of Y coordinates
      npoints - the total number of points in the Polygon
      Returns:
      a new CheckerPolygon for the provided Polygon
    • self

      protected CheckerPolygon self()
      Returns this checker instance (for fluent API usage).
      Specified by:
      self in class AbstractChecker<Polygon,CheckerPolygon>
      Returns:
      this CheckerPolygon instance