Class Path

java.lang.Object
zombie.ai.astar.Path

public class Path extends Object
A path determined by some path finding algorithm. A series of steps from the starting location to the target location. This includes a step for the initial location.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    A single step within the path
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    float
     
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create an empty path
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    appendStep(int x, int y, int z)
    Append a step to the path.
    boolean
    contains(int x, int y, int z)
     
    float
     
    static Path.Step
     
    int
    get the length of the path, i.e.
    getStep(int index)
    get the step at a given index in the path
    int
    getX(int index)
    get the x coordinate for the step at the given index
    int
    getY(int index)
    get the y coordinate for the step at the given index
    int
    getZ(int index)
     
    void
    prependStep(int x, int y, int z)
    Prepend a step to the path.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • cost

      public float cost
    • stepstore

      public static Stack<Path.Step> stepstore
  • Constructor Details

    • Path

      public Path()
      Create an empty path
  • Method Details

    • costPerStep

      public float costPerStep()
    • appendStep

      public void appendStep(int x, int y, int z)
      Append a step to the path.
      Parameters:
      x - The x coordinate of the new step
      y - The y coordinate of the new step
    • contains

      public boolean contains(int x, int y, int z)
    • getLength

      public int getLength()
      get the length of the path, i.e. the number of steps
      Returns:
      The number of steps in this path
    • getStep

      public Path.Step getStep(int index)
      get the step at a given index in the path
      Parameters:
      index - The index of the step to retrieve. Note this should be >= 0 and < getLength();
      Returns:
      The step information, the position on the map.
    • getX

      public int getX(int index)
      get the x coordinate for the step at the given index
      Parameters:
      index - The index of the step whose x coordinate should be retrieved
      Returns:
      The x coordinate at the step
    • getY

      public int getY(int index)
      get the y coordinate for the step at the given index
      Parameters:
      index - The index of the step whose y coordinate should be retrieved
      Returns:
      The y coordinate at the step
    • getZ

      public int getZ(int index)
    • createStep

      public static Path.Step createStep()
    • prependStep

      public void prependStep(int x, int y, int z)
      Prepend a step to the path.
      Parameters:
      x - The x coordinate of the new step
      y - The y coordinate of the new step