Java Universal Role Playing Engine Version 0.3.9

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. The log is sent to the console by a console handler and to a collection of strings. There are two type of logs:

The entry is displayed to the final user, while details AND entries are displayed to the console.

See Also:
Serialized Form

Method Summary
 void addDetail(java.lang.String text)
          Add new detail to the log Details are only sent to the console
 void addEntry()
          Add a blank line
 void addEntry(java.lang.String text)
          Add new entry to 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

addDetail

public void addDetail(java.lang.String text)
Add new detail to the log Details are only sent to the console

Parameters:
text - Text of the detail.

addEntry

public void addEntry(java.lang.String text)
Add new entry to log. Entries are displayed to the console and to the user interface. If the text has new lines, each line is sent as a single message

Parameters:
text - String to log

addEntry

public void addEntry()
Add a blank line


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

Java Universal Role Playing Engine Version 0.3.9

Copyright ? 2010 http://jurpe.sourceforge.net/ All Rights Reserved.