Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.newdawn.slick.util.pathfinding
Class Path

    java.lang.Object
      org.newdawn.slick.util.pathfinding.Path

All Implemented Interfaces:
  java.io.Serializable

    public class Path

extends java.lang.Object
implements java.io.Serializable

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.

Author:
  Kevin Glass
See Also:
  Serialized Form

Nested Class Summary
`class` | `Path.Step` A single step within the path

Constructor Summary
`Path()` Create an empty path

Method Summary
`void` | `appendStep(int x, int y)` Append a step to the path.
`boolean` | `contains(int x, int y)` Check if this path contains the given step
`int` | `getLength()` Get the length of the path, i.e.
`Path.Step` | `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
`void` | `prependStep(int x, int y)` Prepend a step to the path.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Path

    public Path()

  Create an empty path

Method Detail

### 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

### appendStep

    public void appendStep(int x,
                           int y)

  Append a step to the path.

  Parameters:
    `x` - The x coordinate of the new step
    `y` - The y coordinate of the new step

### prependStep

    public void prependStep(int x,
                            int y)

  Prepend 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)

  Check if this path contains the given step

  Parameters:
    `x` - The x coordinate of the step to check for
    `y` - The y coordinate of the step to check for
  Returns:
    True if the path contains the given step

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006 New Dawn Software. All Rights Reserved.