Package org.apache.datasketches.cpc

# Class CpcUnion

java.lang.Object
org.apache.datasketches.cpc.CpcUnion

public class CpcUnion extends Object
The union (merge) operation for the CPC sketches.

Author:
  Lee Rhodes, Kevin Lang

## Constructor Summary

Constructors
Constructor
Description
`CpcUnion()`
Construct this unioning object with the default LgK and the default update seed.
`CpcUnion(int lgK)`
Construct this unioning object with LgK and the default update seed.
`CpcUnion(int lgK, long seed)`
Construct this unioning object with LgK and a given seed.

## Method Summary

Modifier and Type
Method
Description
`static Family`
`getFamily()`
Return the DataSketches identifier for this CPC family of sketches.
`int`
`getLgK()`
Returns the current value of Log_base2 of K.
`CpcSketch`
`getResult()`
Returns the result of union operations as a CPC sketch.
`void`
`update(CpcSketch sketch)`
Update this union with a CpcSketch.

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

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

## Constructor Details

### CpcUnion

public CpcUnion()
Construct this unioning object with the default LgK and the default update seed.

### CpcUnion

public CpcUnion(int lgK)
Construct this unioning object with LgK and the default update seed.

Parameters:
  `lgK` - The given log2 of K.

### CpcUnion

public CpcUnion(int lgK, long seed)
Construct this unioning object with LgK and a given seed.

Parameters:
  `lgK` - The given log2 of K.
  `seed` - The given seed.

## Method Details

### update

public void update(CpcSketch sketch)
Update this union with a CpcSketch.

Parameters:
  `sketch` - the given CpcSketch.

### getResult

public CpcSketch getResult()
Returns the result of union operations as a CPC sketch.

Returns:
  the result of union operations as a CPC sketch.

### getLgK

public int getLgK()
Returns the current value of Log_base2 of K. Note that due to merging with source sketches that may have a lower value of LgK, this value can be less than what the union object was configured with.

Returns:
  the current value of Log_base2 of K.

### getFamily

public static Family getFamily()
Return the DataSketches identifier for this CPC family of sketches.

Returns:
  the DataSketches identifier for this CPC family of sketches.