Package net.sf.freecol.common.model
Enum Europe.MigrationType
- java.lang.Object
-
- java.lang.Enum<Europe.MigrationType>
-
- net.sf.freecol.common.model.Europe.MigrationType
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<Europe.MigrationType>
- Enclosing class:
- Europe
public static enum Europe.MigrationType extends java.lang.Enum<Europe.MigrationType>
Migration handling. Migration routines operate on: - "indexes" which refer to a valid member of the recruitables list, and must be [0, RECRUIT_COUNT) - "slots", where slot zero means "pick a random migrant" and the other slots in [1, RECRUIT_COUNT] refer to the index == slot-1 The following constant should be used when the random choice behaviour is desired.
-
-
Field Summary
Fields Modifier and Type Field Description private static int
CHOOSE_MIGRANT_SLOT
The unspecific migrant slot to use to denote a random choice between specific slots.private static int
DEFAULT_MIGRANT_SLOT
The migrant slot to use when there is no reason to choose between them.private static int
MIGRANT_COUNT
The number of recruitable unit types.
-
Constructor Summary
Constructors Modifier Constructor Description private
MigrationType()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
convertToMigrantSlot(java.lang.Integer i)
static int
getDefaultSlot()
static int
getMigrantCount()
static int
getUnspecificSlot()
static int
migrantIndexToSlot(int x)
static int
migrantSlotToIndex(int x)
static boolean
specificMigrantSlot(int x)
static boolean
unspecificMigrantSlot(int x)
static boolean
validMigrantIndex(int x)
static boolean
validMigrantSlot(int x)
static Europe.MigrationType
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static Europe.MigrationType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
NORMAL
public static final Europe.MigrationType NORMAL
-
RECRUIT
public static final Europe.MigrationType RECRUIT
-
FOUNTAIN
public static final Europe.MigrationType FOUNTAIN
-
SURVIVAL
public static final Europe.MigrationType SURVIVAL
-
-
Field Detail
-
MIGRANT_COUNT
private static final int MIGRANT_COUNT
The number of recruitable unit types.- See Also:
- Constant Field Values
-
CHOOSE_MIGRANT_SLOT
private static final int CHOOSE_MIGRANT_SLOT
The unspecific migrant slot to use to denote a random choice between specific slots.- See Also:
- Constant Field Values
-
DEFAULT_MIGRANT_SLOT
private static final int DEFAULT_MIGRANT_SLOT
The migrant slot to use when there is no reason to choose between them.- See Also:
- Constant Field Values
-
-
Method Detail
-
values
public static Europe.MigrationType[] 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 (Europe.MigrationType c : Europe.MigrationType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Europe.MigrationType 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
-
getMigrantCount
public static int getMigrantCount()
-
getUnspecificSlot
public static int getUnspecificSlot()
-
getDefaultSlot
public static int getDefaultSlot()
-
validMigrantIndex
public static boolean validMigrantIndex(int x)
-
migrantIndexToSlot
public static int migrantIndexToSlot(int x)
-
migrantSlotToIndex
public static int migrantSlotToIndex(int x)
-
convertToMigrantSlot
public static int convertToMigrantSlot(java.lang.Integer i)
-
validMigrantSlot
public static boolean validMigrantSlot(int x)
-
specificMigrantSlot
public static boolean specificMigrantSlot(int x)
-
unspecificMigrantSlot
public static boolean unspecificMigrantSlot(int x)
-
-