com.c5corp.c5Algorithms
Class AbstractHiker

java.lang.Object
  extended by com.c5corp.c5Algorithms.AbstractHiker
Direct Known Subclasses:
LcpHiker, McpHiker, OtherPathHiker, RandomHiker, SlopeReductionHiker, StepwiseArcHiker

public abstract class AbstractHiker
extends java.lang.Object

The Abstract Hiker class it the parent to all hikers. It contains static final members and utility methods unique to all hikers.

Since:
2.0

Field Summary
protected static int[] CARDINAL_BITS
          CARDINAL_BITS, which also include intercardinal primary directions, are arranged declared in the array in the following order: {N_BIT,NE_BIT,E_BIT,SE_BIT,S_BIT,SW_BIT,W_BIT,NW_BIT}.
protected static int[][] MOVE
          The array MOVE can be indexed into for pairs (of two element arrays) that move the hiker through the table (the landscape) based on the corresponding index into CARDINAL_BITS.
protected  UtmCoordinatePairElev[][] table
          All hikers are assumed to have a table of representing the landscape that the Virtual Hiker will hike through.
 
Constructor Summary
AbstractHiker()
           
 
Method Summary
protected static int calculateAzimuth(UtmCoordinatePairElev begin, UtmCoordinatePairElev destination)
          Returns an int from 0 to 359 representing the azimuth angle between Point begin and Point destination.
protected static int calculateCardinalDirection(UtmCoordinatePairElev begin, UtmCoordinatePairElev destination)
          Returns the closest of eight CARDINAL_BITS representing the azimuth from UtmCoordinatePairElev begin to UtmCoordinatePairElev destination.
protected static int getCardinalIndex(int direction)
          Protected helper method to index into the protected parallel array MOVE for the index of a directional x,y coordinate pair describing a move through the grid.
static double getDistance(UtmCoordinatePair one, UtmCoordinatePair two)
          getDistance is a utility method returning the distance between two UtmCoordinatePair objects.
 UtmCoordinatePairElev[][] getTable()
          All hikers (children of AbstractHiker) have a table of representing the landscape that the Virtual Hiker will hike through.
abstract  VirtualHikerTrackLog getTrack()
          Returns a VirtualHikerTrackLog object containing the results of a artificial hiking algorithm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

table

protected UtmCoordinatePairElev[][] table
All hikers are assumed to have a table of representing the landscape that the Virtual Hiker will hike through.


CARDINAL_BITS

protected static final int[] CARDINAL_BITS
CARDINAL_BITS, which also include intercardinal primary directions, are arranged declared in the array in the following order: {N_BIT,NE_BIT,E_BIT,SE_BIT,S_BIT,SW_BIT,W_BIT,NW_BIT}.


MOVE

protected static final int[][] MOVE
The array MOVE can be indexed into for pairs (of two element arrays) that move the hiker through the table (the landscape) based on the corresponding index into CARDINAL_BITS. Note that the North and South values in the table array are seemingly inverted relative to the indexes because DEM columns are indexed inverse to to North and South.

See Also:
table, MOVE, CARDINAL_BITS
Constructor Detail

AbstractHiker

public AbstractHiker()
Method Detail

getTrack

public abstract VirtualHikerTrackLog getTrack()
Returns a VirtualHikerTrackLog object containing the results of a artificial hiking algorithm. It picks the best track the subclass hiking algorithm has to offer.

Returns:
a VirtualHikerTrackLog representing the virtual hike

getCardinalIndex

protected static int getCardinalIndex(int direction)
Protected helper method to index into the protected parallel array MOVE for the index of a directional x,y coordinate pair describing a move through the grid.

Parameters:
direction - the index into CARDINAL_BITS representing the direction
Returns:
the index into MOVE representing the correct move through table
See Also:
MOVE, CARDINAL_BITS, table

calculateCardinalDirection

protected static int calculateCardinalDirection(UtmCoordinatePairElev begin,
                                                UtmCoordinatePairElev destination)
Returns the closest of eight CARDINAL_BITS representing the azimuth from UtmCoordinatePairElev begin to UtmCoordinatePairElev destination. A sentinel value of -1 is returned if a direction can not be determined. See the calculateAzimuth(UtmCoordinatePairElev, UtmCoordinatePairElev) method for the meaning of these sentinel values.

Parameters:
begin - UtmCoordinatePairElev object representing the current location
destination - UtmCoordinatePairElev object representing the place we want to go
Returns:
an int representing the intercardinal direction, see public final static int[] CARDINAL_BITS
See Also:
CARDINAL_BITS, calculateAzimuth(UtmCoordinatePairElev begin, UtmCoordinatePairElev destination)

calculateAzimuth

protected static int calculateAzimuth(UtmCoordinatePairElev begin,
                                      UtmCoordinatePairElev destination)
Returns an int from 0 to 359 representing the azimuth angle between Point begin and Point destination. It returns a value relative to UTM grid north. A sentinel value of -1 is returned if the two points are the same.

Parameters:
begin - UtmCoordinatePairElev object representing the current location
destination - UtmCoordinatePairElev object representing the place we want to go
Returns:
an int representing the direction in degrees
See Also:
calculateAzimuth(UtmCoordinatePairElev begin, UtmCoordinatePairElev destination)

getDistance

public static double getDistance(UtmCoordinatePair one,
                                 UtmCoordinatePair two)
getDistance is a utility method returning the distance between two UtmCoordinatePair objects.

Parameters:
one - the first coordinate
two - the first coordinate
Returns:
the distance

getTable

public UtmCoordinatePairElev[][] getTable()
All hikers (children of AbstractHiker) have a table of representing the landscape that the Virtual Hiker will hike through. There is no requirement that the hiker use this table, but the reference will be there. Since it takes each concrete subclass of AbstractHiker some amount of work to create this table, this method exists to make it easily available for other related uses. The VirtualHikerTrackLog class, for example, uses it to determine perpendicular slope.

Returns:
a UtmCoordinatePairElev[][] array representing the area the vhiker searched
See Also:
VirtualHikerTrackLog