Class AbstractPath<E>

  • All Implemented Interfaces:
    java.lang.Iterable<E>, java.util.Collection<E>, java.util.List<E>
    Direct Known Subclasses:
    GlobalPath, LocalPath

    public abstract class AbstractPath<E>
    extends java.util.AbstractList<E>
    Created with IntelliJ IDEA.
    Since:
    : 1/22/2015 Time : 12:47 AM
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractPath()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean add​(E e)  
      boolean addAll​(E... e)  
      boolean addAll​(java.util.Collection<? extends E> c)  
      void addToFront​(E e)  
      void clear()  
      PathDirection direction()
      Gets the PathDirection
      E first()  
      E get​(int index)  
      PathObstacle getObstacleForTile​(E tile)
      Gets a PathObstacle for a given tile
      int indexOf​(java.lang.Object o)  
      boolean isObstacleTile​(E tile)
      Checks if the tile has an obstacle on it
      java.util.Iterator<E> iterator()  
      E last()  
      java.util.ListIterator<E> listIterator()  
      abstract E next()
      Gets the next node in the path
      java.util.Map<E,​PathObstacle> obstacles()
      Gets a Map of the obstacles for the path
      java.util.List<E> path()
      Gets the path
      boolean remove​(java.lang.Object o)  
      void reverse()
      Reverses the path
      void setDirection​(PathDirection direction)
      Sets the PathDirection
      int size()  
      abstract boolean walk()
      Walks the next point in the path
      • Methods inherited from class java.util.AbstractList

        add, addAll, equals, hashCode, lastIndexOf, listIterator, remove, set, subList
      • Methods inherited from class java.util.AbstractCollection

        contains, containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toString
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.List

        contains, containsAll, isEmpty, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
    • Constructor Detail

      • AbstractPath

        public AbstractPath()
    • Method Detail

      • iterator

        public java.util.Iterator<E> iterator()
        Specified by:
        iterator in interface java.util.Collection<E>
        Specified by:
        iterator in interface java.lang.Iterable<E>
        Specified by:
        iterator in interface java.util.List<E>
        Overrides:
        iterator in class java.util.AbstractList<E>
      • listIterator

        public java.util.ListIterator<E> listIterator()
        Specified by:
        listIterator in interface java.util.List<E>
        Overrides:
        listIterator in class java.util.AbstractList<E>
      • indexOf

        public int indexOf​(java.lang.Object o)
        Specified by:
        indexOf in interface java.util.List<E>
        Overrides:
        indexOf in class java.util.AbstractList<E>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<E>
        Specified by:
        clear in interface java.util.List<E>
        Overrides:
        clear in class java.util.AbstractList<E>
      • first

        public E first()
      • last

        public E last()
      • addToFront

        public void addToFront​(E e)
      • add

        public boolean add​(E e)
        Specified by:
        add in interface java.util.Collection<E>
        Specified by:
        add in interface java.util.List<E>
        Overrides:
        add in class java.util.AbstractList<E>
      • get

        public E get​(int index)
        Specified by:
        get in interface java.util.List<E>
        Specified by:
        get in class java.util.AbstractList<E>
      • path

        public java.util.List<E> path()
        Gets the path
        Returns:
        List of E
      • remove

        public boolean remove​(java.lang.Object o)
        Specified by:
        remove in interface java.util.Collection<E>
        Specified by:
        remove in interface java.util.List<E>
        Overrides:
        remove in class java.util.AbstractCollection<E>
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<E>
        Specified by:
        size in interface java.util.List<E>
        Specified by:
        size in class java.util.AbstractCollection<E>
      • addAll

        public boolean addAll​(java.util.Collection<? extends E> c)
        Specified by:
        addAll in interface java.util.Collection<E>
        Specified by:
        addAll in interface java.util.List<E>
        Overrides:
        addAll in class java.util.AbstractCollection<E>
      • addAll

        @SafeVarargs
        public final boolean addAll​(E... e)
      • direction

        public PathDirection direction()
        Gets the PathDirection
        Returns:
        PathDirection
      • setDirection

        public void setDirection​(PathDirection direction)
        Sets the PathDirection
        Parameters:
        direction - PathDirection
      • obstacles

        public java.util.Map<E,​PathObstacle> obstacles()
        Gets a Map of the obstacles for the path
        Returns:
        Map with key E and value PathObstacle
      • isObstacleTile

        public boolean isObstacleTile​(E tile)
        Checks if the tile has an obstacle on it
        Parameters:
        tile - Tile to check
        Returns:
        True if it has an obstacle, else false
      • getObstacleForTile

        public PathObstacle getObstacleForTile​(E tile)
        Gets a PathObstacle for a given tile
        Parameters:
        tile - Tile to get obstacle on
        Returns:
        PathObstacle or null
      • reverse

        public void reverse()
        Reverses the path
      • walk

        public abstract boolean walk()
        Walks the next point in the path
        Returns:
        True if walked, else false
      • next

        public abstract E next()
        Gets the next node in the path
        Returns:
        E