Class DisjointSets.Subsets

  • Enclosing class:
    DisjointSets

    public class DisjointSets.Subsets
    extends java.lang.Object
    A representation of a partition of a set of items into disjoint subsets. It provides accessors for the number of subsets, the size of each subset, and the items of each subset.

    The item indices in each subset are sorted. This means that the item ordering is stable; that is, the items have the same order they did in the original set.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getCount()
      Gets the number of disjoint subsets.
      int getItem​(int s, int i)
      Gets an item from a subset.
      int getSize​(int s)
      Gets the number of items in a given subset.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getCount

        public int getCount()
        Gets the number of disjoint subsets.
        Returns:
        the number of subsets
      • getSize

        public int getSize​(int s)
        Gets the number of items in a given subset.
        Parameters:
        s - the subset index
        Returns:
        the size of the subset
      • getItem

        public int getItem​(int s,
                           int i)
        Gets an item from a subset.
        Parameters:
        s - the subset index
        i - the index of the item in the subset
        Returns:
        the item