de.hagenah.diplomacy.map
Class Person

java.lang.Object
  extended by de.hagenah.diplomacy.map.Person
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable
Direct Known Subclasses:
Country

public class Person
extends java.lang.Object
implements java.lang.Comparable, java.io.Serializable

A person in a diplomacy game (a country, master, or observer)

See Also:
Serialized Form

Field Summary
static Person MASTER
          The master
static Person OBSERVER
          An observer
static Person POWER
          A power before the game starts
static int TOSTRING_CSS
          The CSS class color-?
static int TOSTRING_HTML
          Returns a xhtml text, e.g. → instead of ->
static int TOSTRING_SHORT
          Returns a short text, e.g.
 
Method Summary
 int compareTo(java.lang.Object obj)
          Compares two Countries by Name ignoring case.
 boolean equals(java.lang.Object obj)
          Compares two Countries by Name ignoring case.
 java.lang.String getAbbreviation()
          Returns the abbreviation of the person.
 java.awt.Color getColor()
          Returns the color of the person.
 java.lang.String getName()
          Returns the name of the person.
 int hashCode()
          Returns a hashcode for this Country.
 boolean isMaster()
          Is this the master pseudo country?
 boolean isObserver()
          Is this the observer pseudo country?
 boolean isPower()
          Is this the power pseudo country (a power before the game starts)?
 java.lang.String toString()
          Returns the name of the country.
static java.lang.String toString(java.util.Collection persons, int flags)
          Returns a string for a collection of persons, e.g.
 java.lang.String toString(int flags)
          Return a text for the person (e.g.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MASTER

public static final Person MASTER
The master


OBSERVER

public static final Person OBSERVER
An observer


POWER

public static final Person POWER
A power before the game starts


TOSTRING_SHORT

public static final int TOSTRING_SHORT
Returns a short text, e.g. "M"

See Also:
Constant Field Values

TOSTRING_HTML

public static final int TOSTRING_HTML
Returns a xhtml text, e.g. → instead of ->

See Also:
Constant Field Values

TOSTRING_CSS

public static final int TOSTRING_CSS
The CSS class color-? (e.g. color-m) is used for the color

See Also:
Constant Field Values
Method Detail

getName

public java.lang.String getName()
Returns the name of the person.


getAbbreviation

public java.lang.String getAbbreviation()
Returns the abbreviation of the person.


getColor

public java.awt.Color getColor()
Returns the color of the person.


equals

public boolean equals(java.lang.Object obj)
Compares two Countries by Name ignoring case.

Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(java.lang.Object obj)
Compares two Countries by Name ignoring case. Before the normal countries come the master and the observer.

Specified by:
compareTo in interface java.lang.Comparable

hashCode

public int hashCode()
Returns a hashcode for this Country.

Overrides:
hashCode in class java.lang.Object

isMaster

public boolean isMaster()
Is this the master pseudo country?

Returns:
true if this is the master pseudo country, false otherwise

isObserver

public boolean isObserver()
Is this the observer pseudo country?

Returns:
true if this is the observer pseudo country, false otherwise

isPower

public boolean isPower()
Is this the power pseudo country (a power before the game starts)?

Returns:
true if this is the power pseudo country, false otherwise

toString

public java.lang.String toString()
Returns the name of the country.

Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(int flags)
Return a text for the person (e.g. Master)

Parameters:
flags - TOSTRING_SHORT, TOSTRING_HTML, TOSTRING_CSS
Returns:
The text

toString

public static java.lang.String toString(java.util.Collection persons,
                                        int flags)
Returns a string for a collection of persons, e.g. Master, Austria, and England

Parameters:
flags - TOSTRING_SHORT, TOSTRING_HTML, TOSTRING_CSS
Returns:
The text