java.lang.Object
de.hamstersimulator.objectsfirst.datatypes.LogEntry
All Implemented Interfaces:
ObservableLogEntry

public class LogEntry extends Object implements 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 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

      public GameHamster 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 interface ObservableLogEntry
      Returns:
      Return the hamster reference which logged this entry
    • getMessage

      public String getMessage()
      Description copied from interface: ObservableLogEntry
      The message is the text which should be displayed in the log
      Specified by:
      getMessage in interface ObservableLogEntry
      Returns:
      The log message to be displayed
    • getCommandSpecification

      public CommandSpecification getCommandSpecification()
      The command specification that caused this log entry to be generated.
      Specified by:
      getCommandSpecification in interface ObservableLogEntry
      Returns:
      An instance of a CommandSpecification which describes the event this log message represents (it also caused this LogEntry). This won't be null