Class IntersectionResult

java.lang.Object
org.apache.commons.text.similarity.IntersectionResult

public class IntersectionResult extends 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:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final int
    The size of the intersection between set A and B.
    private final int
    The size of set A.
    private final int
    The size of set B.
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    boolean
     
    int
    Get the size of the intersection between set A and B.
    int
    Get the size of set A.
    int
    Get the size of set B.
    int
     
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • sizeA

      private final int sizeA
      The size of set A.
    • sizeB

      private final int sizeB
      The size of set B.
    • intersection

      private final int intersection
      The size of the intersection between set A and B.
  • Constructor Details

    • 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:
      IllegalArgumentException - if the sizes are negative or the intersection is greater than the minimum of the two set sizes
  • Method Details

    • 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(Object o)
      Overrides:
      equals in class Object
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object