Module logicng

Class UBTree<T extends Comparable<T>>

  • Type Parameters:
    T - the type of the elements (must be comparable)

    public final class UBTree<T extends Comparable<T>>
    extends Object
    A data structure for storing sets with efficient sub- and superset queries. C.f. `A New Method to Index and Query Sets`, Hoffmann and Koehler, 1999
    Since:
    1.5.0
    Version:
    2.0.0
    • Constructor Detail

      • UBTree

        public UBTree()
        Constructs an empty UBTree.
    • Method Detail

      • addSet

        public void addSet​(SortedSet<T> set)
        Adds a set of comparable objects to this UBTree.
        Parameters:
        set - the set of comparable objects
      • firstSubset

        public SortedSet<T> firstSubset​(SortedSet<T> set)
        Returns the first subset of a given set in this UBTree.
        Parameters:
        set - the set to search for
        Returns:
        the first subset which is found for the given set or null if there is none
      • allSubsets

        public Set<SortedSet<T>> allSubsets​(SortedSet<T> set)
        Returns all subsets of a given set in this UBTree.
        Parameters:
        set - the set to search for
        Returns:
        all subsets of the given set
      • allSupersets

        public Set<SortedSet<T>> allSupersets​(SortedSet<T> set)
        Returns all supersets of a given set in this UBTree.
        Parameters:
        set - the set to search for
        Returns:
        all supersets of the given set
      • allSets

        public Set<SortedSet<T>> allSets()
        Returns all sets in this UBTree.
        Returns:
        all sets in this UBTree