Class ExpressionHistory
java.lang.Object
org.cyclops.integrateddynamics.core.logicprogrammer.ExpressionHistory
The changes to an expression in the logic programmer, to go back and forth through them.
Changes are recorded by observing the expression, so they can come from slots, parameters or text alike.
Typing the same expression in another way is a change as well, as the text is shown as typed.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanRedo()booleancanUndo()voidclear()Forget all changes, such as when another expression is opened.voidmoved(ExpressionHistory.Entry entry) Make the given expression the current one without recording a change, after an undo or redo set it.voidobserve(Expression expression, String text) Observe the current expression, which records a change if it or its text differs from the one observed before.redo()Go forward one undone change.undo()Go back one change.
-
Field Details
-
MAX_SIZE
public static final int MAX_SIZE- See Also:
-
-
Constructor Details
-
ExpressionHistory
public ExpressionHistory()
-
-
Method Details
-
observe
Observe the current expression, which records a change if it or its text differs from the one observed before.- Parameters:
expression- The current expression.text- The text it was typed as, or null if it is printed.
-
canUndo
public boolean canUndo() -
canRedo
public boolean canRedo() -
undo
Go back one change. Callmoved(Entry)once the returned expression is set.- Returns:
- The expression to go back to, or null if there is none.
-
redo
Go forward one undone change. Callmoved(Entry)once the returned expression is set.- Returns:
- The expression to go forward to, or null if there is none.
-
moved
Make the given expression the current one without recording a change, after an undo or redo set it.- Parameters:
entry- The current expression and its text.
-
clear
public void clear()Forget all changes, such as when another expression is opened.
-