- /**
- * Stores execution states of a {@link Reaction}.
- *
- * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
- */
- private static class ReactionExecution {
-
- /** The time the reaction was last executed. */
- private long lastExecutionTime;
-
- /** The previous state of the reaction. */
- private net.pterodactylus.reactor.State previousState;
-
- /** The current state of the reaction. */
- private net.pterodactylus.reactor.State currentState;
-
- //
- // ACCESSORS
- //
-
- /**
- * Returns the time the reaction was last executed. If the reaction was
- * not yet executed, this method returns {@code 0}.
- *
- * @return The last execution time of the reaction (in milliseconds
- * since Jan 1, 1970 UTC)
- */
- public long lastExecutionTime() {
- return lastExecutionTime;
- }
-
- /**
- * Returns the current state of the reaction. If the reaction was not
- * yet executed, this method returns {@code null}.
- *
- * @return The current state of the reaction
- */
- public net.pterodactylus.reactor.State currentState() {
- return currentState;
- }
-
- /**
- * Returns the previous state of the reaction. If the reaction was not
- * yet executed at least twice, this method returns {@code null}.
- *
- * @return The previous state of the reaction
- */
- public net.pterodactylus.reactor.State previousState() {
- return previousState;
- }
-
- /**
- * Sets the last execution time of the reaction.
- *
- * @param lastExecutionTime
- * The last execution time of the reaction (in milliseconds
- * since Jan 1, 1970 UTC)
- * @return This execution
- */
- public ReactionExecution setLastExecutionTime(long lastExecutionTime) {
- this.lastExecutionTime = lastExecutionTime;
- return this;
- }
-
- //
- // ACTIONS
- //
-
- /**
- * Adds the given state as current state and moves the current state
- * into the previous state.
- *
- * @param state
- * The new current state
- * @return This execution
- */
- public ReactionExecution addState(net.pterodactylus.reactor.State state) {
- previousState = currentState;
- currentState = state;
- return this;
- }
-
- }
-