Class Multimaps

java.lang.Object
eu.bandm.tools.ops.Multimaps

public final class Multimaps extends Object
Library of constants and combinators for classes implementing Multimap.
  • Method Details

    • cache

      public static <A> Comparator<A> cache(Comparator<? super A> c)
      Cache comparator results
    • intoMap

      public static <A, B> Map<A,B> intoMap(Multimap<A,B> in, Map<A,B> out)
      Adds the pairs from a Multimap into a Map, if possible.
      Parameters:
      out - Map which is updated. Needs not be empty.
      in - MultiMap to copy to the map
      Throws:
      RuntimeException - iff the contents of in plus out do not represent a map in the mathematical sense.
    • empty

      public static <A, B> Multimap<A,B> empty()
    • singleton

      public static <A, B> Multimap<A,B> singleton(A a, B b)
    • id

      public static <A> Multimap<A,A> id(Set<A> support)
    • all

      public static <A, B> Multimap<A,B> all(A dom, Set<B> ran)
      FIXME DOC
    • all

      public static <A, B> Multimap<A,B> all(Set<A> dom, B ran)
      FIXME DOC
    • all

      public static <A, B> Multimap<A,B> all(Set<A> dom, Set<B> ran)
      FIXME DOC
    • inverse

      public static <A, B> Multimap<B,A> inverse(Multimap<A,B> r)
    • toCompose

      public static <A, B, C> Multimap<A,C> toCompose(Multimap<A,B> r, Multimap<B,C> s)
    • toCompose

      public static <A, B, C, D> Multimap<A,D> toCompose(Multimap<A,B> r, Multimap<B,C> s, Multimap<C,D> t)
    • composeAs

      public static <A, B, C> Multimap<A,C> composeAs(Multimap<A,B> r, Multimap<B,C> s, Multimap<A,C> result)
    • compose

      public static <A, B, C> Multimap<A,C> compose(Multimap<A,B> r, Multimap<B,C> s)
    • compose

      public static <A, B, C, D> Multimap<A,D> compose(Multimap<A,B> r, Multimap<B,C> s, Multimap<C,D> t)
    • compose

      public static <A, B, C, D, E> Multimap<A,E> compose(Multimap<A,B> r, Multimap<B,C> s, Multimap<C,D> t, Multimap<D,E> u)
    • compose

      public static <A, B, C, D, E, F> Multimap<A,F> compose(Multimap<A,B> r, Multimap<B,C> s, Multimap<C,D> t, Multimap<D,E> u, Multimap<E,F> v)
    • compose

      public static <A> Multimap<A,A> compose(Multimap<A,A>... r)
    • forward

      public static <A, B> Multimap<A,B> forward(Map<A,B> m)
    • support

      public static <A> Set<A> support(Multimap<A,A> r)
    • reflexiveClosure

      public static <A> boolean reflexiveClosure(Multimap<A,A> r)
    • reflexiveClosure

      public static <A> boolean reflexiveClosure(Multimap<A,A> r, Set<? extends A> s)
    • reflexiveReduction

      public static <A> boolean reflexiveReduction(Multimap<A,A> r)
    • reflexiveReduction

      public static <A> boolean reflexiveReduction(Multimap<A,A> r, Set<? extends A> s)
    • symmetricClosure

      public static <A> boolean symmetricClosure(Multimap<A,A> r)
    • toSymmetricClosure

      public static <A> Multimap<A,A> toSymmetricClosure(Multimap<A,A> r)
    • transitiveClosure

      public static <A> boolean transitiveClosure(Multimap<A,A> r)
    • transitiveClosureSparse

      public static <A> boolean transitiveClosureSparse(Multimap<A,A> r)
    • toTransitiveClosure

      public static <A> Multimap<A,A> toTransitiveClosure(Multimap<A,A> r)
    • slice

      public static <A, B> Multimap<A,B> slice(BiPredicate<? super A,? super B> r, Set<? extends A> dom, Set<? extends B> ran)
    • toSum

      public static <A, B> Multimap<A,B> toSum(Collection<? extends A> dom, Function<? super A,? extends Collection<? extends B>> fun)
    • unmodifiableMultimap

      public static <A, B> Multimap<A,B> unmodifiableMultimap(Multimap<? extends A,? extends B> m)
    • span

      public static <A, B, C, D> Multimap<C,D> span(Multimap<A,B> gen, Function<? super A,? extends C> left, Function<? super B,? extends D> right)
      returns span(R, f, g) = { (x,y) ∊ R ⚫ (f(x),f(y) }
    • toSpan

      public static <A, B, C> Multimap<B,C> toSpan(Function<? super A,? extends B> left, Function<? super A,? extends C> right, Collection<? extends A> gen)
      return span(f, g, a) = { x ∊ A ⚫ (f(x),g(x))}
    • toSpan

      public static <A, B, C, D> Multimap<C,D> toSpan(Function<? super A,? extends C> left, Function<? super B,? extends D> right, Multimap<? extends A,? extends B> gen)
    • maxMatching

      public static <A, B> Multimap<A,B> maxMatching(Multimap<A,B> rel)
    • asMultimap

      public static <A, B> Multimap<A,B> asMultimap(Set<Map.Entry<A,B>> things)
    • choose

      public static <A, B> Map<A,B> choose(Multimap<A,B> m)
    • main

      public static void main(String[] args)