Class IntersectionResult


  • public class IntersectionResult
    extends java.lang.Object
    Represents the intersection result between two sets.

    Stores the size of set A, set B and the intersection of A and B (|A ∩ B|).

    This class is immutable.

    Since:
    1.7
    See Also:
    Intersection
    • Constructor Summary

      Constructors 
      Constructor Description
      IntersectionResult​(int sizeA, int sizeB, int intersection)
      Create the results for an intersection between two sets.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      int getIntersection()
      Get the size of the intersection between set A and B.
      int getSizeA()
      Get the size of set A.
      int getSizeB()
      Get the size of set B.
      int hashCode()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • IntersectionResult

        public IntersectionResult​(int sizeA,
                                  int sizeB,
                                  int intersection)
        Create the results for an intersection between two sets.
        Parameters:
        sizeA - the size of set A (|A|)
        sizeB - the size of set B (|B|)
        intersection - the size of the intersection of A and B (|A ∩ B|)
        Throws:
        java.lang.IllegalArgumentException - if the sizes are negative or the intersection is greater than the minimum of the two set sizes
    • Method Detail

      • getSizeA

        public int getSizeA()
        Get the size of set A.
        Returns:
        |A|
      • getSizeB

        public int getSizeB()
        Get the size of set B.
        Returns:
        |B|
      • getIntersection

        public int getIntersection()
        Get the size of the intersection between set A and B.
        Returns:
        |A ∩ B|
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object