|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.hagenah.diplomacy.game.Game
public class Game
The Game class contains all Turns of a game.
| Constructor Summary | |
|---|---|
Game(java.lang.String name,
java.lang.String judge,
MapData map)
Creates a new Game |
|
| Method Summary | |
|---|---|
protected boolean |
areMessagesCached()
Returns whether or not messages are cached |
int |
compareTo(java.lang.Object obj)
Compares two Games by Name and Judge |
DiaryEntry |
createDiaryEntry(Person from,
int number,
java.lang.String text,
Phase phase)
Creates a new diary entry (if the diary entry doesn't already exist) |
Message |
createMessage(boolean anonymous,
Person from,
boolean toallbut,
java.util.Collection to,
boolean faketoallbut,
java.util.Collection faketo,
java.lang.String text,
java.util.Date date)
Creates a new broadcast/press message (if the message doesn't already exist) |
Turn |
createTurn(int number,
Phase phase,
java.util.Date turndate)
Retrieves the specified turn. |
void |
deleteDiaryEntry(DiaryEntry entry)
Deletes a diary entry. |
void |
deleteMessage(Message msg)
Removes the message msg. |
boolean |
equals(java.lang.Object obj)
Compares two Games by Name and Judge |
java.lang.String |
getComment()
Returns the game comment, null if unknown (Note: \n is used as line separator) |
java.lang.String |
getDescription()
Returns a string with the variant, the victor(s), the persons, the parameters, and the comment |
java.util.List |
getDiaryEntries(int number)
Returns a (ordered) list with the diary entries for the specified turn. |
DiaryEntry |
getDiaryEntry(Person from,
int number)
Returns the specified diary entry. |
int |
getDiaryEntryTurn(DiaryEntry entry)
Returns the turn for the specified diary entry |
Person |
getIdentity()
Returns your role in this game (a country, master, or observer). |
java.lang.String |
getJudge()
Returns the judge of the game. |
Phase |
getLastPhase()
Returns the last phase of this game, null if unknown |
MapData |
getMap()
Returns the map of the game. |
java.util.List |
getMessages(int number)
Returns a (ordered) list with the messages for the specified turn. |
int |
getMessageTurn(Message msg)
Returns the turn for the specified message |
Turn |
getMostRecentTurn()
Returns the most recent turn of the game or null if there are no turns |
java.lang.String |
getName()
Returns the name of the game. |
java.util.SortedSet |
getOptions()
Returns the options of the game. |
java.lang.String |
getParameter(java.lang.String parameter)
Returns the specified parameter |
java.util.Map |
getParameters()
Returns the parameters of the game, null if unknown (keys without a trailing colon, values without a trailing dot, keys and values without leading or trailing whitespace). |
java.lang.String |
getParameterValue(java.lang.String parameter,
java.lang.String key)
Returns the value of a key of a parameter, e.g. |
java.util.SortedSet |
getPersonInfo()
Returns all person informations |
java.util.Map |
getSpecialCenters(Phase phase)
Returns the special centers for the specified phase. |
java.util.Map |
getSpecialPhaseCenters(Phase phase)
Returns the special phase centers. |
Turn |
getTurn(int number)
Returns a turn of the game or null. |
Turn |
getTurn(Phase phase)
Returns a turn of the game or null. |
java.util.Date |
getTurnDate(int number)
Returns the date of the turn. |
int |
getTurnIndex(int number)
Returns a index of the turn . |
java.util.Collection |
getTurns()
Returns all turns of the game |
java.util.SortedSet |
getVictors()
Returns the victor resp. the draw participants, null if unknown |
int |
hashCode()
Returns a hashcode for this game. |
boolean |
hasOption(java.lang.String option)
Is the option for the game set? |
boolean |
hasParameterFlag(java.lang.String parameter,
java.lang.String flag)
Tests whether or not the specified flag is set in the specified parameter. |
protected Turn |
internCreateTurn(int number,
Phase phase)
Creates a Turn object |
void |
processTurns()
Calculates data that can be calculated from the existing data and that the JudgeParser does not set. |
void |
rollback(int number,
boolean removeallorders)
Rolls the game back to the turn number. |
void |
setComment(java.lang.String comment)
Sets the game comment (Note: \n is used as line separator) |
void |
setIdentity(Person identity)
Sets your role in this game (a country, master, or observer). |
void |
setLastPhase(Phase phase)
Sets the last phase of this game |
void |
setOptions(java.util.Collection options)
Sets the options of the game. |
void |
setParameters(java.util.Map parameters)
Sets the parameters of the game (keys without a trailing colon, values without a trailing dot, keys and values without leading or trailing whitespace). |
void |
setPersonInfo(PersonInfo personinfo)
Adds a person information |
void |
setTurnDate(int number,
java.util.Date turndate)
Sets the date of the turn. |
void |
setVictors(java.util.Collection victors,
boolean concession)
Sets the victor resp. the draw participants |
java.lang.String |
toString()
Returns the name and judge of the game, e.g. |
boolean |
wasConceded()
Was the game conceded to the victor? |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Game(java.lang.String name,
java.lang.String judge,
MapData map)
| Method Detail |
|---|
protected Turn internCreateTurn(int number,
Phase phase)
protected boolean areMessagesCached()
public Person getIdentity()
public void setIdentity(Person identity)
public int getDiaryEntryTurn(DiaryEntry entry)
entry - The diary entry
public int getMessageTurn(Message msg)
msg - The message
public DiaryEntry createDiaryEntry(Person from,
int number,
java.lang.String text,
Phase phase)
from - The person that created the diary entry (can be null if unknown)number - The number of the diary entry (-1 if unknown)text - The diary entry text (\n as line separator)phase - The phase in which the diary entry was created
public DiaryEntry getDiaryEntry(Person from,
int number)
from - The person who wrote it (can be null for the identity)number - The number of the diary entry.
public void deleteDiaryEntry(DiaryEntry entry)
entry - The diary entry to delete.public java.util.List getDiaryEntries(int number)
number - The number of the turn
public Message createMessage(boolean anonymous,
Person from,
boolean toallbut,
java.util.Collection to,
boolean faketoallbut,
java.util.Collection faketo,
java.lang.String text,
java.util.Date date)
anonymous - Is the message anonymous (grey)?from - The person that sent the message (can be null if unknown)toallbut - false → the message was sent to to, true → the message was
send to all but to (if to is an empty list it was a broadcast message).to - The interpretation depends on toallbut (can be null if unknown)faketoallbut - false → the message was faked to faketo, true → the message was
faked to all but faketo (if faketo is an empty list it was a faked broadcast message).faketo - The interpretation depends on faketoallbut (cannot be null)text - The message text (\n as line separator)date - The date of the message (can be null)
public void deleteMessage(Message msg)
msg - The message to deletepublic java.util.List getMessages(int number)
number - The number of the turn
public void setTurnDate(int number,
java.util.Date turndate)
number - The number of the turnturndate - The date of the turn (can be null to clear the date)public java.util.Date getTurnDate(int number)
public java.lang.String getName()
public java.lang.String getJudge()
public MapData getMap()
public java.util.SortedSet getOptions()
public void setOptions(java.util.Collection options)
public boolean hasOption(java.lang.String option)
public Turn getTurn(int number)
public Turn getMostRecentTurn()
public Turn getTurn(Phase phase)
public int getTurnIndex(int number)
public java.util.Collection getTurns()
public java.util.SortedSet getVictors()
public boolean wasConceded()
public void setVictors(java.util.Collection victors,
boolean concession)
public java.lang.String getComment()
public void setComment(java.lang.String comment)
public java.util.Map getParameters()
public java.lang.String getParameter(java.lang.String parameter)
public boolean hasParameterFlag(java.lang.String parameter,
java.lang.String flag)
parameter - The name of the parameterflag - The name of the flag
public java.lang.String getParameterValue(java.lang.String parameter,
java.lang.String key)
parameter - The name of the parameterkey - The name of the key
public void setParameters(java.util.Map parameters)
public void setPersonInfo(PersonInfo personinfo)
public java.util.SortedSet getPersonInfo()
public void setLastPhase(Phase phase)
public Phase getLastPhase()
public Turn createTurn(int number,
Phase phase,
java.util.Date turndate)
number - The number of the phase (>=Turn.NUMBER_FIRST).phase - The phase (!=null).turndate - The date of the turn (can be null if unknown)
public void rollback(int number,
boolean removeallorders)
number - The number of the turn to rollback toremoveallorders - true: all orders of the turn number are removed, false: only the
NMR orders are removed and the result flags of the remaining orders are
cleared.public java.util.Map getSpecialPhaseCenters(Phase phase)
public java.util.Map getSpecialCenters(Phase phase)
phase - A phase
public void processTurns()
public java.lang.String getDescription()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int compareTo(java.lang.Object obj)
compareTo in interface java.lang.Comparablepublic int hashCode()
hashCode in class java.lang.Objectpublic 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 | |||||||||