Package com.j3d.engine.react.actions


package com.j3d.engine.react.actions
Stores all Undo/Redo related classes, labelled as "Actions"

Generally, an Action is any piece of code which can undo itself and redo itself if undone. If an action cannot undo itself to a 1:1 state as it was before then it is usually marked via Action.isReversible().

If a method foo() defines a new Action, it is foo()'s responsibility to add this Action to the History and then after foo() has to explicitly call Action.run(). The History panel does not handle the first invocation of the action. Only it's undo and redo after it has been invoked.

Action Classes invalid input: '&' Interfaces

There are many different interfaces one can implement to encapsulate undoable code, all with different semantics.

  • A generic Action is one that when done, returns a value. This is the base of all Actions.
  • A VoidAction is an Action who only produces side effects. Has the same effect as defining an Action who's <T> value is Void
  • A DirtyAction is an Action, who implements CleanableAction meaning when it is no longer required to live anywhere, it's resources get cleaned up via CleanableAction.cleanup()
  • A DirtyVoidAction is a VoidAction who implements CleanableAction meaning when it is no longer required to live anywhere, it's resources get cleaned up via CleanableAction.cleanup().
  • An AbstractAction is an abstract class implementing VoidAction. This class exists such that concrete implementations of VoidAction can extend it and only override the methods they need, providing default behaviour for undo(), isReversible(), getDescription(), and getTime().
  • A ConstructorAction is an action, which has already been run (via a class' defining constructor). This allows actions to still define a way to undo (and redo) this action even though it has already been executed. This also implements CleanableAction requiring explicit resource cleanup.
Author:
Lehlogonolo Poole
  • Class
    Description
    AbstractAction is an abstract class that implements the Action interface with default behaviors.
    Represents an action that can be executed and undone by either the app or the user affecting the scene.
    An implementation for Actions which provide a clean-up method to be called when the action is deleted from the history.
    A specialisation of a AbstractAction and CleanableAction specifically for a class's constructor.
    An Action where the action returns meaningful output, but also requires clean-up when the action eventually gets deleted from the history.
    An Action where the action is purely side effects but requires clean-up when the action gets deleted.
    An action who does not need to return any meaningful value.