Class MapLocation

  • All Implemented Interfaces:
    java.lang.Comparable<MapLocation>

    public class MapLocation
    extends java.lang.Object
    implements java.lang.Comparable<MapLocation>
    Represents a location on a map consisting of a map path and a map coordinate.
    • Constructor Detail

      • MapLocation

        public MapLocation​(@NotNull
                           @NotNull GameObject<?,​?,​?> gameObject,
                           boolean allowRandomMapParameters)
                    throws NoExitPathException
        Creates a new instance from a BaseObject instance.
        Parameters:
        gameObject - the game object
        allowRandomMapParameters - whether random map parameters should be considered
        Throws:
        NoExitPathException - if the game object is not a valid exit
    • Method Detail

      • newAbsoluteMapLocation

        @NotNull
        public static @NotNull MapLocation newAbsoluteMapLocation​(@NotNull
                                                                  @NotNull GameObject<?,​?,​?> gameObject,
                                                                  boolean allowRandomMapParameters)
                                                           throws NoExitPathException
        Creates a new instance from a BaseObject instance. The new MapLocation instance includes an absolute map path.
        Parameters:
        gameObject - the game object
        allowRandomMapParameters - whether random map parameters should be considered
        Returns:
        the new map location instance
        Throws:
        NoExitPathException - if the game object is not a valid exit
      • getMapPath

        @NotNull
        public @NotNull MapPath getMapPath()
        Returns the map path.
        Returns:
        the map path
      • getMapCoordinate

        @NotNull
        public @NotNull java.awt.Point getMapCoordinate()
        Returns the map coordinate.
        Returns:
        the map coordinate
      • equals

        public boolean equals​(@Nullable
                              @Nullable java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

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

        @NotNull
        public static @NotNull MapPath getMapPath​(@NotNull
                                                  @NotNull GameObject<?,​?,​?> gameObject,
                                                  boolean allowRandomMapParameters)
                                           throws NoExitPathException
        Returns the exit map path of a BaseObject.
        Parameters:
        gameObject - the game object
        allowRandomMapParameters - whether random maps should be considered
        Returns:
        the exit map path
        Throws:
        NoExitPathException - if the game object is not a valid exit
      • toString

        @NotNull
        public @NotNull java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • compareTo

        public int compareTo​(@NotNull
                             @NotNull MapLocation o)
        Specified by:
        compareTo in interface java.lang.Comparable<MapLocation>