Package tk.dmanstrator.connectfour.log
Class GameLogEntry
- java.lang.Object
-
- tk.dmanstrator.connectfour.log.GameLogEntry
-
public class GameLogEntry extends java.lang.ObjectClass representing an entry for theGameLog.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGameLogEntry.RoundTitleRepresents the title of a round.
-
Constructor Summary
Constructors Constructor Description GameLogEntry(java.lang.String message, int roundNumber, int playerNumber, boolean validRound, GameLogEntry.RoundTitle title)Constructor for the entry.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetAsString()Gets the entry as a string.java.lang.StringgetMessage()Returns the message of the entry.intgetPlayerNumber()Returns the player number of the entry.intgetRoundNumber()Returns the round number of the entry.GameLogEntry.RoundTitlegetRoundTitle()Returns theGameLogEntry.RoundTitleof the entry.booleanisValidRound()Returns flag telling if it was a valid round.java.lang.StringtoString()Returns the entry as a string.
-
-
-
Constructor Detail
-
GameLogEntry
public GameLogEntry(java.lang.String message, int roundNumber, int playerNumber, boolean validRound, GameLogEntry.RoundTitle title)Constructor for the entry.- Parameters:
message- Message of the entryroundNumber- Round number of the entryplayerNumber- Player number of the entryvalidRound- Flag telling if it was a valid roundtitle-GameLogEntry.RoundTitleof the entry
-
-
Method Detail
-
getMessage
public java.lang.String getMessage()
Returns the message of the entry.- Returns:
- The message of the entry
-
getRoundNumber
public int getRoundNumber()
Returns the round number of the entry. Will be-1if round was invalid.- Returns:
- The round number of the entry
-
getPlayerNumber
public int getPlayerNumber()
Returns the player number of the entry. Will be0if no player was passed.- Returns:
- The player number of the entry
-
isValidRound
public boolean isValidRound()
Returns flag telling if it was a valid round.- Returns:
trueif round was valid, elsefalse
-
getRoundTitle
public GameLogEntry.RoundTitle getRoundTitle()
Returns theGameLogEntry.RoundTitleof the entry.- Returns:
- The
GameLogEntry.RoundTitleof the entry
-
getAsString
public java.lang.String getAsString()
Gets the entry as a string. Adds the round number into theGameLogEntry.RoundTitlewhen it's a valid round. Converts the player number to[Player X]if a player number was set.- Returns:
- The entry as a string in format
<Title> [Player]: <Message>
-
toString
public java.lang.String toString()
Returns the entry as a string.- Overrides:
toStringin classjava.lang.Object- Returns:
- The entry as a string
- See Also:
getAsString()
-
-