com.strangelight.misc.hex
Class HexPath

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.Vector
                    |
                    +--com.strangelight.misc.hex.HexPath
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.util.List, java.util.RandomAccess, java.io.Serializable

public class HexPath
extends java.util.Vector
implements java.util.List

A List of HexLocation objects.

Note: although the current implementation subclasses Vector, this could change in the future; the List interface is the only one guaranteed to be supported in future versions.

See Also:
Serialized Form

Field Summary
static int MAX_PATH_LENGTH
          the maximum legal HexPath length.
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
HexPath()
           
 
Method Summary
 boolean add(java.lang.Object location)
          adds a HexLocation object to the end of this HexPath.
 java.lang.String toString()
           
 
Methods inherited from class java.util.Vector
add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray
 

Field Detail

MAX_PATH_LENGTH

public static final int MAX_PATH_LENGTH
the maximum legal HexPath length.

For robustness, HexPath objects will not allow themselves to get arbitrarily long. [This value is currently hardcoded at 1000, but eventually implementations should calculate this value as a function of the maximum allowable BOARD size.]

See Also:
java.lang.List#size(), Constant Field Values
Constructor Detail

HexPath

public HexPath()
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.util.Vector

add

public boolean add(java.lang.Object location)
adds a HexLocation object to the end of this HexPath. Note that, for robustness, HexPath objects will not allow themselves to get arbitrarily long.

Specified by:
add in interface java.util.List
Overrides:
add in class java.util.Vector
Parameters:
location - the HexLocation object to add to this path.
Throws:
java.lang.ClassCastException - if location is not a HexLocation.
E_Unexpected - if this HexPath already has MAX_PATH_LENGTH HexLocations.
See Also:
MAX_PATH_LENGTH