Class S2ShapeAspect.ChainAspect.Simple

    • Constructor Detail

      • Simple

        public Simple()
    • Method Detail

      • numChains

        public int numChains()
        Description copied from interface: S2Shape
        Returns the number of contiguous edge chains in the shape. For example, a shape whose edges are [AB, BC, CD, AE, EF] may consist of two chains [A, B, C, D] and [A, E, F]. Every chain is assigned a chain id numbered sequentially starting from zero.

        An empty shape has no chains. A full shape (which contains the entire globe) has one chain with no edges. Other shapes should have at least one chain, and the sum of all valid chain lengths should equal S2Shape.numEdges() (that is, edges may only be used by a single chain).

        Note that it is always acceptable to implement this method by returning S2Shape.numEdges() (i.e. every chain consists of a single edge), but this may reduce the efficiency of some algorithms.

        Specified by:
        numChains in interface S2Shape
        Specified by:
        numChains in interface S2ShapeAspect.ChainAspect
      • getChainStart

        public int getChainStart​(int chainId)
        Description copied from interface: S2Shape
        Returns the first edge id corresponding to the edge chain for the given chain id. The edge chains must form contiguous, non-overlapping ranges that cover the entire range of edge ids.
        Specified by:
        getChainStart in interface S2Shape
        Specified by:
        getChainStart in interface S2ShapeAspect.ChainAspect
        Parameters:
        chainId - which edge chain to return its start, from 0 to S2Shape.numChains() - 1
      • getChainLength

        public int getChainLength​(int chainId)
        Description copied from interface: S2Shape
        Returns the number of edge ids corresponding to the edge chain for the given chain id. The edge chains must form contiguous, non-overlapping ranges that cover the entire range of edge ids.
        Specified by:
        getChainLength in interface S2Shape
        Specified by:
        getChainLength in interface S2ShapeAspect.ChainAspect
        Parameters:
        chainId - which edge chain to return its length, from 0 to S2Shape.numChains() - 1