Package net.sf.gridarta.model.undo
Class UndoState<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
- java.lang.Object
-
- net.sf.gridarta.model.undo.UndoState<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.ObjectHolds 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.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AgetMapArchObject()Returns the map arch object before the operation started.@NotNull java.lang.StringgetName()Return the name of the operation.@NotNull SavedSquares<G,A,R>getSavedSquares()Returns the map squares that have changed in the operation.voidsetSavedSquares(@NotNull SavedSquares<G,A,R> savedSquares)Records the affected map squares.
-
-
-
Constructor Detail
-
UndoState
public UndoState(@NotNull @NotNull java.lang.String name, @NotNull A mapArchObject)Creates a new instance.- Parameters:
name- the name of the operationmapArchObject- 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
-
-