dip.world
Class RuleOptions

java.lang.Object
  extended bydip.world.RuleOptions
All Implemented Interfaces:
java.io.Serializable

public class RuleOptions
extends java.lang.Object
implements java.io.Serializable

RuleOptions is an object for storing Options and OptionValues that describe rule variants.

Internationalization notes:

        OptionValue:
                getNameI18N()				gets internationalized name (key is getName())
                getDescriptionI18N()		gets internationalized description (name + "_description")

        Option:
                getNameI18N()				gets internationalized name
                getDescriptionI18N()		gets internationalized description (name + "_description")


See Also:
Serialized Form

Nested Class Summary
static class RuleOptions.Option
          An Option is created for each type of Rule that may have more than one allowable option.
static class RuleOptions.OptionValue
          OptionValues are the pre-defined values that an Option may have.
 
Field Summary
static RuleOptions.Option OPTION_BUILDS
           
static RuleOptions.Option OPTION_CONVOYED_MOVES
           
static RuleOptions.Option OPTION_WINGS
           
protected  java.util.HashMap optionMap
           
static RuleOptions.OptionValue VALUE_BUILDS_ANY_IF_HOME_OWNED
           
static RuleOptions.OptionValue VALUE_BUILDS_ANY_OWNED
           
static RuleOptions.OptionValue VALUE_BUILDS_HOME_ONLY
           
static RuleOptions.OptionValue VALUE_FALSE
          FALSE (Boolean) OptionValue
static RuleOptions.OptionValue VALUE_PATHS_EITHER
           
static RuleOptions.OptionValue VALUE_PATHS_EXPLICIT
           
static RuleOptions.OptionValue VALUE_PATHS_IMPLICIT
           
static RuleOptions.OptionValue VALUE_TRUE
          TRUE (Boolean) OptionValue
static RuleOptions.OptionValue VALUE_WINGS_DISABLED
           
static RuleOptions.OptionValue VALUE_WINGS_ENABLED
           
 
Constructor Summary
RuleOptions()
          Creates a new RuleOptions object, which stores various Rule options.
 
Method Summary
static RuleOptions createFromVariant(Variant variant)
          Create a RuleOptions from a Variant.
 java.util.Set getAllOptions()
          Returns a Set of all Options.
 RuleOptions.OptionValue getOptionValue(RuleOptions.Option option)
          Obtains the value for an Option.
 void setOption(RuleOptions.Option option, RuleOptions.OptionValue value)
          Sets the OptionValue for an Option.
 java.lang.String toString()
          For debugging only; print the rule options
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VALUE_TRUE

public static final RuleOptions.OptionValue VALUE_TRUE
TRUE (Boolean) OptionValue


VALUE_FALSE

public static final RuleOptions.OptionValue VALUE_FALSE
FALSE (Boolean) OptionValue


VALUE_BUILDS_HOME_ONLY

public static final RuleOptions.OptionValue VALUE_BUILDS_HOME_ONLY

VALUE_BUILDS_ANY_OWNED

public static final RuleOptions.OptionValue VALUE_BUILDS_ANY_OWNED

VALUE_BUILDS_ANY_IF_HOME_OWNED

public static final RuleOptions.OptionValue VALUE_BUILDS_ANY_IF_HOME_OWNED

OPTION_BUILDS

public static final RuleOptions.Option OPTION_BUILDS

VALUE_WINGS_ENABLED

public static final RuleOptions.OptionValue VALUE_WINGS_ENABLED

VALUE_WINGS_DISABLED

public static final RuleOptions.OptionValue VALUE_WINGS_DISABLED

OPTION_WINGS

public static final RuleOptions.Option OPTION_WINGS

VALUE_PATHS_EXPLICIT

public static final RuleOptions.OptionValue VALUE_PATHS_EXPLICIT

VALUE_PATHS_IMPLICIT

public static final RuleOptions.OptionValue VALUE_PATHS_IMPLICIT

VALUE_PATHS_EITHER

public static final RuleOptions.OptionValue VALUE_PATHS_EITHER

OPTION_CONVOYED_MOVES

public static final RuleOptions.Option OPTION_CONVOYED_MOVES

optionMap

protected java.util.HashMap optionMap
Constructor Detail

RuleOptions

public RuleOptions()
Creates a new RuleOptions object, which stores various Rule options.

Method Detail

setOption

public void setOption(RuleOptions.Option option,
                      RuleOptions.OptionValue value)
Sets the OptionValue for an Option.

Null Options or OptionValues are not permitted. If an invalid OptionValue is given, an IllegalArgumentException is thrown.


getOptionValue

public RuleOptions.OptionValue getOptionValue(RuleOptions.Option option)
Obtains the value for an Option. If the Option is not found, or its OptionValue not set, the default OptionValue is returned.

A null Option is not permitted.


getAllOptions

public java.util.Set getAllOptions()
Returns a Set of all Options.


toString

public java.lang.String toString()
For debugging only; print the rule options


createFromVariant

public static RuleOptions createFromVariant(Variant variant)
                                     throws InvalidWorldException
Create a RuleOptions from a Variant.

An InvalidWorldException is thrown if the passed data is invalid.

Throws:
InvalidWorldException


Copyright 2002-2004 Zachary DelProposto / jDip Development Team. All Rights Reserved.