Class EresseaMapMetric.EBBox

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int maxx
      The dimensions of the box
      protected int maxy
      The dimensions of the box
      protected int minx
      The dimensions of the box
      protected int miny
      The dimensions of the box
    • Constructor Summary

      Constructors 
      Constructor Description
      EBBox​(int fxy, int dxy, int fyx, int dyx)
      A coordinate is in this box if (x+fxy*y/dxy, y+fyx*x/dxy) is in (minx, miny) / (maxx, maxy).
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean above​(CoordinateID newC)
      Returns true if the coordinate is above the box.
      void adjust​(int x, int y)
      Enlarge the box to contain the point (x,y) if necessary.
      void adjust​(CoordinateID c)
      Enlarge the box to contain c if necessary.
      boolean equals​(java.lang.Object obj)  
      int getMaxx()
      Returns the value of maxx.
      int getMaxy()
      Returns the value of maxy.
      int getMinx()
      Returns the value of minx.
      int getMiny()
      Returns the value of miny.
      int hashCode()  
      boolean isInside​(CoordinateID newC)
      Returns true if the coordinate is inside the box.
      boolean isOnBorder​(CoordinateID c)
      Returns true if the coordinate is on the border of the Box, i.e., if an adjacent coordinate is not in the box.
      boolean leftOf​(CoordinateID newC)
      Returns true if the coordinate is left of the box.
      CoordinateID putInBox​(CoordinateID c)
      Shifts the coordinate by the box's dimension (x- and y- separately) until it is inside and returns the result.
      CoordinateID putInBoxX​(CoordinateID c)
      Shifts the x-coordinate into the box's width until it is inside and returns the result.
      CoordinateID putInBoxY​(CoordinateID c)
      Shifts the y-coordinate by the box's height until it is inside and returns the result.
      boolean rightOf​(CoordinateID newC)
      Returns true if the coordinate is right of the box.
      void setX​(int newmin, int newmax)
      Changes the box's x-dimensions.
      void setY​(int newmin, int newmax)
      Changes the box's y-dimensions.
      java.lang.String toString()  
      boolean under​(CoordinateID newC)
      Returns true if the coordinate is under the box.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • minx

        protected int minx
        The dimensions of the box
      • maxx

        protected int maxx
        The dimensions of the box
      • miny

        protected int miny
        The dimensions of the box
      • maxy

        protected int maxy
        The dimensions of the box
    • Constructor Detail

      • EBBox

        public EBBox​(int fxy,
                     int dxy,
                     int fyx,
                     int dyx)
        A coordinate is in this box if (x+fxy*y/dxy, y+fyx*x/dxy) is in (minx, miny) / (maxx, maxy). This results in nicer "rectangular" boxes instead of the "trapezoid" boxes if we just compared (x,y) with (minx, miny) / (maxx, maxy) in a hexagonal map.
    • Method Detail

      • getMinx

        public final int getMinx()
        Returns the value of minx.
        Specified by:
        getMinx in interface BoxTransformer.BBox
        Returns:
        Returns minx.
      • getMaxx

        public final int getMaxx()
        Returns the value of maxx.
        Specified by:
        getMaxx in interface BoxTransformer.BBox
        Returns:
        Returns maxx.
      • getMiny

        public final int getMiny()
        Returns the value of miny.
        Specified by:
        getMiny in interface BoxTransformer.BBox
        Returns:
        Returns miny.
      • getMaxy

        public final int getMaxy()
        Returns the value of maxy.
        Specified by:
        getMaxy in interface BoxTransformer.BBox
        Returns:
        Returns maxy.
      • setX

        public final void setX​(int newmin,
                               int newmax)
        Changes the box's x-dimensions.
        Specified by:
        setX in interface BoxTransformer.BBox
      • setY

        public final void setY​(int newmin,
                               int newmax)
        Changes the box's y-dimensions.
        Specified by:
        setY in interface BoxTransformer.BBox
      • adjust

        public final void adjust​(CoordinateID c)
        Enlarge the box to contain c if necessary.
      • adjust

        public final void adjust​(int x,
                                 int y)
        Enlarge the box to contain the point (x,y) if necessary.
      • putInBoxX

        public final CoordinateID putInBoxX​(CoordinateID c)
        Shifts the x-coordinate into the box's width until it is inside and returns the result.
      • putInBoxY

        public final CoordinateID putInBoxY​(CoordinateID c)
        Shifts the y-coordinate by the box's height until it is inside and returns the result.
      • equals

        public final boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

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

        public final int hashCode()
        Overrides:
        hashCode in class java.lang.Object