net.sf.freecol.common.model
Enum Unit.Role

java.lang.Object
  extended by java.lang.Enum<Unit.Role>
      extended by net.sf.freecol.common.model.Unit.Role
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Unit.Role>
Enclosing class:
Unit

public static enum Unit.Role
extends java.lang.Enum<Unit.Role>

The roles a Unit can have. TODO: make this configurable by adding roles to the specification instead of using an enum. New roles, such as mounted pioneers, have already been suggested.


Enum Constant Summary
DEFAULT
           
DRAGOON
           
MISSIONARY
           
PIONEER
           
SCOUT
           
SOLDIER
           
 
Field Summary
private static java.util.HashMap<Unit.Role,java.util.List<EquipmentType>> roleEquipment
           
 
Method Summary
 java.lang.String getId()
           
 java.util.List<EquipmentType> getRoleEquipment(Specification spec)
          Gets the equipment required for this role.
private  void initializeRoleEquipment(Specification spec)
          Initializes roleEquipment.
 boolean isCompatibleWith(Unit.Role oldRole)
           
 Unit.Role newRole(Unit.Role role)
           
static Unit.Role valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static Unit.Role[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

DEFAULT

public static final Unit.Role DEFAULT

PIONEER

public static final Unit.Role PIONEER

MISSIONARY

public static final Unit.Role MISSIONARY

SOLDIER

public static final Unit.Role SOLDIER

SCOUT

public static final Unit.Role SCOUT

DRAGOON

public static final Unit.Role DRAGOON
Field Detail

roleEquipment

private static final java.util.HashMap<Unit.Role,java.util.List<EquipmentType>> roleEquipment
Method Detail

values

public static Unit.Role[] 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 (Unit.Role c : Unit.Role.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Unit.Role 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 name
java.lang.NullPointerException - if the argument is null

initializeRoleEquipment

private void initializeRoleEquipment(Specification spec)
Initializes roleEquipment. How about that.


getRoleEquipment

public java.util.List<EquipmentType> getRoleEquipment(Specification spec)
Gets the equipment required for this role. TODO: passing the spec in is a wart.

Parameters:
spec - The Specification to extract requirements from.
Returns:
A list of required EquipmentTypes.

isCompatibleWith

public boolean isCompatibleWith(Unit.Role oldRole)

newRole

public Unit.Role newRole(Unit.Role role)

getId

public java.lang.String getId()