Class S2EdgeQuery.MergedEdges

  • All Implemented Interfaces:
    S2EdgeQuery.Edges
    Enclosing class:
    S2EdgeQuery

    private static final class S2EdgeQuery.MergedEdges
    extends java.lang.Object
    implements S2EdgeQuery.Edges
    An Edges implementation optimized for merging edges from multiple S2ClippedShapes already in sorted order.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) java.util.PriorityQueue<S2EdgeQuery.Stepper> steppers  
      (package private) S2EdgeQuery.Stepper top
      The top of the priority queue (the stepper which currently has the least value for currentEdge).
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private MergedEdges()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(S2ShapeIndex.S2ClippedShape shape)
      Note: shape should have at least one edge.
      boolean isEmpty()
      Returns true if there are no more edges.
      int nextEdge()
      Returns the next edge ID, or throws an exception if empty.
      private void removeFromPriorityQueue​(int n)
      Updates the priority queue steppers so that no stepper in the queue will return n if currentEdge() is called on it.
      • Methods inherited from class java.lang.Object

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

      • top

        S2EdgeQuery.Stepper top
        The top of the priority queue (the stepper which currently has the least value for currentEdge). It is stored separately as an optimization, to avoid repeatedly adding and polling it from the top of the queue.
    • Constructor Detail

      • MergedEdges

        private MergedEdges()
    • Method Detail

      • removeFromPriorityQueue

        private void removeFromPriorityQueue​(int n)
        Updates the priority queue steppers so that no stepper in the queue will return n if currentEdge() is called on it.