Class PathImpl

java.lang.Object
de.bsommerfeld.pathetic.engine.result.PathImpl
All Implemented Interfaces:
Path, Iterable<PathPosition>

public class PathImpl extends Object implements Path
  • Constructor Details

  • Method Details

    • getStart

      public PathPosition getStart()
      Description copied from interface: Path
      Returns the start position of the path
      Specified by:
      getStart in interface Path
      Returns:
      PathPosition The position of the start
    • getEnd

      public PathPosition getEnd()
      Description copied from interface: Path
      Returns the target position of the path
      Specified by:
      getEnd in interface Path
      Returns:
      PathPosition The position of the target
    • iterator

      public Iterator<PathPosition> iterator()
      Specified by:
      iterator in interface Iterable<PathPosition>
    • forEach

      public void forEach(Consumer<? super PathPosition> action)
      Specified by:
      forEach in interface Iterable<PathPosition>
    • interpolate

      public Path interpolate(double resolution)
      Deprecated.
      Delegates to PathUtils - you should use that too!
      Description copied from interface: Path
      Interpolates the positions of this Path to a new Path with the given resolution.

      The resulting path will have additional positions inserted between consecutive positions in the original path such that no two consecutive positions are more than `resolution` blocks apart. The interpolated positions are computed using linear interpolation, which means that the resulting path will have a smooth curve that passes through each of the original positions.

      Specified by:
      interpolate in interface Path
      Parameters:
      resolution - The desired distance between consecutive positions in the resulting path, in blocks. A lower value will result in a higher resolution and a smoother curve, but will also increase the number of positions in the resulting path and possibly reduce performance.
      Returns:
      a newly created Path with interpolated positions.
    • simplify

      public Path simplify(double epsilon)
      Deprecated.
      Delegates to PathUtils - you should use that too!
      Description copied from interface: Path
      Simplifies the path by removing intermediate positions based on the given epsilon value. The start and end positions are always included in the simplified path.
      Specified by:
      simplify in interface Path
      Parameters:
      epsilon - the epsilon value representing the fraction of positions to keep (should be in the range greater than 0.0 to 1.0, inclusive)
      Returns:
      a simplified path containing a subset of positions from the original path
    • join

      public Path join(Path path)
      Deprecated.
      Delegates to PathUtils - you should use that too!
      Description copied from interface: Path
      Joins this Path with the given Path.
      Specified by:
      join in interface Path
      Parameters:
      path - which will be appended at the end.
      Returns:
      Path the new Path
    • trim

      public Path trim(int length)
      Deprecated.
      Delegates to PathUtils - you should use that too!
      Description copied from interface: Path
      Trims this Path to the given length.
      Specified by:
      trim in interface Path
      Parameters:
      length - the length to which the Path will be trimmed.
      Returns:
      Path the new Path
    • mutatePositions

      public Path mutatePositions(ParameterizedSupplier<PathPosition> mutator)
      Deprecated.
      Delegates to PathUtils - you should use that too!
      Description copied from interface: Path
      Mutates each of the positions in the path with the given consumer
      Specified by:
      mutatePositions in interface Path
      Parameters:
      mutator - the ParameterizedSupplier to mutate the positions with
      Returns:
      Path the new Path
    • length

      public int length()
      Description copied from interface: Path
      The length of the Path compiled from the number of positions
      Specified by:
      length in interface Path
      Returns:
      the length of the path
    • collect

      public Collection<PathPosition> collect()
      Description copied from interface: Path
      Returns a new Collection of the Path Positions of the path.
      Specified by:
      collect in interface Path
      Returns:
      Collection of the PathPositions