cz.cuni.amis.pogamut.defcon.consts
Enum UnitType

Package class diagram package UnitType
java.lang.Object
  extended by java.lang.Enum<UnitType>
      extended by cz.cuni.amis.pogamut.defcon.consts.UnitType
All Implemented Interfaces:
Serializable, Comparable<UnitType>

public enum UnitType
extends Enum<UnitType>

Contains all types of defcon units and supplies user with a factory method for each of them. GENERATED by GameObjectsFactoryGenerator.xslt so any modifications should go there!!!

Author:
Radek 'Black_Hand' Pibil

Enum Constant Summary
AIR_BASE
           
BATTLE_SHIP
           
BOMBER
           
CARRIER
           
CITY
           
EXPLOSION
           
FIGHTER
           
FLEET
           
GUNSHOT
           
INVALID
           
NUKE
           
NUM_OBJECTS
           
QUEUE_ITEM
           
RADAR
           
SAUCER
           
SILO
           
SUB
           
TORNADO
           
 
Field Summary
static EnumSet<UnitType> air
          Contains all air units that can receive commands.
static EnumSet<UnitType> ground
          Contains all ground units that can receive commands.
 int id
          Holds integer (defcon) unit type of this unit..type.
static EnumSet<UnitType> misc
          All other types.
static EnumSet<UnitType> naval
          Contains all naval units that can receive commands.
static EnumSet<UnitType> units
          Contains all units that can receive commands.
 
Method Summary
 Class<? extends DefConObject> getClassOfUnitType()
          Provides mapping from UnitType to DefConObject class
static Class<? extends DefConObject> getClassOfUnitType(UnitType data)
          Provides mapping from UnitType to DefConObject class
static UnitType getEnum(int id)
          Returns appropriate UnitType for given integer.
static DefConObject getInstanceOfUnitTypeFromUnitData(JBot.UnitData data, double time)
          Factory styled method, which provides you with an appropriate instance of unit object based on the given UnitData data.
 boolean isAir()
          Is the unit airborne?
 boolean isGround()
          Is it ground unit?
 boolean isMisc()
          Is it misc?
 boolean isNaval()
          Is it naval unit?
 boolean isUnit()
          May the unit receive commands?
static UnitType valueOf(String name)
          Returns the enum constant of this type with the specified name.
static UnitType[] 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

INVALID

public static final UnitType INVALID

CITY

public static final UnitType CITY

SILO

public static final UnitType SILO

RADAR

public static final UnitType RADAR

NUKE

public static final UnitType NUKE

EXPLOSION

public static final UnitType EXPLOSION

SUB

public static final UnitType SUB

BATTLE_SHIP

public static final UnitType BATTLE_SHIP

AIR_BASE

public static final UnitType AIR_BASE

FIGHTER

public static final UnitType FIGHTER

BOMBER

public static final UnitType BOMBER

CARRIER

public static final UnitType CARRIER

TORNADO

public static final UnitType TORNADO

SAUCER

public static final UnitType SAUCER

FLEET

public static final UnitType FLEET

GUNSHOT

public static final UnitType GUNSHOT

QUEUE_ITEM

public static final UnitType QUEUE_ITEM

NUM_OBJECTS

public static final UnitType NUM_OBJECTS
Field Detail

id

public final int id
Holds integer (defcon) unit type of this unit..type.


units

public static final EnumSet<UnitType> units
Contains all units that can receive commands.

SILO, RADAR, NUKE, SUB, BATTLE_SHIP, AIR_BASE, FIGHTER, BOMBER, CARRIER, FLEET TODO: should NUKE be here?


air

public static final EnumSet<UnitType> air
Contains all air units that can receive commands.

NUKE, FIGHTER, BOMBER TODO: should NUKE be here?


naval

public static final EnumSet<UnitType> naval
Contains all naval units that can receive commands.

SUB, BATTLE_SHIP, CARRIER, FLEET


ground

public static final EnumSet<UnitType> ground
Contains all ground units that can receive commands.

SILO, RADAR, AIR_BASE


misc

public static final EnumSet<UnitType> misc
All other types.

INVALID, CITY, EXPLOSION, TORNADO, SAUCER, GUNSHOT, QUEUE_ITEM, NUM_OBJECTS

Method Detail

values

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

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

valueOf

public static UnitType valueOf(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:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

getEnum

public static UnitType getEnum(int id)
Returns appropriate UnitType for given integer.

Parameters:
id - integer (defcon) id type
Returns:
UnitType type

isUnit

public boolean isUnit()
May the unit receive commands?

SILO, RADAR, NUKE, SUB, BATTLE_SHIP, AIR_BASE, FIGHTER, BOMBER, CARRIER, FLEET

Returns:

isAir

public boolean isAir()
Is the unit airborne?

NUKE, FIGHTER, BOMBER

Returns:

isGround

public boolean isGround()
Is it ground unit?

SILO, RADAR, AIR_BASE

Returns:

isNaval

public boolean isNaval()
Is it naval unit?

SUB, BATTLE_SHIP, CARRIER, FLEET

Returns:

isMisc

public boolean isMisc()
Is it misc?

INVALID, CITY, EXPLOSION, TORNADO, SAUCER, GUNSHOT, QUEUE_ITEM, NUM_OBJECTS

Returns:

getInstanceOfUnitTypeFromUnitData

public static DefConObject getInstanceOfUnitTypeFromUnitData(JBot.UnitData data,
                                                             double time)
Factory styled method, which provides you with an appropriate instance of unit object based on the given UnitData data.

Parameters:
data - unit data
time - time of creation
Returns:
instantiated defcon unit

getClassOfUnitType

public Class<? extends DefConObject> getClassOfUnitType()
Provides mapping from UnitType to DefConObject class

Returns:
class of unit

getClassOfUnitType

public static Class<? extends DefConObject> getClassOfUnitType(UnitType data)
Provides mapping from UnitType to DefConObject class

Parameters:
data - unit type
Returns:
class of unit


Copyright © 2014 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.