dip.world
Class Border

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

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

A Border limits movement or support between 2 provinces. A Border object is immutable. The DTD for a Border object is:
<!ATTLIST BORDER
id ID #REQUIRED
description CDATA #REQUIRED
from CDATA #IMPLIED
unitTypes CDATA #IMPLIED
orderTypes CDATA #IMPLIED
year CDATA #IMPLIED
season CDATA #IMPLIED
phase CDATA #IMPLIED
baseMoveModifier CDATA #IMPLIED
>

Therefore, all fields are optional except for "id" and "description". If a field is not specified, it is assumed to apply to all types. Therefore: a border with a unitType of "Army" and year of "1900, 2000" would prohibit Armies from passing during the 1900 to 2000 years. However, if the unitType was omitted, no unit could pass (Army, Wing, or Fleet) from 1900 to 2000 years.

All specified items (except baseMoveModifier, thus from/unitTypes/ orderTypes/year/season/phase) must match for the Border to prohibit crossing.

Borders apply to ANY crossing; this includes Movement as well as Support.

Field Values:

See Also:
Serialized Form

Constructor Summary
Border(java.lang.String id, java.lang.String description, java.lang.String units, Location[] from, java.lang.String orders, java.lang.String baseMoveModifier, java.lang.String season, java.lang.String phase, java.lang.String year)
          Constructor.
 
Method Summary
 boolean canTransit(Location fromLoc, Unit.Type unit, Phase phase, java.lang.Class orderClass)
          Determines if a unit can transit from a location to this location.
 boolean canTransit(Phase phase, Order order)
          Determines if a unit can transit from a location to this location.
 int getBaseMoveModifier(Location moveFrom)
          Gets the base move modifier.
 java.lang.String getDescription()
          Returns the description
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Border

public Border(java.lang.String id,
              java.lang.String description,
              java.lang.String units,
              Location[] from,
              java.lang.String orders,
              java.lang.String baseMoveModifier,
              java.lang.String season,
              java.lang.String phase,
              java.lang.String year)
       throws dip.world.InvalidBorderException
Constructor. The String arguments are parsed; if they are not valid, an InvalidBorderException will be thrown. It is not recommended that null arguments are given. Instead, use empty strings or public constants where appropriate.

The from Locations may be null, if that field is empty.

Throws:
InvalidBorderException - if any arguments are invalid.
java.lang.IllegalArgumentException - if id, description, or prohibited is null
Method Detail

canTransit

public boolean canTransit(Phase phase,
                          Order order)
Determines if a unit can transit from a location to this location.

Convenience method for more verbose canTransit() method. No arguments may be null.


canTransit

public boolean canTransit(Location fromLoc,
                          Unit.Type unit,
                          Phase phase,
                          java.lang.Class orderClass)
Determines if a unit can transit from a location to this location.

All defined border attributes have to match to prohibit border transit.

Null arguments are not permitted.


getBaseMoveModifier

public int getBaseMoveModifier(Location moveFrom)
Gets the base move modifier. Requires a non-null from location.


getDescription

public java.lang.String getDescription()
Returns the description



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