Interface MapArchObject<A extends MapArchObject<A>>

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method 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.
      A createClone()
      Creates a copy of this object.
      void endTransaction()
      Ends a transaction.
      void endTransaction​(boolean fireEvent)
      Ends a transaction.
      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.
      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.
      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.
    • Method Detail

      • setState

        void setState​(@NotNull
                      A mapArchObject)
        Resets the state of this object to the state of the given map arch object.
        Parameters:
        mapArchObject - the map arch object to copy the state from
      • setMapSize

        void setMapSize​(@NotNull
                        @NotNull Size2D mapSize)
        Sets the map size.
        Parameters:
        mapSize - the new map size
        XXX:
        this does not change the size of the underlying MapModel. We eventually should change that so a map size isn't stored twice.
      • getMapSize

        @NotNull
        @NotNull Size2D getMapSize()
        Returns the map size.
        Returns:
        size of the map reflected by this MapArchObject
      • getMapName

        @NotNull
        @NotNull java.lang.String getMapName()
        Returns the map name.
        Returns:
        the map name
      • setMapName

        void setMapName​(@NotNull
                        @NotNull java.lang.String name)
        Sets the map name.
        Parameters:
        name - the new map name
      • getEnterX

        int getEnterX()
        Returns the enter x coordinate.
        Returns:
        the enter x coordinate
      • setEnterX

        void setEnterX​(int enterX)
        Sets the enter x coordinate.
        Parameters:
        enterX - the new enter x coordinate
      • getEnterY

        int getEnterY()
        Returns the enter y coordinate.
        Returns:
        the enter y coordinate
      • setEnterY

        void setEnterY​(int enterY)
        Sets the enter y coordinate.
        Parameters:
        enterY - the new enter y coordinate
      • getEnter

        @NotNull
        @NotNull java.awt.Point getEnter()
        Returns the enter coordinates.
        Returns:
        the enter coordinates
      • isOutdoor

        boolean isOutdoor()
        Returns whether the map is an "outdoor" map.
        Returns:
        whether the map is an "outdoor" map
      • setOutdoor

        void setOutdoor​(boolean outdoor)
        Sets whether the map is an "outdoor" map.
        Parameters:
        outdoor - whether the map is an "outdoor" map
      • getResetTimeout

        int getResetTimeout()
        Returns the reset timeout (in seconds).
        Returns:
        the reset timeout (in seconds)
      • setResetTimeout

        void setResetTimeout​(int resetTimeout)
        Sets the reset timeout (in seconds).
        Parameters:
        resetTimeout - the new reset timeout (in seconds)
      • getSwapTime

        int getSwapTime()
        Returns the swap time (in ticks).
        Returns:
        the swap time (in ticks)
      • setSwapTime

        void setSwapTime​(int swapTime)
        Sets the swap time (in ticks).
        Parameters:
        swapTime - the swap time (in ticks)
      • getDifficulty

        int getDifficulty()
        Returns the map's difficulty.
        Returns:
        the map's difficulty
      • setDifficulty

        void setDifficulty​(int difficulty)
        Sets the map's difficulty.
        Parameters:
        difficulty - the new difficulty for this map
      • isFixedReset

        boolean isFixedReset()
        Returns whether this map uses a fixed reset.
        Returns:
        whether this map uses a fixed reset
      • setFixedReset

        void setFixedReset​(boolean fixedReset)
        Sets whether this map uses a fixed reset.
        Parameters:
        fixedReset - whether this map should use a fixed reset
      • getDarkness

        int getDarkness()
        Returns the light / darkness of this map. (0 means fully bright)
        Returns:
        the light / darkness of this map
      • setDarkness

        void setDarkness​(int darkness)
        Sets the light / darkness of this map.
        Parameters:
        darkness - the new light / darkness of this map
      • getTilePaths

        int getTilePaths()
        Returns the number of tile paths.
        Returns:
        the number of tile paths
      • getTilePath

        @NotNull
        @NotNull java.lang.String getTilePath​(@NotNull
                                              @NotNull Direction direction)
        Returns a tile path.
        Parameters:
        direction - the tile path direction
        Returns:
        the tile path
      • setTilePath

        void setTilePath​(@NotNull
                         @NotNull Direction direction,
                         @NotNull
                         @NotNull java.lang.String tilePath)
        Sets a tile path.
        Parameters:
        direction - the tile path direction
        tilePath - the new tile path
      • calculateTilePath

        @NotNull
        @NotNull java.lang.String calculateTilePath​(@NotNull
                                                    @NotNull Direction direction,
                                                    @Nullable
                                                    @Nullable MapFile mapFile)
        Calculate a single tile path in a particular direction.
        Parameters:
        direction - the direction
        mapFile - map file
        Returns:
        Calculated tile path, empty string on failure.
      • calculateTilePaths

        void calculateTilePaths​(@Nullable
                                @Nullable MapFile mapFile,
                                @NotNull
                                @NotNull java.io.File mapsDirectory)
        Calculates tiled paths for the map automatically.
        Parameters:
        mapFile - map file
        mapsDirectory - maps directory
      • isTilePathAuto

        boolean isTilePathAuto​(@NotNull
                               @NotNull Direction direction,
                               @Nullable
                               @Nullable MapFile mapFile)
        Determines whether a tiled map in the specified direction is automatic tiled path or not.
        Parameters:
        direction - direction of the tiled map
        mapFile - map file
        Returns:
        Whether the tile is automatic.
      • createClone

        @NotNull
        A createClone()
        Creates a copy of this object.
        Returns:
        the newly created clone of this object
      • addMapArchObjectListener

        void addMapArchObjectListener​(@NotNull
                                      @NotNull MapArchObjectListener listener)
        Registers an event listener.
        Parameters:
        listener - the listener to register
      • removeMapArchObjectListener

        void removeMapArchObjectListener​(@NotNull
                                         @NotNull MapArchObjectListener listener)
        Unregisters an event listener.
        Parameters:
        listener - the listener to unregister
      • beginTransaction

        void beginTransaction()
        Starts a new transaction. Transactions may be nested. Transactions serve the purpose of firing events to the views when more changes are known to come before the view is really required to update. Each invocation of this function requires its own invocation of endTransaction().

        Beginning a nested transaction is a cheap operation.

        See Also:
        endTransaction(), endTransaction(boolean)
      • endTransaction

        void endTransaction()
        Ends a transaction. Invoking this method will reduce the transaction depth by only 1.

        Ending 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).

        See Also:
        beginTransaction(), endTransaction(boolean)
      • endTransaction

        void endTransaction​(boolean fireEvent)
        Ends a transaction. Invoking this method will reduce the transaction depth by only 1.

        Ending 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.

        Parameters:
        fireEvent - true if an event should be fired even in case this doesn't end the outermost transaction.
        See Also:
        beginTransaction(), endTransaction()
        Note:
        If the outermost transaction is ended, fireEvent is ignored and the event is always fired., An event is never fired when there were no changes, no matter whether the outermost transaction is ended or fireEvent is set to true., If the event is fired, the internal change list is not cleared.
      • addText

        void addText​(@NotNull
                     @NotNull java.lang.String text)
        Appends 'text' to the map text.
        Parameters:
        text - the string to add
      • setText

        void setText​(java.lang.String text)
        Sets the map text.
        Parameters:
        text - the new map text
      • getText

        @NotNull
        @NotNull java.lang.String getText()
        Returns the message text.
        Returns:
        the message text
      • updateModifiedAttribute

        void updateModifiedAttribute​(@NotNull
                                     @NotNull java.lang.String userName)
        Updates the "Modified:" attribute in the message text.
        Parameters:
        userName - the user name to include
      • isPointValid

        boolean isPointValid​(@Nullable
                             @Nullable java.awt.Point pos)
        Checks whether the given coordinate is within map bounds.
        Parameters:
        pos - the coordinates to check
        Returns:
        true if the given coordinates are on the map, otherwise false (also returns false if pos == null)