Class MapLocation
- java.lang.Object
-
- net.sf.gridarta.model.maplocation.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 Summary
Constructors Constructor Description MapLocation(@NotNull GameObject<?,?,?> gameObject, boolean allowRandomMapParameters)Creates a new instance from aBaseObjectinstance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(@NotNull MapLocation o)booleanequals(@Nullable java.lang.Object obj)@NotNull java.awt.PointgetMapCoordinate()Returns the map coordinate.@NotNull MapPathgetMapPath()Returns the map path.static @NotNull MapPathgetMapPath(@NotNull GameObject<?,?,?> gameObject, boolean allowRandomMapParameters)Returns the exit map path of aBaseObject.inthashCode()static @NotNull MapLocationnewAbsoluteMapLocation(@NotNull GameObject<?,?,?> gameObject, boolean allowRandomMapParameters)Creates a new instance from aBaseObjectinstance.@NotNull java.lang.StringtoString()
-
-
-
Constructor Detail
-
MapLocation
public MapLocation(@NotNull @NotNull GameObject<?,?,?> gameObject, boolean allowRandomMapParameters) throws NoExitPathExceptionCreates a new instance from aBaseObjectinstance.- Parameters:
gameObject- the game objectallowRandomMapParameters- 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 aBaseObjectinstance. The newMapLocationinstance includes an absolute map path.- Parameters:
gameObject- the game objectallowRandomMapParameters- 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:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getMapPath
@NotNull public static @NotNull MapPath getMapPath(@NotNull @NotNull GameObject<?,?,?> gameObject, boolean allowRandomMapParameters) throws NoExitPathException
Returns the exit map path of aBaseObject.- Parameters:
gameObject- the game objectallowRandomMapParameters- 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:
toStringin classjava.lang.Object
-
compareTo
public int compareTo(@NotNull @NotNull MapLocation o)- Specified by:
compareToin interfacejava.lang.Comparable<MapLocation>
-
-