public class StreetsideRecord extends Object
Modifier and Type | Field and Description |
---|---|
List<StreetsideCommand> |
commandList
The set of commands that have taken place or that have been undone.
|
private static StreetsideRecord |
instance
The unique instance of the class.
|
private List<StreetsideRecordListener> |
listeners |
int |
position
Last written command.
|
Constructor and Description |
---|
StreetsideRecord()
Main constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addCommand(StreetsideCommand command)
Adds a new command to the list.
|
void |
addListener(StreetsideRecordListener lis)
Adds a listener.
|
private void |
fireRecordChanged() |
static StreetsideRecord |
getInstance()
Returns the unique instance of the class.
|
void |
redo()
Redoes latest undone action.
|
void |
removeListener(StreetsideRecordListener lis)
Removes the given listener.
|
void |
reset()
Resets the object to its start state.
|
void |
undo()
Undo latest command.
|
private static StreetsideRecord instance
private final List<StreetsideRecordListener> listeners
public List<StreetsideCommand> commandList
public int position
public StreetsideRecord()
public static StreetsideRecord getInstance()
public void addListener(StreetsideRecordListener lis)
lis
- The listener to be added.public void removeListener(StreetsideRecordListener lis)
lis
- The listener to be removed.public void addCommand(StreetsideCommand command)
command
- The command to be added.public void undo()
public void redo()
private void fireRecordChanged()
public void reset()