Package org.apache.datasketches.tuple.adouble

# Class DoubleSummarySetOperations

java.lang.Object
org.apache.datasketches.tuple.adouble.DoubleSummarySetOperations

All Implemented Interfaces:
  `SummarySetOperations<DoubleSummary>`

public final class DoubleSummarySetOperations extends Object implements SummarySetOperations<DoubleSummary>
Methods for defining how unions and intersections of two objects of type DoubleSummary are performed.

## Constructor Summary

Constructors
Constructor
Description
`DoubleSummarySetOperations()`
Creates an instance with default mode of sum for both union and intersection.
`DoubleSummarySetOperations(DoubleSummary.Mode summaryMode)`
Creates an instance given a DoubleSummary update mode where the mode is the same for both union and intersection.
`DoubleSummarySetOperations(DoubleSummary.Mode unionSummaryMode, DoubleSummary.Mode intersectionSummaryMode)`
Creates an instance with two modes.

## Method Summary

Modifier and Type
Method
Description
`DoubleSummary`
`intersection(DoubleSummary a, DoubleSummary b)`
This is called by the intersection operator when both sketches have the same hash value.
`DoubleSummary`
`union(DoubleSummary a, DoubleSummary b)`
This is called by the union operator when both sketches have the same hash value.

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### DoubleSummarySetOperations

public DoubleSummarySetOperations()
Creates an instance with default mode of sum for both union and intersection. This exists for backward compatibility.

### DoubleSummarySetOperations

public DoubleSummarySetOperations(DoubleSummary.Mode summaryMode)
Creates an instance given a DoubleSummary update mode where the mode is the same for both union and intersection. This exists for backward compatibility.

Parameters:
  `summaryMode` - DoubleSummary update mode.

### DoubleSummarySetOperations

public DoubleSummarySetOperations(DoubleSummary.Mode unionSummaryMode, DoubleSummary.Mode intersectionSummaryMode)
Creates an instance with two modes.

Parameters:
  `unionSummaryMode` - for unions
  `intersectionSummaryMode` - for intersections

## Method Details

### union

public DoubleSummary union(DoubleSummary a, DoubleSummary b)
Description copied from interface: `SummarySetOperations`
This is called by the union operator when both sketches have the same hash value.

Caution: Do not modify the input Summary objects. Also do not return them directly, unless they are immutable (most Summary objects are not). For mutable Summary objects, it is important to create a new Summary object with the correct contents to be returned. Do not return null summaries.

Specified by:
  `union` in interface `SummarySetOperations<DoubleSummary>`
Parameters:
  `a` - Summary from sketch A
  `b` - Summary from sketch B
Returns:
  union of Summary A and Summary B

### intersection

public DoubleSummary intersection(DoubleSummary a, DoubleSummary b)
Description copied from interface: `SummarySetOperations`
This is called by the intersection operator when both sketches have the same hash value.

Caution: Do not modify the input Summary objects. Also do not return them directly, unless they are immutable (most Summary objects are not). For mutable Summary objects, it is important to create a new Summary object with the correct contents to be returned. Do not return null summaries.

Specified by:
  `intersection` in interface `SummarySetOperations<DoubleSummary>`
Parameters:
  `a` - Summary from sketch A
  `b` - Summary from sketch B
Returns:
  intersection of Summary A and Summary B