Package net.sf.colossus.game
Enum PlayerColor
- java.lang.Object
-
- java.lang.Enum<PlayerColor>
-
- net.sf.colossus.game.PlayerColor
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<PlayerColor>
public enum PlayerColor extends java.lang.Enum<PlayerColor>
Models the notion of a color a player can pick. This is not just the actual color of the markers, but also the names used for it (long and short version) as well as a suitable foreground color. The marker color itself is available through the {getBackgroundColor()
method.
-
-
Field Summary
Fields Modifier and Type Field Description private java.awt.Color
backgroundColor
private java.awt.Color
foregroundColor
private int
mnemonic
private java.lang.String
name
private java.lang.String
shortName
-
Constructor Summary
Constructors Modifier Constructor Description private
PlayerColor(java.lang.String name, java.lang.String shortName, int mnemonic)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.Color
getBackgroundColor()
static PlayerColor
getByName(java.lang.String name)
static java.util.List<PlayerColor>
getByName(java.util.List<java.lang.String> names)
static PlayerColor
getByShortName(java.lang.String shortName)
java.awt.Color
getForegroundColor()
int
getMnemonic()
java.lang.String
getName()
java.lang.String
getShortName()
java.lang.String
toString()
static PlayerColor
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static PlayerColor[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
BLACK
public static final PlayerColor BLACK
-
BLUE
public static final PlayerColor BLUE
-
BROWN
public static final PlayerColor BROWN
-
GOLD
public static final PlayerColor GOLD
-
GREEN
public static final PlayerColor GREEN
-
RED
public static final PlayerColor RED
-
ORANGE
public static final PlayerColor ORANGE
-
PURPLE
public static final PlayerColor PURPLE
-
SILVER
public static final PlayerColor SILVER
-
SKY
public static final PlayerColor SKY
-
PINE
public static final PlayerColor PINE
-
INDIGO
public static final PlayerColor INDIGO
-
-
Method Detail
-
values
public static PlayerColor[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (PlayerColor c : PlayerColor.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static PlayerColor valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getMnemonic
public int getMnemonic()
-
getName
public java.lang.String getName()
-
getShortName
public java.lang.String getShortName()
-
getBackgroundColor
public java.awt.Color getBackgroundColor()
-
getForegroundColor
public java.awt.Color getForegroundColor()
-
getByName
public static PlayerColor getByName(java.lang.String name)
-
getByShortName
public static PlayerColor getByShortName(java.lang.String shortName)
-
getByName
public static java.util.List<PlayerColor> getByName(java.util.List<java.lang.String> names)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Enum<PlayerColor>
-
-