Class GreatArcPath

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  GreatArcPath.Builder
      Class used to build arc paths.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.List<GreatArc> arcs
      Arcs comprising the instance.
      private static GreatArcPath EMPTY
      Instance containing no arcs.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private GreatArcPath​(java.util.List<GreatArc> arcs)
      Simple constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.stream.Stream<GreatArc> boundaryStream()
      Return a stream containing the boundaries for this instance.
      static GreatArcPath.Builder builder​(org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
      Return a GreatArcPath.Builder instance configured with the given precision context.
      static GreatArcPath empty()
      Get an instance containing no arcs.
      static GreatArcPath fromArcs​(java.util.Collection<GreatArc> arcs)
      Construct a new path from the given arcs.
      static GreatArcPath fromArcs​(GreatArc... arcs)
      Construct a new path from the given arcs.
      static GreatArcPath fromVertexLoop​(java.util.Collection<Point2S> vertices, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
      Return a new path formed by connecting the given vertices.
      static GreatArcPath fromVertices​(java.util.Collection<Point2S> vertices, boolean close, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
      Return a new path formed by connecting the given vertices.
      static GreatArcPath fromVertices​(java.util.Collection<Point2S> vertices, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
      Return a new path formed by connecting the given vertices.
      java.util.List<GreatArc> getArcs()
      Get the arcs in path.
      GreatArc getEndArc()
      Get the end arc for the path or null if the path is empty.
      Point2S getEndVertex()
      Get the end vertex for the path or null if the path is empty or consists of a single, full arc.
      GreatArc getStartArc()
      Get the start arc for the path or null if the path is empty.
      Point2S getStartVertex()
      Get the start vertex for the path or null if the path is empty or consists of a single, full arc.
      java.util.List<Point2S> getVertices()
      Get the vertices contained in the path in the order they appear.
      boolean isClosed()
      Return true if the path is closed, meaning that the end point for the last arc is equal to the start point for the path.
      boolean isEmpty()
      Return true if the path does not contain any arcs.
      java.lang.String toString()
      Return a string representation of this arc path instance.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • EMPTY

        private static final GreatArcPath EMPTY
        Instance containing no arcs.
      • arcs

        private final java.util.List<GreatArc> arcs
        Arcs comprising the instance.
    • Constructor Detail

      • GreatArcPath

        private GreatArcPath​(java.util.List<GreatArc> arcs)
        Simple constructor. No validation is performed on the input arc.
        Parameters:
        arcs - arcs for the path, in connection order
    • Method Detail

      • boundaryStream

        public java.util.stream.Stream<GreatArc> boundaryStream()
        Return a stream containing the boundaries for this instance.
        Specified by:
        boundaryStream in interface BoundarySource<GreatArc>
        Returns:
        a stream containing the boundaries for this instance
      • getArcs

        public java.util.List<GreatArc> getArcs()
        Get the arcs in path.
        Returns:
        the arcs in the path
      • getStartArc

        public GreatArc getStartArc()
        Get the start arc for the path or null if the path is empty.
        Returns:
        the start arc for the path or null if the path is empty
      • getEndArc

        public GreatArc getEndArc()
        Get the end arc for the path or null if the path is empty.
        Returns:
        the end arc for the path or null if the path is empty
      • getStartVertex

        public Point2S getStartVertex()
        Get the start vertex for the path or null if the path is empty or consists of a single, full arc.
        Returns:
        the start vertex for the path
      • getEndVertex

        public Point2S getEndVertex()
        Get the end vertex for the path or null if the path is empty or consists of a single, full arc.
        Returns:
        the end vertex for the path
      • getVertices

        public java.util.List<Point2S> getVertices()
        Get the vertices contained in the path in the order they appear. Closed paths contain the start vertex at the beginning of the list as well as the end.
        Returns:
        the vertices contained in the path in order they appear
      • isEmpty

        public boolean isEmpty()
        Return true if the path does not contain any arcs.
        Returns:
        true if the path does not contain any arcs
      • isClosed

        public boolean isClosed()
        Return true if the path is closed, meaning that the end point for the last arc is equal to the start point for the path.
        Returns:
        true if the end point for the last arc is equal to the start point for the path
      • toString

        public java.lang.String toString()
        Return a string representation of this arc path instance.

        In order to keep the string representation short but useful, the exact format of the return value depends on the properties of the path. See below for examples.

        • Empty path
          • GreatArcPath[empty= true]
        • Single, full arc
          • GreatArcPath[full= true, circle= GreatCircle[pole= (0.0, 0.0, 1.0), x= (0.0, 1.0, -0.0), y= (-1.0, 0.0, 0.0)]]
        • One or more non-full arcs
          • GreatArcPath[vertices= [(0.0, 1.5707963267948966), (1.5707963267948966, 1.5707963267948966)]]
        Overrides:
        toString in class java.lang.Object
      • fromArcs

        public static GreatArcPath fromArcs​(GreatArc... arcs)
        Construct a new path from the given arcs.
        Parameters:
        arcs - arc instance to use to construct the path
        Returns:
        a new instance constructed from the given arc instances
      • fromArcs

        public static GreatArcPath fromArcs​(java.util.Collection<GreatArc> arcs)
        Construct a new path from the given arcs.
        Parameters:
        arcs - arc instance to use to construct the path
        Returns:
        a new instance constructed from the given arc instances
      • fromVertexLoop

        public static GreatArcPath fromVertexLoop​(java.util.Collection<Point2S> vertices,
                                                  org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
        Return a new path formed by connecting the given vertices. An additional arc is added from the last point to the first point to construct a loop, if the two points are not already considered equal by the given precision context. This method is equivalent to calling fromPoints(points, true, precision).
        Parameters:
        vertices - the points to construct the path from
        precision - precision precision context used to construct the arc instances for the path
        Returns:
        a new path formed by connecting the given vertices
        See Also:
        fromVertices(Collection, boolean, Precision.DoubleEquivalence)
      • fromVertices

        public static GreatArcPath fromVertices​(java.util.Collection<Point2S> vertices,
                                                org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
        Return a new path formed by connecting the given vertices. No additional arc is inserted to connect the last point to the first. This method is equivalent to calling fromPoint(points, false, precision).
        Parameters:
        vertices - the points to construct the path from
        precision - precision context used to construct the arc instances for the path
        Returns:
        a new path formed by connecting the given vertices
        See Also:
        fromVertices(Collection, boolean, Precision.DoubleEquivalence)
      • fromVertices

        public static GreatArcPath fromVertices​(java.util.Collection<Point2S> vertices,
                                                boolean close,
                                                org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
        Return a new path formed by connecting the given vertices.
        Parameters:
        vertices - the points to construct the path from
        close - if true, then an additional arc will be added from the last point to the first, if the points are not already considered equal by the given precision context
        precision - precision context used to construct the arc instances for the path
        Returns:
        a new path formed by connecting the given points
      • builder

        public static GreatArcPath.Builder builder​(org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
        Return a GreatArcPath.Builder instance configured with the given precision context. The precision context is used when building arcs from points and may be omitted if raw points are not used.
        Parameters:
        precision - precision context to use when building arcs from raw points; may be null if raw points are not used.
        Returns:
        a new GreatArcPath.Builder instance
      • empty

        public static GreatArcPath empty()
        Get an instance containing no arcs.
        Returns:
        an instance containing no arcs