public abstract class AbstractMapArchObject<A extends MapArchObject<A>> extends java.lang.Object implements MapArchObject<A>
MapArchObject that covers similarities between
Crossfire maps and Daimonin maps.hashCode() and equals(Object) work on non-final fields and thus will break any operation
inside Collections!| Modifier and Type | Field and Description |
|---|---|
static @NotNull java.lang.String |
MAP_NAME_UNNAMED
The name of an unnamed map.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractMapArchObject()
Creates a new instance.
|
protected |
AbstractMapArchObject(@NotNull AbstractMapArchObject<A> mapArchObject)
Creates a new instance as a copy of another map arch object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addMapArchObjectListener(@NotNull MapArchObjectListener listener)
Registers an event listener.
|
void |
addText(@NotNull java.lang.String text)
Appends 'text' to the map text.
|
void |
beginTransaction()
Starts a new transaction.
|
@NotNull java.lang.String |
calculateTilePath(@NotNull Direction direction,
@Nullable MapFile mapFile)
Calculate a single tile path in a particular direction.
|
void |
calculateTilePaths(@Nullable MapFile mapFile,
@NotNull java.io.File mapsDirectory)
Calculates tiled paths for the map automatically.
|
void |
endTransaction()
Ends a transaction.
|
void |
endTransaction(boolean fireEvent)
Ends a transaction.
|
boolean |
equals(@Nullable java.lang.Object obj) |
int |
getDarkness()
Returns the light / darkness of this map.
|
int |
getDifficulty()
Returns the map's difficulty.
|
@NotNull java.awt.Point |
getEnter()
Returns the enter coordinates.
|
int |
getEnterX()
Returns the enter x coordinate.
|
int |
getEnterY()
Returns the enter y coordinate.
|
@NotNull java.lang.String |
getMapName()
Returns the map name.
|
@NotNull Size2D |
getMapSize()
Returns the map size.
|
int |
getResetTimeout()
Returns the reset timeout (in seconds).
|
int |
getSwapTime()
Returns the swap time (in ticks).
|
@NotNull java.lang.String |
getText()
Returns the message text.
|
@NotNull java.lang.String |
getTilePath(@NotNull Direction direction)
Returns a tile path.
|
int |
getTilePaths()
Returns the number of tile paths.
|
int |
hashCode() |
boolean |
isFixedReset()
Returns whether this map uses a fixed reset.
|
boolean |
isOutdoor()
Returns whether the map is an "outdoor" map.
|
boolean |
isPointValid(@Nullable java.awt.Point pos)
Checks whether the given coordinate is within map bounds.
|
boolean |
isTilePathAuto(@NotNull Direction direction,
@Nullable MapFile mapFile)
Determines whether a tiled map in the specified direction is automatic
tiled path or not.
|
void |
removeMapArchObjectListener(@NotNull MapArchObjectListener listener)
Unregisters an event listener.
|
void |
setDarkness(int darkness)
Sets the light / darkness of this map.
|
void |
setDifficulty(int difficulty)
Sets the map's difficulty.
|
void |
setEnterX(int enterX)
Sets the enter x coordinate.
|
void |
setEnterY(int enterY)
Sets the enter y coordinate.
|
void |
setFixedReset(boolean fixedReset)
Sets whether this map uses a fixed reset.
|
void |
setMapName(@NotNull java.lang.String name)
Sets the map name.
|
void |
setMapSize(@NotNull Size2D mapSize)
Sets the map size.
|
protected void |
setModified()
Marks this map arch object as changed.
|
void |
setOutdoor(boolean outdoor)
Sets whether the map is an "outdoor" map.
|
void |
setResetTimeout(int resetTimeout)
Sets the reset timeout (in seconds).
|
void |
setState(A mapArchObject)
Resets the state of this object to the state of the given map arch
object.
|
void |
setSwapTime(int swapTime)
Sets the swap time (in ticks).
|
void |
setText(java.lang.String text)
Sets the map text.
|
void |
setTilePath(@NotNull Direction direction,
@NotNull java.lang.String tilePath)
Sets a tile path.
|
void |
updateModifiedAttribute(@NotNull java.lang.String userName)
Updates the "Modified:" attribute in the message text.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitcreateClone@NotNull public static final @NotNull java.lang.String MAP_NAME_UNNAMED
protected AbstractMapArchObject()
protected AbstractMapArchObject(@NotNull
@NotNull AbstractMapArchObject<A> mapArchObject)
mapArchObject - the other map arch object@NotNull public @NotNull Size2D getMapSize()
MapArchObjectgetMapSize in interface MapArchObject<A extends MapArchObject<A>>public void setMapSize(@NotNull
@NotNull Size2D mapSize)
MapArchObjectsetMapSize in interface MapArchObject<A extends MapArchObject<A>>mapSize - the new map size@NotNull public @NotNull java.lang.String getMapName()
MapArchObjectgetMapName in interface MapArchObject<A extends MapArchObject<A>>public void setMapName(@NotNull
@NotNull java.lang.String name)
MapArchObjectsetMapName in interface MapArchObject<A extends MapArchObject<A>>name - the new map namepublic int getEnterX()
MapArchObjectgetEnterX in interface MapArchObject<A extends MapArchObject<A>>public void setEnterX(int enterX)
MapArchObjectsetEnterX in interface MapArchObject<A extends MapArchObject<A>>enterX - the new enter x coordinatepublic int getEnterY()
MapArchObjectgetEnterY in interface MapArchObject<A extends MapArchObject<A>>public void setEnterY(int enterY)
MapArchObjectsetEnterY in interface MapArchObject<A extends MapArchObject<A>>enterY - the new enter y coordinate@NotNull public @NotNull java.awt.Point getEnter()
MapArchObjectgetEnter in interface MapArchObject<A extends MapArchObject<A>>public boolean isOutdoor()
MapArchObjectisOutdoor in interface MapArchObject<A extends MapArchObject<A>>public void setOutdoor(boolean outdoor)
MapArchObjectsetOutdoor in interface MapArchObject<A extends MapArchObject<A>>outdoor - whether the map is an "outdoor" mappublic int getResetTimeout()
MapArchObjectgetResetTimeout in interface MapArchObject<A extends MapArchObject<A>>public void setResetTimeout(int resetTimeout)
MapArchObjectsetResetTimeout in interface MapArchObject<A extends MapArchObject<A>>resetTimeout - the new reset timeout (in seconds)public int getSwapTime()
MapArchObjectgetSwapTime in interface MapArchObject<A extends MapArchObject<A>>public void setSwapTime(int swapTime)
MapArchObjectsetSwapTime in interface MapArchObject<A extends MapArchObject<A>>swapTime - the swap time (in ticks)public int getDifficulty()
MapArchObjectgetDifficulty in interface MapArchObject<A extends MapArchObject<A>>public void setDifficulty(int difficulty)
MapArchObjectsetDifficulty in interface MapArchObject<A extends MapArchObject<A>>difficulty - the new difficulty for this mappublic boolean isFixedReset()
MapArchObjectisFixedReset in interface MapArchObject<A extends MapArchObject<A>>public void setFixedReset(boolean fixedReset)
MapArchObjectsetFixedReset in interface MapArchObject<A extends MapArchObject<A>>fixedReset - whether this map should use a fixed resetpublic int getDarkness()
MapArchObjectgetDarkness in interface MapArchObject<A extends MapArchObject<A>>public void setDarkness(int darkness)
MapArchObjectsetDarkness in interface MapArchObject<A extends MapArchObject<A>>darkness - the new light / darkness of this mappublic int getTilePaths()
MapArchObjectgetTilePaths in interface MapArchObject<A extends MapArchObject<A>>@NotNull
public @NotNull java.lang.String getTilePath(@NotNull
@NotNull Direction direction)
MapArchObjectgetTilePath in interface MapArchObject<A extends MapArchObject<A>>direction - the tile path directionpublic void setTilePath(@NotNull
@NotNull Direction direction,
@NotNull
@NotNull java.lang.String tilePath)
MapArchObjectsetTilePath in interface MapArchObject<A extends MapArchObject<A>>direction - the tile path directiontilePath - the new tile path@NotNull
public @NotNull java.lang.String calculateTilePath(@NotNull
@NotNull Direction direction,
@Nullable
@Nullable MapFile mapFile)
MapArchObjectcalculateTilePath in interface MapArchObject<A extends MapArchObject<A>>direction - the directionmapFile - map filepublic void calculateTilePaths(@Nullable
@Nullable MapFile mapFile,
@NotNull
@NotNull java.io.File mapsDirectory)
MapArchObjectcalculateTilePaths in interface MapArchObject<A extends MapArchObject<A>>mapFile - map filemapsDirectory - maps directorypublic boolean isTilePathAuto(@NotNull
@NotNull Direction direction,
@Nullable
@Nullable MapFile mapFile)
MapArchObjectisTilePathAuto in interface MapArchObject<A extends MapArchObject<A>>direction - direction of the tiled mapmapFile - map filepublic void setState(@NotNull
A mapArchObject)
MapArchObjectsetState in interface MapArchObject<A extends MapArchObject<A>>mapArchObject - the map arch object to copy the state frompublic boolean equals(@Nullable
@Nullable java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic void addMapArchObjectListener(@NotNull
@NotNull MapArchObjectListener listener)
MapArchObjectaddMapArchObjectListener in interface MapArchObject<A extends MapArchObject<A>>listener - the listener to registerpublic void removeMapArchObjectListener(@NotNull
@NotNull MapArchObjectListener listener)
MapArchObjectremoveMapArchObjectListener in interface MapArchObject<A extends MapArchObject<A>>listener - the listener to unregisterprotected void setModified()
public void beginTransaction()
MapArchObjectMapArchObject.endTransaction().
Beginning a nested transaction is a cheap operation.
beginTransaction in interface MapArchObject<A extends MapArchObject<A>>MapArchObject.endTransaction(),
MapArchObject.endTransaction(boolean)public void endTransaction()
MapArchObjectEnding a nested operation is a cheap operation. Ending a transaction without changes also is a cheap operation.
If the last transaction is ended, the changes are committed.
Same as endTransaction(false).
endTransaction in interface MapArchObject<A extends MapArchObject<A>>MapArchObject.beginTransaction(),
MapArchObject.endTransaction(boolean)public void endTransaction(boolean fireEvent)
MapArchObjectEnding a nested operation is a cheap operation. Ending a transaction without changes also is a cheap operation.
If the last transaction is ended, the changes are committed.
An example where setting fireEvent to true is useful even
though the outermost transaction is not ended is when during painting the
UI should be updated though painting is not finished.
endTransaction in interface MapArchObject<A extends MapArchObject<A>>fireEvent - true if an event should be fired even in case
this doesn't end the outermost transaction.MapArchObject.beginTransaction(),
MapArchObject.endTransaction()public void addText(@NotNull
@NotNull java.lang.String text)
MapArchObjectaddText in interface MapArchObject<A extends MapArchObject<A>>text - the string to addpublic void setText(java.lang.String text)
MapArchObjectsetText in interface MapArchObject<A extends MapArchObject<A>>text - the new map text@NotNull public @NotNull java.lang.String getText()
MapArchObjectgetText in interface MapArchObject<A extends MapArchObject<A>>public void updateModifiedAttribute(@NotNull
@NotNull java.lang.String userName)
MapArchObjectupdateModifiedAttribute in interface MapArchObject<A extends MapArchObject<A>>userName - the user name to includepublic boolean isPointValid(@Nullable
@Nullable java.awt.Point pos)
MapArchObjectisPointValid in interface MapArchObject<A extends MapArchObject<A>>pos - the coordinates to checktrue if the given coordinates are on the map, otherwise
false (also returns false if pos == null)