Class AbstractHighwayMatrix

    • Constructor Detail

      • AbstractHighwayMatrix

        protected AbstractHighwayMatrix​(List<Highway> highways)
        Constructor. Creates the instance using list of the highways.
        Parameters:
        highways - - highways list
        See Also:
        IHighwayMatrix, Highway
    • Method Detail

      • addHighway

        public int addHighway​(Highway highway)
        Creates new HighwayPtr using specified highway and adds it to the end of highway pointers list.
        Specified by:
        addHighway in interface IHighwayMatrix
        Parameters:
        highway - - the highway to be added to this matrix
        Returns:
        the index of the highway to be added
      • removeHighway

        public Highway removeHighway​(int index)
        Removes the highway pointer at the specified position in the highway pointers list
        Specified by:
        removeHighway in interface IHighwayMatrix
        Parameters:
        index - - the index of the highway to be removed
        Returns:
        the highway that was removed from the matrix
      • getPoints

        protected org.eclipse.draw2d.geometry.PointList getPoints​(int[] path,
                                                                  org.eclipse.draw2d.geometry.Point start,
                                                                  org.eclipse.draw2d.geometry.Point end)
        Creates the points list using specified path.
        Parameters:
        path - - array of the highways indexes
        start - - start point (first element on the returned points list)
        end - - end point (last element on the returned points list)
        Returns:
        the points list
      • getSize

        protected int getSize()
        Gets the size of the highways list
        Returns:
        the size of the highways list
      • getHighway

        public Highway getHighway​(int index)
        Returns the highway at the specified position in list.
        Specified by:
        getHighway in interface IHighwayMatrix
        Parameters:
        index - - index of the highway to return
        Returns:
        the highway at the specified position in this list
        Throws:
        IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= getSize())
      • getIdentifier

        public int getIdentifier​(Highway highway)
        Returns the index of the specified highway, or -1 if highways list does not contain the element.
        Specified by:
        getIdentifier in interface IHighwayMatrix
        Parameters:
        highway - - element to search for
        Returns:
        the index of the specified highway, or -1 if highways list does not contain the element.
        Throws:
        NullPointerException - if the specified element is null
      • getIndex

        protected int getIndex​(AbstractHighwayMatrix.HighwayPtr highway)
        Returns the index of the specified highway pointer
        Parameters:
        highway - - element to search for
        Returns:
        the index of the specified highway pointer
        Throws:
        NullPointerException - if the specified element is null