Class SortedSetRelation


  • public class SortedSetRelation
    extends java.lang.Object
    Computationally efficient determination of the relationship between two SortedSets.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int A
      There are 8 combinations of the relationship bits.
      static int A_AND_B
      The relationship between two sets A and B can be determined by looking at: A - B A & B (intersection) B - A These are represented by a set of bits.
      static int A_NOT_B
      The relationship between two sets A and B can be determined by looking at: A - B A & B (intersection) B - A These are represented by a set of bits.
      static int ADDALL
      There are 8 combinations of the relationship bits.
      static int ANY
      There are 8 combinations of the relationship bits.
      static int B
      There are 8 combinations of the relationship bits.
      static int B_NOT_A
      The relationship between two sets A and B can be determined by looking at: A - B A & B (intersection) B - A These are represented by a set of bits.
      static int B_REMOVEALL
      There are 8 combinations of the relationship bits.
      static int COMPLEMENTALL
      There are 8 combinations of the relationship bits.
      static int CONTAINS
      There are 8 combinations of the relationship bits.
      static int DISJOINT
      There are 8 combinations of the relationship bits.
      static int EQUALS
      There are 8 combinations of the relationship bits.
      static int ISCONTAINED
      There are 8 combinations of the relationship bits.
      static int NO_A
      There are 8 combinations of the relationship bits.
      static int NO_B
      There are 8 combinations of the relationship bits.
      static int NONE
      There are 8 combinations of the relationship bits.
      static int REMOVEALL
      There are 8 combinations of the relationship bits.
      static int RETAINALL
      There are 8 combinations of the relationship bits.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T extends java.lang.Object & java.lang.Comparable<? super T>>
      java.util.SortedSet<? extends T>
      doOperation​(java.util.SortedSet<T> a, int relation, java.util.SortedSet<T> b)
      Utility that could be on SortedSet.
      static <T extends java.lang.Object & java.lang.Comparable<? super T>>
      boolean
      hasRelation​(java.util.SortedSet<T> a, int allow, java.util.SortedSet<T> b)
      Utility that could be on SortedSet.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • A_NOT_B

        public static final int A_NOT_B
        The relationship between two sets A and B can be determined by looking at: A - B A & B (intersection) B - A These are represented by a set of bits. Bit 2 is true if A - B is not empty Bit 1 is true if A & B is not empty BIT 0 is true if B - A is not empty
        See Also:
        Constant Field Values
      • A_AND_B

        public static final int A_AND_B
        The relationship between two sets A and B can be determined by looking at: A - B A & B (intersection) B - A These are represented by a set of bits. Bit 2 is true if A - B is not empty Bit 1 is true if A & B is not empty BIT 0 is true if B - A is not empty
        See Also:
        Constant Field Values
      • B_NOT_A

        public static final int B_NOT_A
        The relationship between two sets A and B can be determined by looking at: A - B A & B (intersection) B - A These are represented by a set of bits. Bit 2 is true if A - B is not empty Bit 1 is true if A & B is not empty BIT 0 is true if B - A is not empty
        See Also:
        Constant Field Values
      • ANY

        public static final int ANY
        There are 8 combinations of the relationship bits. These correspond to the filters (combinations of allowed bits) in hasRelation. They also correspond to the modification functions, listed in comments.
        See Also:
        Constant Field Values
      • CONTAINS

        public static final int CONTAINS
        There are 8 combinations of the relationship bits. These correspond to the filters (combinations of allowed bits) in hasRelation. They also correspond to the modification functions, listed in comments.
        See Also:
        Constant Field Values
      • DISJOINT

        public static final int DISJOINT
        There are 8 combinations of the relationship bits. These correspond to the filters (combinations of allowed bits) in hasRelation. They also correspond to the modification functions, listed in comments.
        See Also:
        Constant Field Values
      • ISCONTAINED

        public static final int ISCONTAINED
        There are 8 combinations of the relationship bits. These correspond to the filters (combinations of allowed bits) in hasRelation. They also correspond to the modification functions, listed in comments.
        See Also:
        Constant Field Values
      • NO_B

        public static final int NO_B
        There are 8 combinations of the relationship bits. These correspond to the filters (combinations of allowed bits) in hasRelation. They also correspond to the modification functions, listed in comments.
        See Also:
        Constant Field Values
      • EQUALS

        public static final int EQUALS
        There are 8 combinations of the relationship bits. These correspond to the filters (combinations of allowed bits) in hasRelation. They also correspond to the modification functions, listed in comments.
        See Also:
        Constant Field Values
      • NO_A

        public static final int NO_A
        There are 8 combinations of the relationship bits. These correspond to the filters (combinations of allowed bits) in hasRelation. They also correspond to the modification functions, listed in comments.
        See Also:
        Constant Field Values
      • NONE

        public static final int NONE
        There are 8 combinations of the relationship bits. These correspond to the filters (combinations of allowed bits) in hasRelation. They also correspond to the modification functions, listed in comments.
        See Also:
        Constant Field Values
      • ADDALL

        public static final int ADDALL
        There are 8 combinations of the relationship bits. These correspond to the filters (combinations of allowed bits) in hasRelation. They also correspond to the modification functions, listed in comments.
        See Also:
        Constant Field Values
      • A

        public static final int A
        There are 8 combinations of the relationship bits. These correspond to the filters (combinations of allowed bits) in hasRelation. They also correspond to the modification functions, listed in comments.
        See Also:
        Constant Field Values
      • COMPLEMENTALL

        public static final int COMPLEMENTALL
        There are 8 combinations of the relationship bits. These correspond to the filters (combinations of allowed bits) in hasRelation. They also correspond to the modification functions, listed in comments.
        See Also:
        Constant Field Values
      • B

        public static final int B
        There are 8 combinations of the relationship bits. These correspond to the filters (combinations of allowed bits) in hasRelation. They also correspond to the modification functions, listed in comments.
        See Also:
        Constant Field Values
      • REMOVEALL

        public static final int REMOVEALL
        There are 8 combinations of the relationship bits. These correspond to the filters (combinations of allowed bits) in hasRelation. They also correspond to the modification functions, listed in comments.
        See Also:
        Constant Field Values
      • RETAINALL

        public static final int RETAINALL
        There are 8 combinations of the relationship bits. These correspond to the filters (combinations of allowed bits) in hasRelation. They also correspond to the modification functions, listed in comments.
        See Also:
        Constant Field Values
      • B_REMOVEALL

        public static final int B_REMOVEALL
        There are 8 combinations of the relationship bits. These correspond to the filters (combinations of allowed bits) in hasRelation. They also correspond to the modification functions, listed in comments.
        See Also:
        Constant Field Values
    • Constructor Detail

      • SortedSetRelation

        public SortedSetRelation()
    • Method Detail

      • hasRelation

        public static <T extends java.lang.Object & java.lang.Comparable<? super T>> boolean hasRelation​(java.util.SortedSet<T> a,
                                                                                                         int allow,
                                                                                                         java.util.SortedSet<T> b)
        Utility that could be on SortedSet. Faster implementation than what is in Java for doing contains, equals, etc.
        Parameters:
        a - first set
        allow - filter, using ANY, CONTAINS, etc.
        b - second set
        Returns:
        whether the filter relationship is true or not.
      • doOperation

        public static <T extends java.lang.Object & java.lang.Comparable<? super T>> java.util.SortedSet<? extends T> doOperation​(java.util.SortedSet<T> a,
                                                                                                                                  int relation,
                                                                                                                                  java.util.SortedSet<T> b)
        Utility that could be on SortedSet. Allows faster implementation than what is in Java for doing addAll, removeAll, retainAll, (complementAll).
        Parameters:
        a - first set
        relation - the relation filter, using ANY, CONTAINS, etc.
        b - second set
        Returns:
        the new set