Gridarta Editor
net.sf.gridarta.model.maplocation.MapLocation Class Reference

Represents a location on a map consisting of a map path and a map coordinate. More...

+ Inheritance diagram for net.sf.gridarta.model.maplocation.MapLocation:
+ Collaboration diagram for net.sf.gridarta.model.maplocation.MapLocation:

Public Member Functions

int compareTo (@NotNull final MapLocation o)
 
boolean equals (@Nullable final Object obj)
 
Point getMapCoordinate ()
 Returns the map coordinate. More...
 
MapPath getMapPath ()
 Returns the map path. More...
 
int hashCode ()
 
 MapLocation (@NotNull final BaseObject<?, ?, ?, ?> gameObject, final boolean allowRandomMapParameters) throws NoExitPathException
 Creates a new instance from a BaseObject instance. More...
 
String toString ()
 

Static Public Member Functions

static MapPath getMapPath (@NotNull final BaseObject<?, ?, ?, ?> gameObject, final boolean allowRandomMapParameters) throws NoExitPathException
 Returns the exit map path of a BaseObject. More...
 
static MapLocation newAbsoluteMapLocation (@NotNull final GameObject<?, ?, ?> gameObject, final boolean allowRandomMapParameters) throws NoExitPathException
 Creates a new instance from a BaseObject instance. More...
 

Private Member Functions

 MapLocation (@NotNull final MapPath mapPath, final int mapXCoordinate, final int mapYCoordinate)
 Creates a new instance. More...
 

Static Private Member Functions

static int getMapX (@NotNull final Attributes gameObject)
 Returns the exit y coordinate of a BaseObject. More...
 
static int getMapY (@NotNull final Attributes gameObject)
 Returns the exit x coordinate of a BaseObject. More...
 
static String getRandomMapParameter (@NotNull final BaseObject<?, ?, ?, ?> gameObject, @NotNull final String parameterName)
 Extracts a parameter value for an exit to a random map. More...
 

Private Attributes

final Point mapCoordinate
 The map coordinate. More...
 
final MapPath mapPath
 The map path. More...
 

Static Private Attributes

static final Pattern PATTERN_END_OF_LINE = Pattern.compile("[\r\n]+")
 The Pattern that matches end of lines in random map parameters. More...
 

Detailed Description

Represents a location on a map consisting of a map path and a map coordinate.

Author
Andreas Kirschbaum

Definition at line 42 of file MapLocation.java.

Constructor & Destructor Documentation

◆ MapLocation() [1/2]

net.sf.gridarta.model.maplocation.MapLocation.MapLocation ( @NotNull final MapPath  mapPath,
final int  mapXCoordinate,
final int  mapYCoordinate 
)
private

Creates a new instance.

Parameters
mapPaththe map path
mapXCoordinatethe map x-coordinate
mapYCoordinatethe map y-coordinate

Definition at line 68 of file MapLocation.java.

References net.sf.gridarta.model.maplocation.MapLocation.mapPath.

Referenced by net.sf.gridarta.model.maplocation.MapLocation.equals(), and net.sf.gridarta.model.maplocation.MapLocation.newAbsoluteMapLocation().

+ Here is the caller graph for this function:

◆ MapLocation() [2/2]

net.sf.gridarta.model.maplocation.MapLocation.MapLocation ( @NotNull final BaseObject<?, ?, ?, ?>  gameObject,
final boolean  allowRandomMapParameters 
) throws NoExitPathException

Creates a new instance from a BaseObject instance.

Parameters
gameObjectthe game object
allowRandomMapParameterswhether random map parameters should be considered
Exceptions
NoExitPathExceptionif the game object is not a valid exit

Definition at line 80 of file MapLocation.java.

References net.sf.gridarta.model.maplocation.MapLocation.getMapPath(), net.sf.gridarta.model.maplocation.MapLocation.getMapX(), and net.sf.gridarta.model.maplocation.MapLocation.getMapY().

+ Here is the call graph for this function:

Member Function Documentation

◆ compareTo()

int net.sf.gridarta.model.maplocation.MapLocation.compareTo ( @NotNull final MapLocation  o)

Definition at line 226 of file MapLocation.java.

Referenced by net.sf.gridarta.gui.dialog.goexit.MapListCellRenderer.compare().

+ Here is the caller graph for this function:

◆ equals()

boolean net.sf.gridarta.model.maplocation.MapLocation.equals ( @Nullable final Object  obj)

◆ getMapCoordinate()

Point net.sf.gridarta.model.maplocation.MapLocation.getMapCoordinate ( )

Returns the map coordinate.

Returns
the map coordinate

Definition at line 129 of file MapLocation.java.

Referenced by net.sf.gridarta.gui.map.mapactions.EnterMap< G, A, R >.enterExit(), and net.sf.gridarta.gui.dialog.goexit.MapListCellRenderer.getListCellRendererComponent().

+ Here is the caller graph for this function:

◆ getMapPath() [1/2]

◆ getMapPath() [2/2]

static MapPath net.sf.gridarta.model.maplocation.MapLocation.getMapPath ( @NotNull final BaseObject<?, ?, ?, ?>  gameObject,
final boolean  allowRandomMapParameters 
) throws NoExitPathException
static

Returns the exit map path of a BaseObject.

Parameters
gameObjectthe game object
allowRandomMapParameterswhether random maps should be considered
Returns
the exit map path
Exceptions
NoExitPathExceptionif the game object is not a valid exit

Definition at line 176 of file MapLocation.java.

References net.sf.gridarta.model.maplocation.MapLocation.getRandomMapParameter(), net.sf.gridarta.model.mapmodel.MapPathUtils.newMapPath(), and net.sf.gridarta.model.baseobject.BaseObject< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R, T extends BaseObject< G, A, R, T >.SLAYING.

+ Here is the call graph for this function:

◆ getMapX()

static int net.sf.gridarta.model.maplocation.MapLocation.getMapX ( @NotNull final Attributes  gameObject)
staticprivate

◆ getMapY()

static int net.sf.gridarta.model.maplocation.MapLocation.getMapY ( @NotNull final Attributes  gameObject)
staticprivate

◆ getRandomMapParameter()

static String net.sf.gridarta.model.maplocation.MapLocation.getRandomMapParameter ( @NotNull final BaseObject<?, ?, ?, ?>  gameObject,
@NotNull final String  parameterName 
)
staticprivate

Extracts a parameter value for an exit to a random map.

Parameters
gameObjectthe exit object containing the parameters
parameterNamethe parameter name to use
Returns
the value of the given parameter name, or
null
if the parameter does not exist

Definition at line 201 of file MapLocation.java.

References net.sf.gridarta.utils.StringUtils.PATTERN_SPACES.

Referenced by net.sf.gridarta.model.maplocation.MapLocation.getMapPath().

+ Here is the caller graph for this function:

◆ hashCode()

int net.sf.gridarta.model.maplocation.MapLocation.hashCode ( )

Definition at line 146 of file MapLocation.java.

◆ newAbsoluteMapLocation()

static MapLocation net.sf.gridarta.model.maplocation.MapLocation.newAbsoluteMapLocation ( @NotNull final GameObject<?, ?, ?>  gameObject,
final boolean  allowRandomMapParameters 
) throws NoExitPathException
static

Creates a new instance from a BaseObject instance.

The new

instance includes an absolute map path.

Parameters
gameObjectthe game object
allowRandomMapParameterswhether random map parameters should be considered
Returns
the new map location instance
Exceptions
NoExitPathExceptionif the game object is not a valid exit

Definition at line 94 of file MapLocation.java.

References net.sf.gridarta.model.mapmodel.MapPathUtils.append(), net.sf.gridarta.model.mapmodel.MapModel< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getMapFile(), net.sf.gridarta.model.mapmodel.MapSquare< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getMapModel(), net.sf.gridarta.model.mapmodel.MapFile.getMapPath(), net.sf.gridarta.model.maplocation.MapLocation.getMapPath(), net.sf.gridarta.model.mapmodel.MapSquare< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getMapSquare(), net.sf.gridarta.model.maplocation.MapLocation.getMapX(), net.sf.gridarta.model.maplocation.MapLocation.getMapY(), and net.sf.gridarta.model.maplocation.MapLocation.MapLocation().

Referenced by net.sf.gridarta.gui.dialog.goexit.MapListCellRenderer.getMapLocation(), and net.sf.gridarta.gui.dialog.goexit.GoExitDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.showDialog().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toString()

String net.sf.gridarta.model.maplocation.MapLocation.toString ( )

Member Data Documentation

◆ mapCoordinate

final Point net.sf.gridarta.model.maplocation.MapLocation.mapCoordinate
private

The map coordinate.

Definition at line 60 of file MapLocation.java.

Referenced by net.sf.gridarta.model.maplocation.MapLocation.equals().

◆ mapPath

◆ PATTERN_END_OF_LINE

final Pattern net.sf.gridarta.model.maplocation.MapLocation.PATTERN_END_OF_LINE = Pattern.compile("[\r\n]+")
staticprivate

The Pattern that matches end of lines in random map parameters.

Definition at line 48 of file MapLocation.java.


The documentation for this class was generated from the following file: