Package com.j3d.engine.react.actions
Interface Action<T>
- Type Parameters:
T- The type of the result returned by the run method.
- All Known Subinterfaces:
DirtyAction<T>,DirtyVoidAction,VoidAction
- All Known Implementing Classes:
AbstractAction,ConstructorAction
public interface Action<T>
Represents an action that can be executed and undone by either the app or the user affecting the scene.
Implementations of the interface provide the logic for executing and undoing the action themselves.
This interface has multiple other versions for return type clarity.
- Author:
- Lehlogonolo Poole
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionProvides a description of the action.default ActionPanelgetPanel()Provides a default implementation for getting anActionPanelassociated with this action.getTime()Returns the time at which the action was performed.booleanChecks if the action is reversible.run()Executes the action.voidundo()Undoes the action.
-
Method Details
-
run
T run()Executes the action.- Returns:
- The result of the action.
-
undo
void undo()Undoes the action. -
isReversible
boolean isReversible()Checks if the action is reversible.- Returns:
- true if the action can be undone, false otherwise.
-
getDescription
String getDescription()Provides a description of the action. This description is printed to both the debug console and the history log (UI).- Returns:
- A string describing the action.
-
getTime
LocalTime getTime()Returns the time at which the action was performed.- Returns:
- The time of the action.
-
getPanel
Provides a default implementation for getting anActionPanelassociated with this action.- Returns:
- An
ActionPanelinstance.
-