Class CompositionBase

  • All Implemented Interfaces:
    Graph, GraphWithPerform
    Direct Known Subclasses:
    Delta, Dyadic, Polyadic

    public abstract class CompositionBase
    extends GraphBase

    Base class for graphs that are composed of multiple sub-graphs. This is to provide a home for shared functionality that was previously in Dyadic before refactoring.

    • Constructor Detail

      • CompositionBase

        public CompositionBase()
    • Method Detail

      • reject

        public static <T> java.util.function.Predicate<T> reject​(ClosableIterator<? extends T> i)

        Answer a Predicate that will reject any element that is a member of iterator i. As a side-effect, i will be closed.

        Parameters:
        i - A closable iterator
        Returns:
        A Predicate that will accept any object not a member of i.
      • butNot

        public static <T> ClosableIterator<T> butNot​(ClosableIterator<T> a,
                                                     ClosableIterator<? extends T> b)

        Answer an iterator over the elements of iterator a that are not members of iterator b. As a side-effect, iterator b will be closed.

        Parameters:
        a - An iterator that will be filtered by rejecting the elements of b
        b - A closable iterator
        Returns:
        The iteration of elements in a but not in b.
      • recording

        public static <T> ExtendedIterator<T> recording​(ClosableIterator<T> i,
                                                        java.util.Set<T> seen)

        Answer an iterator that will record every element delived by next() in the set seen.

        Parameters:
        i - A closable iterator
        seen - A set that will record each element of i in turn
        Returns:
        An iterator that records the elements of i.
      • rejecting

        public static ExtendedIterator<Triple> rejecting​(ExtendedIterator<Triple> i,
                                                         java.util.Set<Triple> seen)

        Answer an iterator over the elements of iterator i that are not in the set seen.

        Parameters:
        i - An extended iterator
        seen - A set of objects
        Returns:
        An iterator over the elements of i that are not in the set seen.
      • ifIn

        public static <T> java.util.function.Predicate<T> ifIn​(ClosableIterator<T> i)

        Answer a Predicate that will accept any object that is an element of iterator i. As a side-effect, i will be evaluated and closed.

        Parameters:
        i - A closable iterator
        Returns:
        A Predicate that will accept any object in iterator i.
      • ifIn

        public static java.util.function.Predicate<Triple> ifIn​(Graph g)

        Answer a Predicate that will accept any triple that is an edge of graph g.

        Parameters:
        g - A graph
        Returns:
        A Predicate that will accept any triple that is an edge in g.