Class LogEntry
java.lang.Object
de.hamstersimulator.objectsfirst.datatypes.LogEntry
- All Implemented Interfaces:
ObservableLogEntry
A log entry object represents a log message of the
hamster simulator and is typically displayed in the log
view at the right side of the simulator window.
- Author:
- Steffen Becker
-
Constructor Summary
ConstructorDescriptionLogEntry(CommandSpecification specification, GameHamster loggingHamster, String loggedMessage)
Create a new log entry. -
Method Summary
Modifier and TypeMethodDescriptionThe command specification that caused this log entry to be generated.Every log entries might have a hamster, which can be used to make clear which hamster caused the log message
Returns null if the log entry is not linked to a hamsterThe message is the text which should be displayed in the log
-
Constructor Details
-
LogEntry
public LogEntry(CommandSpecification specification, GameHamster loggingHamster, String loggedMessage)Create a new log entry.- Parameters:
loggingHamster
- Reference to the hamster which created the log message. Can be null if the log does not originate from a hamster but from the environment.loggedMessage
- The message to be logged. Has not to be null and not to be empty.
-
-
Method Details
-
getHamster
Description copied from interface:ObservableLogEntry
Every log entries might have a hamster, which can be used to make clear which hamster caused the log message
Returns null if the log entry is not linked to a hamster- Specified by:
getHamster
in interfaceObservableLogEntry
- Returns:
- Return the hamster reference which logged this entry
-
getMessage
Description copied from interface:ObservableLogEntry
The message is the text which should be displayed in the log- Specified by:
getMessage
in interfaceObservableLogEntry
- Returns:
- The log message to be displayed
-
getCommandSpecification
The command specification that caused this log entry to be generated.- Specified by:
getCommandSpecification
in interfaceObservableLogEntry
- Returns:
- An instance of a
CommandSpecification
which describes the event this log message represents (it also caused this LogEntry). This won't be null
-