OpType - the type of Operation contained in this recordpublic class ListBackedOperationRecord<OpType extends Operation.InvertibleOperation<?,?,?,?>> extends Object implements ReversibleOperationRecord<OpType>
ReversibleOperationRecord using a List to record operations.| Constructor and Description |
|---|
ListBackedOperationRecord(List<OpType> ops) |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(OpType op) |
void |
clear()
Clear this record.
|
void |
consume(java.util.function.Consumer<OpType> consumer)
For each
Operation in this record from the least-recently added to the most-recently added, use
consumer::accept on that operation and then discard that operation from the record. |
ListBackedOperationRecord<OpType> |
reverse()
Produces a time-reversed version of this record.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitandThenpublic ListBackedOperationRecord(List<OpType> ops)
ops - a list into which we will record operations. The iterator of this list _must_ implement
Iterator.remove() for consume(Consumer) to operate correctly!public void accept(OpType op)
accept in interface java.util.function.Consumer<OpType extends Operation.InvertibleOperation<?,?,?,?>>public ListBackedOperationRecord<OpType> reverse()
ReversibleOperationRecordReversibleOperationRecord.reverse() on the result of this method to recover the original.reverse in interface ReversibleOperationRecord<OpType extends Operation.InvertibleOperation<?,?,?,?>>public void consume(java.util.function.Consumer<OpType> consumer)
ReversibleOperationRecordOperation in this record from the least-recently added to the most-recently added, use
consumer::accept on that operation and then discard that operation from the record.consume in interface ReversibleOperationRecord<OpType extends Operation.InvertibleOperation<?,?,?,?>>consumer - the consumer to use in consuming this recordpublic void clear()
ReversibleOperationRecordclear in interface ReversibleOperationRecord<OpType extends Operation.InvertibleOperation<?,?,?,?>>Licenced under the Apache License, Version 2.0