jurpe.system
Class Log

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

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

Keeps a log of events in the game

Author:
Alessio Saltarin
See Also:
Serialized Form

Method Summary
 void addEntry(java.lang.String text)
          Add new string to log
 void addWarning(java.lang.String text)
          Add new warning to the log
 java.lang.String[] getEntries()
          Get log entries.
 java.lang.String getLatestEntry()
          Get the last inserted entry
 java.lang.String getNewEntries()
          Get latest entries.
 int getNumberOfEntries()
          Get number of log entries.
static Log getReference()
          Return this log
 void setLogToFile(java.io.File file)
          Log to external file
 java.lang.String toString()
          Returns current log as a single String.
 void unsetLogToFile()
          End a log to external file session.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

addWarning

public void addWarning(java.lang.String text)
Add new warning to the log

Parameters:
text - Text of warning.

addEntry

public void addEntry(java.lang.String text)
Add new string to log

Parameters:
text - String to log

setLogToFile

public void setLogToFile(java.io.File file)
                  throws java.io.IOException
Log to external file

Parameters:
file - File to save log into
Throws:
java.io.IOException

unsetLogToFile

public void unsetLogToFile()
End a log to external file session.


getNewEntries

public java.lang.String getNewEntries()
Get latest entries.

Returns:
last added entries to log.

getEntries

public java.lang.String[] getEntries()
Get log entries. It makes the log empty when called.

Returns:
Log as an array

getNumberOfEntries

public int getNumberOfEntries()
Get number of log entries.

Returns:
number of log entries.

getLatestEntry

public java.lang.String getLatestEntry()
Get the last inserted entry

Returns:
last inserted entry

toString

public java.lang.String toString()
Returns current log as a single String.

Overrides:
toString in class java.lang.Object
Returns:
log entries.

getReference

public static Log getReference()
Return this log

Returns:
handler to log

Jurpe - Java Universal Role Playing Engine - http://jurpe.sourceforge.net