Class BuildArea

  • All Implemented Interfaces:
    java.lang.Iterable<CubeCoordinate>

    public class BuildArea
    extends java.lang.Object
    implements java.lang.Iterable<CubeCoordinate>
    The BuildArea describes the area where tiles are placable.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      CubeCoordinate center
      Center of the build area (likely 0)
      int radius
      Max build radius of the build area.
    • Constructor Summary

      Constructors 
      Constructor Description
      BuildArea()
      Creates a empty build area.
    • Field Detail

      • center

        public CubeCoordinate center
        Center of the build area (likely 0)
      • radius

        public int radius
        Max build radius of the build area.
    • Constructor Detail

      • BuildArea

        public BuildArea()
        Creates a empty build area.
    • Method Detail

      • deserialize

        public static BuildArea deserialize​(org.json.JSONObject data)
        deserializes a build area from json
        Parameters:
        data - json data
        Returns:
        deserialized BuildArea
      • getRadius

        public int getRadius()
        The hexagon radius of the build area. The radius defines the Ring (see RingIterator) just outside the build area, centered around centered. Use contains to check if a coordinate is inside the build area.
        Returns:
        radius of the build area
      • getCenter

        public CubeCoordinate getCenter()
        Returns the center of the build area.
        Returns:
        center of the build area
      • contains

        public boolean contains​(CubeCoordinate coord)
        Checks if a coordinate is on the build area.
        Parameters:
        coord - coordinate to check
        Returns:
        whether the coordinate is in the build area
      • toString

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