dd.sim
Class ConfigParameter

java.lang.Object
  extended bydd.sim.SimObject
      extended bydd.sim.ConfigParameter
All Implemented Interfaces:
java.io.Serializable

public class ConfigParameter
extends SimObject

Parameter used to configure proposals. Proposals have an arbitrary number of configuraable options, such as size, target cells, duration, and so on. This class describes one of those configurable options. These configuration parameters appear in a proposal's XML description, and don't make much sense alone.

The properties of this object that should be set are:

Configuration parameters have a type depending on what the parameter represents. Types are defined as string constants in this class. Possible types include:

Author:
Eric Scharff
See Also:
Serialized Form

Field Summary
static java.lang.String BOOLEAN_TYPE
          Indicates that the parameter stores a boolean value.
static java.lang.String CHOICE_TYPE
          Indicates that the parameter stores a "choice".
static java.lang.String DEBRIEFING_KEY
          Key for the text used in the debriefing.
static java.lang.String DESCRIPTION_KEY
          Key to the description field in the attribute table.
static java.lang.String DISTANCE_TYPE
          Indicates that this parameter is a distance.
static java.lang.String DURATION_TYPE
          Indicates that this parameter stores a time.
static java.lang.String MULTIPLECELLS_TYPE
          Indicates that this parameter stores a list of map locations.
static java.lang.String NAME_KEY
          Key to the name field in the attribute table.
static java.lang.String NUMBER_TYPE
          Indicates that this parameter is an aribrary integer or floating point value.
static java.lang.String PLAYER_TYPE
          Indicates that this parameter stores a player.
static java.lang.String PROPERTY_NAME_KEY
          Key to the property name field in the attribute table.
static java.lang.String SINGLECELL_TYPE
          Indicates that this parameter stores a single map location.
static java.lang.String TYPE_KEY
          Key to the type field in the attribute table.
 
Fields inherited from class dd.sim.SimObject
attributes
 
Constructor Summary
ConfigParameter()
           
ConfigParameter(java.lang.String name, java.lang.String type, java.lang.String description, java.lang.String propertyName)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getDebriefingText()
           
 java.lang.String getDebriefingText(java.lang.Object paramValue)
           
 java.lang.String getDescription()
           
 java.lang.String getName()
          Gets the human readable short name of this parameter.
 java.lang.String getPropertyName()
           
 java.lang.String getType()
           
 void setDescription(java.lang.String description)
           
 void setName(java.lang.String name)
          Sets the human readable short name of this parameter.
 void setPropertyName(java.lang.String propertyName)
           
 void setType(java.lang.String type)
           
 
Methods inherited from class dd.sim.SimObject
addPropertyChangeListener, addPropertyChangeListener, debug, duplicate, error, fatal, filter, filter, firePropertyChange, getAttribute, getAttribute, getAttributes, getGlobalAttribute, getObjectAttribute, getObjectAttribute, incrementAttribute, incrementAttribute, isSet, log, out, readFromXML, readFromXML, removeAttribute, removePropertyChangeListener, setAttribute, setAttribute, setAttribute, setAttributes, setGlobalAttribute, warning, writeText, writeXML, writeXML
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NUMBER_TYPE

public static final java.lang.String NUMBER_TYPE
Indicates that this parameter is an aribrary integer or floating point value. Eventually it may be desirable to specify these separately.

See Also:
Constant Field Values

DISTANCE_TYPE

public static final java.lang.String DISTANCE_TYPE
Indicates that this parameter is a distance. The distance is a number, specified in map coordinates.

See Also:
Constant Field Values

SINGLECELL_TYPE

public static final java.lang.String SINGLECELL_TYPE
Indicates that this parameter stores a single map location. The value of this type will be an identifer representing a single target map cell.

See Also:
Constant Field Values

MULTIPLECELLS_TYPE

public static final java.lang.String MULTIPLECELLS_TYPE
Indicates that this parameter stores a list of map locations. The value of this type will be a list of identifiers, each of which represents a single map cell. Note that the order of locations is unspecified, so this should be use to specify a set of locations, not, for example, a prioritized list of locations.

See Also:
Constant Field Values

DURATION_TYPE

public static final java.lang.String DURATION_TYPE
Indicates that this parameter stores a time. Time is a number, a duration specified in number of game turns.

See Also:
Constant Field Values

PLAYER_TYPE

public static final java.lang.String PLAYER_TYPE
Indicates that this parameter stores a player. The value stored will be the Player ID

See Also:
Constant Field Values

CHOICE_TYPE

public static final java.lang.String CHOICE_TYPE
Indicates that the parameter stores a "choice". A choice is a string chosen from a set of mutually exclusive options. It can be thought of as one of the values of a set of radio buttons or a popup menu. The string choices are used internally to compute values.

A ConfigParameter that represents a choice has an attribute called choices that contains a List (ArrayList) of strings. Each item in the List represents a separate choice. Note that the order of the list elements is significant. The 4th item in the list corresponds to the name of the 4th choice, but also the economic cost, social cost, and map icons should also be in the fourth position.

There are several possible ArrayLists to associate with a choice:

As mentioned above, the nth item of each List should line up. So, for example, if choice 1 and choice 4 have a deCost of 1, you must still have four entries {1, 0, 0, 4}.

See Also:
Constant Field Values

BOOLEAN_TYPE

public static final java.lang.String BOOLEAN_TYPE
Indicates that the parameter stores a boolean value. A boolean is stored internally as an integer (a number attribute), where 1 is true and 0 is false. A choice parameter must have a description attribute. This is the description that is shown in the user interface (for example, the descriptive text for a checkbox.) - note that this is different from the DESCRIPTION_KEY which is a longer string used for balloon and HTML help.

See Also:
Constant Field Values

NAME_KEY

public static final java.lang.String NAME_KEY
Key to the name field in the attribute table.

See Also:
Constant Field Values

TYPE_KEY

public static final java.lang.String TYPE_KEY
Key to the type field in the attribute table.

See Also:
Constant Field Values

DESCRIPTION_KEY

public static final java.lang.String DESCRIPTION_KEY
Key to the description field in the attribute table.

See Also:
Constant Field Values

PROPERTY_NAME_KEY

public static final java.lang.String PROPERTY_NAME_KEY
Key to the property name field in the attribute table.

See Also:
Constant Field Values

DEBRIEFING_KEY

public static final java.lang.String DEBRIEFING_KEY
Key for the text used in the debriefing.

See Also:
Constant Field Values
Constructor Detail

ConfigParameter

public ConfigParameter()

ConfigParameter

public ConfigParameter(java.lang.String name,
                       java.lang.String type,
                       java.lang.String description,
                       java.lang.String propertyName)
Method Detail

setName

public void setName(java.lang.String name)
Sets the human readable short name of this parameter. This is the string (not the PropertyName) that will be presented to users in an interface.

Parameters:
name - Name of the parameter

getName

public java.lang.String getName()
Gets the human readable short name of this parameter. This is the string (not the PropertyName) that will be presented to users in an interface.

Returns:
the human readble short name of this parameter

setType

public void setType(java.lang.String type)

getType

public java.lang.String getType()

setDescription

public void setDescription(java.lang.String description)

getDescription

public java.lang.String getDescription()

setPropertyName

public void setPropertyName(java.lang.String propertyName)

getPropertyName

public java.lang.String getPropertyName()

getDebriefingText

public java.lang.String getDebriefingText()

getDebriefingText

public java.lang.String getDebriefingText(java.lang.Object paramValue)

equals

public boolean equals(java.lang.Object obj)