Interface NeighborProvider

  • Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface NeighborProvider
    Provides the neighbor relationships for a given shape.
    • Method Detail

      • getNeighbors

        java.util.List<Relationship> getNeighbors​(Shape shape)
        Gets the neighbor relationships of a shape.
        Parameters:
        shape - Shape to get neighbors for.
        Returns:
        Returns the found neighbors.
      • of

        static NeighborProvider of​(Model model)
        Creates a default NeighborProvider for the given model.
        Parameters:
        model - Model to create a neighbor provider for.
        Returns:
        Returns the created neighbor provider.
      • precomputed

        static NeighborProvider precomputed​(Model model)
        Creates a NeighborProvider that precomputes the neighbors of a model.
        Parameters:
        model - Model to create a neighbor provider for.
        Returns:
        Returns the created neighbor provider.
      • withTraitRelationships

        static NeighborProvider withTraitRelationships​(Model model,
                                                       NeighborProvider neighborProvider)
        Creates a NeighborProvider that includes RelationshipType.TRAIT relationships.
        Parameters:
        model - Model to use to look up trait shapes.
        neighborProvider - Provider to wrap.
        Returns:
        Returns the created neighbor provider.
      • withIdRefRelationships

        static NeighborProvider withIdRefRelationships​(Model model,
                                                       NeighborProvider neighborProvider)
        Creates a NeighborProvider that includes RelationshipType.ID_REF relationships.
        Parameters:
        model - Model to use to look up shapes referenced by IdRefTrait.
        neighborProvider - Provider to wrap.
        Returns:
        Returns the created neighbor provider.
      • precomputed

        static NeighborProvider precomputed​(Model model,
                                            NeighborProvider provider)
        Creates a NeighborProvider that precomputes the neighbors of a model.
        Parameters:
        model - Model to create a neighbor provider for.
        provider - Provider to use when precomputing.
        Returns:
        Returns the created neighbor provider.
      • reverse

        static NeighborProvider reverse​(Model model)
        Returns a NeighborProvider that returns relationships that point at a given shape rather than relationships that the given shape points at.
        Parameters:
        model - Model to build reverse relationships from.
        Returns:
        Returns the reverse neighbor provider.
      • reverse

        static NeighborProvider reverse​(Model model,
                                        NeighborProvider forwardProvider)
        Returns a NeighborProvider that returns relationships that point at a given shape rather than relationships that the given shape points at.
        Parameters:
        model - Model to build reverse relationships from.
        forwardProvider - The forward directed neighbor provider to grab relationships from.
        Returns:
        Returns the reverse neighbor provider.
      • cached

        static NeighborProvider cached​(NeighborProvider provider)
        Caches the results of calling a delegate provider.
        Parameters:
        provider - Provider to delegate to and cache.
        Returns:
        Returns the thread-safe caching neighbor provider.