Package org.apache.datasketches.theta
Class Sketches
java.lang.Object
org.apache.datasketches.theta.Sketches
public final class Sketches extends Object
This class brings together the common sketch and set operation creation methods and
the public static methods into one place.
- Author:
- Lee Rhodes
-
Method Summary
Modifier and Type Method Description static doublegetEstimate(org.apache.datasketches.memory.Memory srcMem)Gets the unique count estimate from a valid memory image of a Sketchstatic doublegetLowerBound(int numStdDev, org.apache.datasketches.memory.Memory srcMem)Gets the approximate lower error bound from a valid memory image of a Sketch given the specified number of Standard Deviations.static intgetMaxAnotBResultBytes(int maxNomEntries)static intgetMaxCompactSketchBytes(int numberOfEntries)static intgetMaxIntersectionBytes(int nomEntries)static intgetMaxUnionBytes(int nomEntries)static intgetMaxUpdateSketchBytes(int nomEntries)static intgetSerializationVersion(org.apache.datasketches.memory.Memory srcMem)static doublegetUpperBound(int numStdDev, org.apache.datasketches.memory.Memory srcMem)Gets the approximate upper error bound from a valid memory image of a Sketch given the specified number of Standard Deviations.static SetOperationheapifySetOperation(org.apache.datasketches.memory.Memory srcMem)static SetOperationheapifySetOperation(org.apache.datasketches.memory.Memory srcMem, long seed)static SketchheapifySketch(org.apache.datasketches.memory.Memory srcMem)static SketchheapifySketch(org.apache.datasketches.memory.Memory srcMem, long seed)static UpdateSketchheapifyUpdateSketch(org.apache.datasketches.memory.Memory srcMem)static UpdateSketchheapifyUpdateSketch(org.apache.datasketches.memory.Memory srcMem, long seed)static SetOperationBuildersetOperationBuilder()Ref:SetOperationBuilderstatic UpdateSketchBuilderupdateSketchBuilder()Ref:UpdateSketchBuilderstatic IntersectionwrapIntersection(org.apache.datasketches.memory.Memory srcMem)Convenience method, callsSetOperation.wrap(Memory)and casts the result to a Intersectionstatic IntersectionwrapIntersection(org.apache.datasketches.memory.WritableMemory srcMem)Convenience method, callsSetOperation.wrap(Memory)and casts the result to a Intersectionstatic SetOperationwrapSetOperation(org.apache.datasketches.memory.Memory srcMem)static SetOperationwrapSetOperation(org.apache.datasketches.memory.Memory srcMem, long seed)static SetOperationwrapSetOperation(org.apache.datasketches.memory.WritableMemory srcMem)static SetOperationwrapSetOperation(org.apache.datasketches.memory.WritableMemory srcMem, long seed)static SketchwrapSketch(org.apache.datasketches.memory.Memory srcMem)Ref:Sketch.wrap(Memory)static SketchwrapSketch(org.apache.datasketches.memory.Memory srcMem, long seed)static UnionwrapUnion(org.apache.datasketches.memory.Memory srcMem)Convenience method, callsSetOperation.wrap(Memory)and casts the result to a Unionstatic UnionwrapUnion(org.apache.datasketches.memory.WritableMemory srcMem)Convenience method, callsSetOperation.wrap(Memory)and casts the result to a Unionstatic UpdateSketchwrapUpdateSketch(org.apache.datasketches.memory.WritableMemory srcMem)static UpdateSketchwrapUpdateSketch(org.apache.datasketches.memory.WritableMemory srcMem, long seed)
-
Method Details
-
updateSketchBuilder
Ref:UpdateSketchBuilder- Returns:
UpdateSketchBuilder
-
heapifySketch
- Parameters:
srcMem- Ref:Sketch.heapify(Memory)srcMem- Returns:
Sketch
-
heapifySketch
- Parameters:
srcMem- Ref:Sketch.heapify(Memory, long)srcMemseed- Ref:Sketch.heapify(Memory, long)seed- Returns:
Sketch
-
heapifyUpdateSketch
- Parameters:
srcMem- Ref:UpdateSketch.heapify(Memory)srcMem- Returns:
UpdateSketch
-
heapifyUpdateSketch
public static UpdateSketch heapifyUpdateSketch(org.apache.datasketches.memory.Memory srcMem, long seed)- Parameters:
srcMem- Ref:UpdateSketch.heapify(Memory, long)srcMemseed- Ref:UpdateSketch.heapify(Memory, long)seed- Returns:
UpdateSketch
-
wrapSketch
Ref:Sketch.wrap(Memory)- Parameters:
srcMem- Ref:Sketch.wrap(Memory)srcMem- Returns:
Sketch
-
wrapSketch
- Parameters:
srcMem- Ref:Sketch.wrap(Memory, long)srcMemseed- Ref:Sketch.wrap(Memory, long)seed- Returns:
Sketch
-
wrapUpdateSketch
- Parameters:
srcMem- Ref:UpdateSketch.wrap(Memory)srcMem- Returns:
UpdateSketch
-
wrapUpdateSketch
public static UpdateSketch wrapUpdateSketch(org.apache.datasketches.memory.WritableMemory srcMem, long seed)- Parameters:
srcMem- Ref:UpdateSketch.wrap(Memory, long)srcMemseed- Ref:UpdateSketch.wrap(Memory, long)seed- Returns:
UpdateSketch
-
setOperationBuilder
Ref:SetOperationBuilder- Returns:
SetOperationBuilder
-
heapifySetOperation
- Parameters:
srcMem- Ref:SetOperation.heapify(Memory)srcMem- Returns:
SetOperation
-
heapifySetOperation
public static SetOperation heapifySetOperation(org.apache.datasketches.memory.Memory srcMem, long seed)- Parameters:
srcMem- Ref:SetOperation.heapify(Memory, long)srcMemseed- Ref:SetOperation.heapify(Memory, long)seed- Returns:
SetOperation
-
wrapSetOperation
- Parameters:
srcMem- Ref:SetOperation.wrap(Memory)srcMem- Returns:
SetOperation
-
wrapSetOperation
- Parameters:
srcMem- Ref:SetOperation.wrap(Memory)srcMem- Returns:
SetOperation
-
wrapUnion
Convenience method, callsSetOperation.wrap(Memory)and casts the result to a Union- Parameters:
srcMem- Ref:SetOperation.wrap(Memory)srcMem- Returns:
- a Union backed by the given Memory
-
wrapUnion
Convenience method, callsSetOperation.wrap(Memory)and casts the result to a Union- Parameters:
srcMem- Ref:SetOperation.wrap(Memory)srcMem- Returns:
- a Union backed by the given Memory
-
wrapIntersection
Convenience method, callsSetOperation.wrap(Memory)and casts the result to a Intersection- Parameters:
srcMem- Ref:SetOperation.wrap(Memory)srcMem- Returns:
- a Intersection backed by the given Memory
-
wrapIntersection
Convenience method, callsSetOperation.wrap(Memory)and casts the result to a Intersection- Parameters:
srcMem- Ref:SetOperation.wrap(Memory)srcMem- Returns:
- a Intersection backed by the given Memory
-
wrapSetOperation
public static SetOperation wrapSetOperation(org.apache.datasketches.memory.Memory srcMem, long seed)- Parameters:
srcMem- Ref:SetOperation.wrap(Memory, long)srcMemseed- Ref:SetOperation.wrap(Memory, long)seed- Returns:
SetOperation
-
wrapSetOperation
public static SetOperation wrapSetOperation(org.apache.datasketches.memory.WritableMemory srcMem, long seed)- Parameters:
srcMem- Ref:SetOperation.wrap(Memory, long)srcMemseed- Ref:SetOperation.wrap(Memory, long)seed- Returns:
SetOperation
-
getMaxCompactSketchBytes
public static int getMaxCompactSketchBytes(int numberOfEntries)- Parameters:
numberOfEntries- Ref:Sketch.getMaxCompactSketchBytes(int)numberOfEntries- Returns:
- Ref:
Sketch.getMaxCompactSketchBytes(int)
-
getMaxUpdateSketchBytes
public static int getMaxUpdateSketchBytes(int nomEntries)- Parameters:
nomEntries- Ref:Sketch.getMaxUpdateSketchBytes(int)nomEntries- Returns:
- Ref:
Sketch.getMaxUpdateSketchBytes(int)
-
getSerializationVersion
public static int getSerializationVersion(org.apache.datasketches.memory.Memory srcMem)- Parameters:
srcMem- Ref:Sketch.getSerializationVersion(Memory)srcMem- Returns:
- Ref:
Sketch.getSerializationVersion(Memory)
-
getMaxUnionBytes
public static int getMaxUnionBytes(int nomEntries)- Parameters:
nomEntries- Ref:SetOperation.getMaxUnionBytes(int)nomEntries- Returns:
- Ref:
SetOperation.getMaxUnionBytes(int)
-
getMaxIntersectionBytes
public static int getMaxIntersectionBytes(int nomEntries)- Parameters:
nomEntries- Ref:SetOperation.getMaxIntersectionBytes(int)nomEntries- Returns:
- Ref:
SetOperation.getMaxIntersectionBytes(int)
-
getMaxAnotBResultBytes
public static int getMaxAnotBResultBytes(int maxNomEntries)Ref:SetOperation.getMaxAnotBResultBytes(int). Returns the maximum number of bytes for the returned CompactSketch, given the maximum value of nomEntries of the first sketch A of AnotB.- Parameters:
maxNomEntries- the given value- Returns:
- the maximum number of bytes.
-
getEstimate
public static double getEstimate(org.apache.datasketches.memory.Memory srcMem)Gets the unique count estimate from a valid memory image of a Sketch- Parameters:
srcMem- See Memory- Returns:
- the sketch's best estimate of the cardinality of the input stream.
-
getUpperBound
public static double getUpperBound(int numStdDev, org.apache.datasketches.memory.Memory srcMem)Gets the approximate upper error bound from a valid memory image of a Sketch given the specified number of Standard Deviations. This will return getEstimate() if isEmpty() is true.- Parameters:
numStdDev- See Number of Standard DeviationssrcMem- See Memory- Returns:
- the upper bound.
-
getLowerBound
public static double getLowerBound(int numStdDev, org.apache.datasketches.memory.Memory srcMem)Gets the approximate lower error bound from a valid memory image of a Sketch given the specified number of Standard Deviations. This will return getEstimate() if isEmpty() is true.- Parameters:
numStdDev- See Number of Standard DeviationssrcMem- See Memory- Returns:
- the lower bound.
-