heurgame.logging
Class DefaultLog

java.lang.Object
  extended byheurgame.logging.AbstractLog
      extended byheurgame.logging.DefaultLog

public class DefaultLog
extends AbstractLog

Author:
David Kaplin A useable implemntation of the AbstractLog. This log seeks out its sources and then notifies all of its readers. Since this is specific to this single log entity it is thread safe. There are no guarentees that its readers and writers are thread safe.

Constructor Summary
DefaultLog()
          Creates a new Log Ensures the log will update itself every 100 milliseconds
DefaultLog(long interval)
          Constructs a new Log and allows it to be updated at a specified rate
 
Method Summary
 void addLogReader(LogReader r)
          Adds the LogReader to its delivery Always add your Readers first!
 void addLogWriter(LogWriter w)
          Adds the LogWriter to its pickup.
 void clear()
          Clears all of the Readers via the LogReader interface.
 void removeLogReader(LogReader r)
          Removes the LogReader from delivery
 void removeLogWriter(LogWriter w)
          Removes the LogWriter from pickup.
 void startLogging()
          Spawns a thread that reads the output from the LogWriters, and writes that output to the LogReaders.
 void stopLogging()
          Terminates the broadcast thread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultLog

public DefaultLog()
Creates a new Log Ensures the log will update itself every 100 milliseconds


DefaultLog

public DefaultLog(long interval)
Constructs a new Log and allows it to be updated at a specified rate

Parameters:
interval - Items will be collected and reported once in this time
Method Detail

addLogWriter

public void addLogWriter(LogWriter w)
Description copied from class: AbstractLog
Adds the LogWriter to its pickup. Make sure to add your Readers first!

Specified by:
addLogWriter in class AbstractLog
Parameters:
w - The Specific Writer
See Also:
AbstractLog.addLogWriter(heurgame.logging.LogWriter)

addLogReader

public void addLogReader(LogReader r)
Description copied from class: AbstractLog
Adds the LogReader to its delivery Always add your Readers first!

Specified by:
addLogReader in class AbstractLog
Parameters:
r - to be added.
See Also:
AbstractLog.addLogReader(heurgame.logging.LogReader)

clear

public void clear()
Clears all of the Readers via the LogReader interface.

Specified by:
clear in class AbstractLog
See Also:
AbstractLog.clear()

startLogging

public void startLogging()
Spawns a thread that reads the output from the LogWriters, and writes that output to the LogReaders. This is the nature of pipes.

Specified by:
startLogging in class AbstractLog
See Also:
AbstractLog.startLogging()

stopLogging

public void stopLogging()
Terminates the broadcast thread

Specified by:
stopLogging in class AbstractLog
See Also:
AbstractLog.stopLogging()

removeLogWriter

public void removeLogWriter(LogWriter w)
Description copied from class: AbstractLog
Removes the LogWriter from pickup.

Specified by:
removeLogWriter in class AbstractLog
Parameters:
w - The Specific Writer
See Also:
AbstractLog.removeLogWriter(heurgame.logging.LogWriter)

removeLogReader

public void removeLogReader(LogReader r)
Description copied from class: AbstractLog
Removes the LogReader from delivery

Specified by:
removeLogReader in class AbstractLog
Parameters:
r - to be removed.
See Also:
AbstractLog.removeLogReader(heurgame.logging.LogReader)