public class SimpleHistory extends Object implements History
CappedHistory
Constructor and Description |
---|
SimpleHistory(int slots)
This constructor creates a simple history with limited memory.
|
SimpleHistory(int slots,
boolean allowShift,
boolean allowShrink,
boolean allowExpand)
This constructor creates a simple history with limited memory.
|
SimpleHistory(StringBuffer xml)
This is the constructor for the interface
Storable . |
Modifier and Type | Method and Description |
---|---|
void |
clear()
This method clears the history, i.e.
|
SimpleHistory |
clone()
This method returns a deep copy of the instance
|
boolean |
operationAllowed(int... operation)
Returns
true if the specified operation is allowed, i.e. |
void |
operationPerfomed(int... operation)
This method puts an operation to the history.
|
StringBuffer |
toXML()
This method returns an XML representation as
StringBuffer of an
instance of the implementing class. |
public SimpleHistory(int slots)
slots
- the number of memory slotsSimpleHistory(int, boolean, boolean, boolean)
public SimpleHistory(int slots, boolean allowShift, boolean allowShrink, boolean allowExpand)
slots
- the number of memory slotsallowShift
- if true shifts are allowallowShrink
- if true shrinks are allowallowExpand
- if true expands are allowpublic SimpleHistory(StringBuffer xml) throws NonParsableException
Storable
.xml
- the XML representation as StringBuffer
NonParsableException
- if the XML representation could not be parsedpublic StringBuffer toXML()
Storable
StringBuffer
of an
instance of the implementing class.public boolean operationAllowed(int... operation)
History
true
if the specified operation is allowed, i.e. it does not conflict with any operation from the history.operationAllowed
in interface History
operation
- the operation to be testedtrue
if the specified operation is allowedpublic void operationPerfomed(int... operation)
History
operationPerfomed
in interface History
operation
- the performed operationpublic void clear()
History
public SimpleHistory clone() throws CloneNotSupportedException
History
clone
in interface History
clone
in class Object
CloneNotSupportedException
- if not possibleCloneable
,
Object.clone()