Skip to content

Instantly share code, notes, and snippets.

@galdosd
Last active August 27, 2018 05:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save galdosd/fd9949a7a0146ffdde3a16eaa34939ea to your computer and use it in GitHub Desktop.
Save galdosd/fd9949a7a0146ffdde3a16eaa34939ea to your computer and use it in GitHub Desktop.
es
public interface State<T_state extends State> {
void load(History<T_state> history, int lastTransaction);
}
public abstract class BaseState<T_state extends State> implements State<T_state> {
private int lastTransaction = -1;
@Override public void load(History<T_state> history, int lastTransaction) {
}
}
public interface History<T_state extends State> {
List<Transaction<T_state>> getTransactions();
}
public interface Transaction<T_state extends State> {
List<Change<T_state>> getChanges();
}
public interface Change<T_state extends State>{
Change<T_state> apply(T_state s);
void unapply(T_state s);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment