Class UndoState<G extends GameObject<G,​A,​R>,​A extends MapArchObject<A>,​R extends Archetype<G,​A,​R>>


  • public class UndoState<G extends GameObject<G,​A,​R>,​A extends MapArchObject<A>,​R extends Archetype<G,​A,​R>>
    extends java.lang.Object
    Holds information to undo/redo one edit operation. It consists of the map model state, the map arch object state, and the name of the edit operation.
    • Constructor Summary

      Constructors 
      Constructor Description
      UndoState​(@NotNull java.lang.String name, A mapArchObject)
      Creates a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      A getMapArchObject()
      Returns the map arch object before the operation started.
      @NotNull java.lang.String getName()
      Return the name of the operation.
      @NotNull SavedSquares<G,​A,​R> getSavedSquares()
      Returns the map squares that have changed in the operation.
      void setSavedSquares​(@NotNull SavedSquares<G,​A,​R> savedSquares)
      Records the affected map squares.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • UndoState

        public UndoState​(@NotNull
                         @NotNull java.lang.String name,
                         @NotNull
                         A mapArchObject)
        Creates a new instance.
        Parameters:
        name - the name of the operation
        mapArchObject - the map arch object to store; the value is not copied
    • Method Detail

      • getName

        @NotNull
        public @NotNull java.lang.String getName()
        Return the name of the operation.
        Returns:
        the name of the operation
      • setSavedSquares

        public void setSavedSquares​(@NotNull
                                    @NotNull SavedSquares<G,​A,​R> savedSquares)
        Records the affected map squares.
        Parameters:
        savedSquares - the map squares to record
        Throws:
        java.lang.IllegalStateException - if changed map squares have been recorded before
      • getSavedSquares

        @NotNull
        public @NotNull SavedSquares<G,​A,​R> getSavedSquares()
        Returns the map squares that have changed in the operation.
        Returns:
        the changed map squares
        Throws:
        java.lang.IllegalStateException - if no saved squares have been recorded
      • getMapArchObject

        @NotNull
        public A getMapArchObject()
        Returns the map arch object before the operation started.
        Returns:
        the map arch object