dip.world
Class Province.Adjacency

java.lang.Object
  extended bydip.world.Province.Adjacency
All Implemented Interfaces:
java.io.Serializable
Enclosing class:
Province

protected static class Province.Adjacency
extends java.lang.Object
implements java.io.Serializable

Adjacency maintains the connectivity graph between provinces.

See Also:
Serialized Form

Method Summary
protected  void createWingCoasts()
          Creates a WING coast from Province coastal data.
protected  Location[] getLocations(Coast coast)
          Gets the locations which are adjacent to the coast.
protected  void setLocations(Coast coast, Location[] locations)
          Sets which locations are adjacent to the specified coast.
protected  boolean validate(Province p)
          Ensure that adjacency data is consistent, and that there are no illegal coast combinations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setLocations

protected void setLocations(Coast coast,
                            Location[] locations)
Sets which locations are adjacent to the specified coast.


getLocations

protected Location[] getLocations(Coast coast)
Gets the locations which are adjacent to the coast.

If no locations are adjacent, a zero-length array is returned.


createWingCoasts

protected void createWingCoasts()
Creates a WING coast from Province coastal data. All Coasts must be set for this Province already. Note that a Wing coast is equiavalent to 'touching' adjacency.


validate

protected boolean validate(Province p)
Ensure that adjacency data is consistent, and that there are no illegal coast combinations.

The Province argument is required to correctly validate convoyable coast regions. Convoyable coasts require a single or multi-coast region with a defined land coast. land / single / north / south / west / east x = true; - = false; ? = true or false L S N S W E =========================================== - - ? ? ? ? INVALID (a) where at least one ? is true - x ? ? ? ? INVALID (b) where at least one ? is true x x ? ? ? ? INVALID (c) where at least one ? is true - - - - - - INVALID (d)



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