universe.server.database
Class PlayerType

java.lang.Object
  |
  +--universe.server.KeyedItem
        |
        +--universe.server.database.PlayerType
All Implemented Interfaces:
java.io.Serializable

public final class PlayerType
extends KeyedItem
implements java.io.Serializable

See Also:
Serialized Form

Field Summary
static PlayerType COMPUTER
           
static java.lang.String COMPUTER_KEY
           
static PlayerType HUMAN
           
static java.lang.String HUMAN_KEY
           
private  boolean isInteractive
           
static PlayerType UNDEFINED
           
static java.lang.String UNDEFINED_KEY
           
 
Fields inherited from class universe.server.KeyedItem
 
Constructor Summary
private PlayerType(java.lang.String key, boolean interactiveFlag)
          This constructor is used to construct instances of this class.
 
Method Summary
static PlayerType FindByDescription(java.lang.String aDescription)
          This class method returns the player type instance matching the given localized description, or null if there isn't one.
static PlayerType FindByKey(java.lang.String aKey)
          This class method returns the player type instance matching the given key, or null if there isn't one.
 boolean isInteractive()
          This method returns true if the receiving instance is interactive (i.e.
 void performLocalization()
          This method overrides that of our abstract base class to set the description and back story of the receiving PlayerType object.
 
Methods inherited from class universe.server.KeyedItem
FindByDescriptionAndSpace, FindByKeyAndSpace, getBackStory, getDescription, getKey, hashCode, setBackStory, setDescription, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

UNDEFINED_KEY

public static final java.lang.String UNDEFINED_KEY
See Also:
Constant Field Values

HUMAN_KEY

public static final java.lang.String HUMAN_KEY
See Also:
Constant Field Values

COMPUTER_KEY

public static final java.lang.String COMPUTER_KEY
See Also:
Constant Field Values

UNDEFINED

public static final PlayerType UNDEFINED

HUMAN

public static final PlayerType HUMAN

COMPUTER

public static final PlayerType COMPUTER

isInteractive

private boolean isInteractive
Constructor Detail

PlayerType

private PlayerType(java.lang.String key,
                   boolean interactiveFlag)
This constructor is used to construct instances of this class. It should not be necessary for callers to invoke this directly, since all player types should be created automatically.

Parameters:
key - Thelocalization invariant unique key word used to uniquely identify a particular type of player.
interactiveFlag - Set to true if a human is involved in game play decisiosn for that type of player.
See Also:
FindByKey
Method Detail

FindByKey

public static PlayerType FindByKey(java.lang.String aKey)
This class method returns the player type instance matching the given key, or null if there isn't one.

Parameters:
aKey - The key word identifying the desired instance.

FindByDescription

public static PlayerType FindByDescription(java.lang.String aDescription)
This class method returns the player type instance matching the given localized description, or null if there isn't one. Usually you'll want to store keys and use FindByKey instead, but some UI components (e.g. JComboBox) have an annoying habit of turning objects into UI strings (e.g. when hooked up as a table cell editor).

Parameters:
aDescription - The description identifying the desired instance.

isInteractive

public boolean isInteractive()
This method returns true if the receiving instance is interactive (i.e. a human must be consulted to make decisions during game play). We test this rather than just comparing against PlayerType.HUMAN since we may wish to specify multiple human run player types in the future (e.g. e-mail, web, network client, etc.).


performLocalization

public void performLocalization()
This method overrides that of our abstract base class to set the description and back story of the receiving PlayerType object. This method will be called automatically when either our getDescription or getBackStory methods are called.

Overrides:
performLocalization in class KeyedItem
See Also:
getDescription, getBackStory


Copyright © 2001 Universe Dev Team All Rights Reserved.