logger
Class Log

java.lang.Object
  extended by logger.Log
All Implemented Interfaces:
java.io.Serializable

public class Log
extends java.lang.Object
implements java.io.Serializable

A log stores the modification to a map.

See Also:
Serialized Form

Field Summary
private  java.util.ArrayList<LogEvent> events
          the modifications to the map
private  long logStart
          the time when the map was opened
private  java.lang.String mapFile
          the location of the map
private static long serialVersionUID
          the serialization version identifier
private  java.util.ArrayList<LogEvent> undoneEvents
          a list of events that have been undone
 
Constructor Summary
Log(java.lang.String mapFile)
          Constructs a log for the specified map.
 
Method Summary
 void addEvent(LogEvent event)
          Adds an event to the log.
 Log copy()
          Performs a deep clone of the log.
 java.util.ArrayList<LogEvent> getEvents()
          Gets the events in the log.
 long getLogStart()
          Gets the starting time of the log.
 java.lang.String getMapFile()
          Gets the map file.
 LogEvent getRedoEvent()
          Gets the next event to redo.
 LogEvent getUndoEvent()
          Gets the next event to undo.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
the serialization version identifier

See Also:
Constant Field Values

events

private java.util.ArrayList<LogEvent> events
the modifications to the map


undoneEvents

private java.util.ArrayList<LogEvent> undoneEvents
a list of events that have been undone


mapFile

private java.lang.String mapFile
the location of the map


logStart

private long logStart
the time when the map was opened

Constructor Detail

Log

public Log(java.lang.String mapFile)
Constructs a log for the specified map.

Parameters:
mapFile - - the map to modify
Method Detail

getUndoEvent

public LogEvent getUndoEvent()
Gets the next event to undo.


getRedoEvent

public LogEvent getRedoEvent()
Gets the next event to redo.


addEvent

public void addEvent(LogEvent event)
Adds an event to the log.

Parameters:
event - - the modification event

getEvents

public java.util.ArrayList<LogEvent> getEvents()
Gets the events in the log.


getMapFile

public java.lang.String getMapFile()
Gets the map file.


getLogStart

public long getLogStart()
Gets the starting time of the log.


copy

public Log copy()
Performs a deep clone of the log. However, the old Values in the log events are set to null. The old values are set to null, because they are not needed for a replay.

Returns:
- a deep copy of this log