|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcmsc433.p1.BasicLog
public class BasicLog
A basic implementation of the Log interface. Stores a log of bounded size.
This class should be thread-safe.
| Constructor Summary | |
|---|---|
BasicLog(int logSize)
Constructor specifies the size of the log. |
|
| Method Summary | |
|---|---|
void |
add(LogRecord record)
Adds a record to the log. |
java.util.List<LogRecord> |
flush()
Returns a list of all records in the log. |
java.util.List<LogRecord> |
getAll(long windowMS)
Returns all LogRecords whose timestamps are within a window of time; if the specified window is 0, all of the records are returned. |
void |
register(Listener<LogRecord> listener)
Registers a new listener with this log. |
java.lang.String |
toString()
|
void |
unregister(Listener<LogRecord> listener)
Removes a previously-registered listener. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public BasicLog(int logSize)
logSize - the number of records we can store in the log.
Use 0 to make the log unlimited in size.| Method Detail |
|---|
public void add(LogRecord record)
add in interface Logrecord - The record to be added.public java.util.List<LogRecord> getAll(long windowMS)
getAll in interface LogwindowMS - return all records from the last [windowMS]
milliseconds. If [windowMS] is 0, it returns all of the records;
if it is less than 0, no records are returned.public java.util.List<LogRecord> flush()
flush in interface Logpublic void register(Listener<LogRecord> listener)
add is called.
register in interface Loglistener - The listener to register.public void unregister(Listener<LogRecord> listener)
unregister in interface Loglistener - The listener to remove. If this listener is
not present, then unregister behaves as a no-op.public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||