repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hllmap/UniqueCountMap.java
UniqueCountMap.getMemoryUsageBytes
public long getMemoryUsageBytes() { long total = 0; for (int i = 0; i < maps_.length; i++) { if (maps_[i] != null) { total += maps_[i].getMemoryUsageBytes(); } } return total; }
java
public long getMemoryUsageBytes() { long total = 0; for (int i = 0; i < maps_.length; i++) { if (maps_[i] != null) { total += maps_[i].getMemoryUsageBytes(); } } return total; }
[ "public", "long", "getMemoryUsageBytes", "(", ")", "{", "long", "total", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "maps_", ".", "length", ";", "i", "++", ")", "{", "if", "(", "maps_", "[", "i", "]", "!=", "null", ")", "...
Returns total bytes used by all internal maps @return total bytes used by all internal maps
[ "Returns", "total", "bytes", "used", "by", "all", "internal", "maps" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hllmap/UniqueCountMap.java#L196-L204
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hllmap/UniqueCountMap.java
UniqueCountMap.getKeyMemoryUsageBytes
public long getKeyMemoryUsageBytes() { long total = 0; for (int i = 0; i < maps_.length; i++) { if (maps_[i] != null) { total += (long) (maps_[i].getActiveEntries()) * keySizeBytes_; } } return total; }
java
public long getKeyMemoryUsageBytes() { long total = 0; for (int i = 0; i < maps_.length; i++) { if (maps_[i] != null) { total += (long) (maps_[i].getActiveEntries()) * keySizeBytes_; } } return total; }
[ "public", "long", "getKeyMemoryUsageBytes", "(", ")", "{", "long", "total", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "maps_", ".", "length", ";", "i", "++", ")", "{", "if", "(", "maps_", "[", "i", "]", "!=", "null", ")", ...
Returns total bytes used for key storage @return total bytes used for key storage
[ "Returns", "total", "bytes", "used", "for", "key", "storage" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hllmap/UniqueCountMap.java#L210-L218
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hllmap/UniqueCountMap.java
UniqueCountMap.getActiveMaps
int getActiveMaps() { int levels = 0; final int iMapsLen = maps_.length; for (int i = 0; i < iMapsLen; i++) { if (maps_[i] != null) { levels++; } } return levels; }
java
int getActiveMaps() { int levels = 0; final int iMapsLen = maps_.length; for (int i = 0; i < iMapsLen; i++) { if (maps_[i] != null) { levels++; } } return levels; }
[ "int", "getActiveMaps", "(", ")", "{", "int", "levels", "=", "0", ";", "final", "int", "iMapsLen", "=", "maps_", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "iMapsLen", ";", "i", "++", ")", "{", "if", "(", "maps_", "[",...
Returns the number of active internal maps so far. Only the base map is initialized in the constructor, so this method would return 1. As more keys are promoted up to higher level maps, the return value would grow until the last level HLL map is allocated. @return the number of active levels so far
[ "Returns", "the", "number", "of", "active", "internal", "maps", "so", "far", ".", "Only", "the", "base", "map", "is", "initialized", "in", "the", "constructor", "so", "this", "method", "would", "return", "1", ".", "As", "more", "keys", "are", "promoted", ...
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hllmap/UniqueCountMap.java#L235-L242
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/ConcurrentHeapThetaBuffer.java
ConcurrentHeapThetaBuffer.propagateToSharedSketch
private boolean propagateToSharedSketch(final long hash) { //noinspection StatementWithEmptyBody while (localPropagationInProgress.get()) { } //busy wait until previous propagation completed localPropagationInProgress.set(true); final boolean res = shared.propagate(localPropagationInProgress, null, ...
java
private boolean propagateToSharedSketch(final long hash) { //noinspection StatementWithEmptyBody while (localPropagationInProgress.get()) { } //busy wait until previous propagation completed localPropagationInProgress.set(true); final boolean res = shared.propagate(localPropagationInProgress, null, ...
[ "private", "boolean", "propagateToSharedSketch", "(", "final", "long", "hash", ")", "{", "//noinspection StatementWithEmptyBody", "while", "(", "localPropagationInProgress", ".", "get", "(", ")", ")", "{", "}", "//busy wait until previous propagation completed", "localPropa...
Propagates a single hash value to the shared sketch @param hash to be propagated
[ "Propagates", "a", "single", "hash", "value", "to", "the", "shared", "sketch" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/ConcurrentHeapThetaBuffer.java#L162-L171
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/ConcurrentHeapThetaBuffer.java
ConcurrentHeapThetaBuffer.propagateToSharedSketch
private void propagateToSharedSketch() { //noinspection StatementWithEmptyBody while (localPropagationInProgress.get()) { } //busy wait until previous propagation completed final CompactSketch compactSketch = compact(propagateOrderedCompact, null); localPropagationInProgress.set(true); shared.p...
java
private void propagateToSharedSketch() { //noinspection StatementWithEmptyBody while (localPropagationInProgress.get()) { } //busy wait until previous propagation completed final CompactSketch compactSketch = compact(propagateOrderedCompact, null); localPropagationInProgress.set(true); shared.p...
[ "private", "void", "propagateToSharedSketch", "(", ")", "{", "//noinspection StatementWithEmptyBody", "while", "(", "localPropagationInProgress", ".", "get", "(", ")", ")", "{", "}", "//busy wait until previous propagation completed", "final", "CompactSketch", "compactSketch"...
Propagates the content of the buffer as a sketch to the shared sketch
[ "Propagates", "the", "content", "of", "the", "buffer", "as", "a", "sketch", "to", "the", "shared", "sketch" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/ConcurrentHeapThetaBuffer.java#L176-L187
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/DoublesSketchAccessor.java
DoublesSketchAccessor.countValidLevelsBelow
private int countValidLevelsBelow(final int tgtLvl) { int count = 0; long bitPattern = ds_.getBitPattern(); for (int i = 0; (i < tgtLvl) && (bitPattern > 0); ++i, bitPattern >>>= 1) { if ((bitPattern & 1L) > 0L) { ++count; } } return count; // shorter implementation, testing...
java
private int countValidLevelsBelow(final int tgtLvl) { int count = 0; long bitPattern = ds_.getBitPattern(); for (int i = 0; (i < tgtLvl) && (bitPattern > 0); ++i, bitPattern >>>= 1) { if ((bitPattern & 1L) > 0L) { ++count; } } return count; // shorter implementation, testing...
[ "private", "int", "countValidLevelsBelow", "(", "final", "int", "tgtLvl", ")", "{", "int", "count", "=", "0", ";", "long", "bitPattern", "=", "ds_", ".", "getBitPattern", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "(", "i", "<", "tgtLvl", ...
Counts number of full levels in the sketch below tgtLvl. Useful for computing the level offset in a compact sketch. @param tgtLvl Target level in the sketch @return Number of full levels in the sketch below tgtLvl
[ "Counts", "number", "of", "full", "levels", "in", "the", "sketch", "below", "tgtLvl", ".", "Useful", "for", "computing", "the", "level", "offset", "in", "a", "compact", "sketch", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DoublesSketchAccessor.java#L118-L131
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/Util.java
Util.checkFamilyID
static void checkFamilyID(final int familyID) { final Family family = Family.idToFamily(familyID); if (!family.equals(Family.QUANTILES)) { throw new SketchesArgumentException( "Possible corruption: Invalid Family: " + family.toString()); } }
java
static void checkFamilyID(final int familyID) { final Family family = Family.idToFamily(familyID); if (!family.equals(Family.QUANTILES)) { throw new SketchesArgumentException( "Possible corruption: Invalid Family: " + family.toString()); } }
[ "static", "void", "checkFamilyID", "(", "final", "int", "familyID", ")", "{", "final", "Family", "family", "=", "Family", ".", "idToFamily", "(", "familyID", ")", ";", "if", "(", "!", "family", ".", "equals", "(", "Family", ".", "QUANTILES", ")", ")", ...
Checks the validity of the given family ID @param familyID the given family ID
[ "Checks", "the", "validity", "of", "the", "given", "family", "ID" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/Util.java#L225-L231
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/Util.java
Util.checkPreLongsFlagsCap
static boolean checkPreLongsFlagsCap(final int preambleLongs, final int flags, final long memCapBytes) { final boolean empty = (flags & EMPTY_FLAG_MASK) > 0; //Preamble flags empty state final int minPre = Family.QUANTILES.getMinPreLongs(); //1 final int maxPre = Family.QUANTILES.getMaxPreLongs(); //2 f...
java
static boolean checkPreLongsFlagsCap(final int preambleLongs, final int flags, final long memCapBytes) { final boolean empty = (flags & EMPTY_FLAG_MASK) > 0; //Preamble flags empty state final int minPre = Family.QUANTILES.getMinPreLongs(); //1 final int maxPre = Family.QUANTILES.getMaxPreLongs(); //2 f...
[ "static", "boolean", "checkPreLongsFlagsCap", "(", "final", "int", "preambleLongs", ",", "final", "int", "flags", ",", "final", "long", "memCapBytes", ")", "{", "final", "boolean", "empty", "=", "(", "flags", "&", "EMPTY_FLAG_MASK", ")", ">", "0", ";", "//Pr...
Checks the consistency of the flag bits and the state of preambleLong and the memory capacity and returns the empty state. @param preambleLongs the size of preamble in longs @param flags the flags field @param memCapBytes the memory capacity @return the value of the empty state
[ "Checks", "the", "consistency", "of", "the", "flag", "bits", "and", "the", "state", "of", "preambleLong", "and", "the", "memory", "capacity", "and", "returns", "the", "empty", "state", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/Util.java#L241-L256
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/Util.java
Util.checkHeapFlags
static void checkHeapFlags(final int flags) { //only used by checkPreLongsFlagsCap and test final int allowedFlags = READ_ONLY_FLAG_MASK | EMPTY_FLAG_MASK | COMPACT_FLAG_MASK | ORDERED_FLAG_MASK; final int flagsMask = ~allowedFlags; if ((flags & flagsMask) > 0) { throw new SketchesArgumentExc...
java
static void checkHeapFlags(final int flags) { //only used by checkPreLongsFlagsCap and test final int allowedFlags = READ_ONLY_FLAG_MASK | EMPTY_FLAG_MASK | COMPACT_FLAG_MASK | ORDERED_FLAG_MASK; final int flagsMask = ~allowedFlags; if ((flags & flagsMask) > 0) { throw new SketchesArgumentExc...
[ "static", "void", "checkHeapFlags", "(", "final", "int", "flags", ")", "{", "//only used by checkPreLongsFlagsCap and test", "final", "int", "allowedFlags", "=", "READ_ONLY_FLAG_MASK", "|", "EMPTY_FLAG_MASK", "|", "COMPACT_FLAG_MASK", "|", "ORDERED_FLAG_MASK", ";", "final...
Checks just the flags field of the preamble. Allowed flags are Read Only, Empty, Compact, and ordered. @param flags the flags field
[ "Checks", "just", "the", "flags", "field", "of", "the", "preamble", ".", "Allowed", "flags", "are", "Read", "Only", "Empty", "Compact", "and", "ordered", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/Util.java#L263-L271
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/Util.java
Util.checkIsCompactMemory
static boolean checkIsCompactMemory(final Memory srcMem) { // only reading so downcast is ok final int flags = extractFlags(srcMem); final int compactFlags = READ_ONLY_FLAG_MASK | COMPACT_FLAG_MASK; return (flags & compactFlags) > 0; }
java
static boolean checkIsCompactMemory(final Memory srcMem) { // only reading so downcast is ok final int flags = extractFlags(srcMem); final int compactFlags = READ_ONLY_FLAG_MASK | COMPACT_FLAG_MASK; return (flags & compactFlags) > 0; }
[ "static", "boolean", "checkIsCompactMemory", "(", "final", "Memory", "srcMem", ")", "{", "// only reading so downcast is ok", "final", "int", "flags", "=", "extractFlags", "(", "srcMem", ")", ";", "final", "int", "compactFlags", "=", "READ_ONLY_FLAG_MASK", "|", "COM...
Checks just the flags field of an input Memory object. Returns true for a compact sketch, false for an update sketch. Does not perform additional checks, including sketch family. @param srcMem the source Memory containing a sketch @return true if flags indicate a compact sketch, otherwise false
[ "Checks", "just", "the", "flags", "field", "of", "an", "input", "Memory", "object", ".", "Returns", "true", "for", "a", "compact", "sketch", "false", "for", "an", "update", "sketch", ".", "Does", "not", "perform", "additional", "checks", "including", "sketch...
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/Util.java#L280-L285
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/Util.java
Util.checkSplitPointsOrder
static final void checkSplitPointsOrder(final double[] values) { if (values == null) { throw new SketchesArgumentException("Values cannot be null."); } final int lenM1 = values.length - 1; for (int j = 0; j < lenM1; j++) { if (values[j] < values[j + 1]) { continue; } throw new Sketches...
java
static final void checkSplitPointsOrder(final double[] values) { if (values == null) { throw new SketchesArgumentException("Values cannot be null."); } final int lenM1 = values.length - 1; for (int j = 0; j < lenM1; j++) { if (values[j] < values[j + 1]) { continue; } throw new Sketches...
[ "static", "final", "void", "checkSplitPointsOrder", "(", "final", "double", "[", "]", "values", ")", "{", "if", "(", "values", "==", "null", ")", "{", "throw", "new", "SketchesArgumentException", "(", "\"Values cannot be null.\"", ")", ";", "}", "final", "int"...
Checks the sequential validity of the given array of double values. They must be unique, monotonically increasing and not NaN. @param values the given array of double values
[ "Checks", "the", "sequential", "validity", "of", "the", "given", "array", "of", "double", "values", ".", "They", "must", "be", "unique", "monotonically", "increasing", "and", "not", "NaN", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/Util.java#L292-L302
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/Util.java
Util.computeRetainedItems
static int computeRetainedItems(final int k, final long n) { final int bbCnt = computeBaseBufferItems(k, n); final long bitPattern = computeBitPattern(k, n); final int validLevels = computeValidLevels(bitPattern); return bbCnt + (validLevels * k); }
java
static int computeRetainedItems(final int k, final long n) { final int bbCnt = computeBaseBufferItems(k, n); final long bitPattern = computeBitPattern(k, n); final int validLevels = computeValidLevels(bitPattern); return bbCnt + (validLevels * k); }
[ "static", "int", "computeRetainedItems", "(", "final", "int", "k", ",", "final", "long", "n", ")", "{", "final", "int", "bbCnt", "=", "computeBaseBufferItems", "(", "k", ",", "n", ")", ";", "final", "long", "bitPattern", "=", "computeBitPattern", "(", "k",...
Returns the number of retained valid items in the sketch given k and n. @param k the given configured k of the sketch @param n the current number of items seen by the sketch @return the number of retained items in the sketch given k and n.
[ "Returns", "the", "number", "of", "retained", "valid", "items", "in", "the", "sketch", "given", "k", "and", "n", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/Util.java#L321-L326
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/cpc/CpcCompression.java
CpcCompression.lowLevelCompressBytes
static int lowLevelCompressBytes( final byte[] byteArray, // input final int numBytesToEncode, // input, must be an int final short[] encodingTable, // input final int[] compressedWords) { // output int nextWordIndex = 0; long bitBuf = 0; // bits are packed into thi...
java
static int lowLevelCompressBytes( final byte[] byteArray, // input final int numBytesToEncode, // input, must be an int final short[] encodingTable, // input final int[] compressedWords) { // output int nextWordIndex = 0; long bitBuf = 0; // bits are packed into thi...
[ "static", "int", "lowLevelCompressBytes", "(", "final", "byte", "[", "]", "byteArray", ",", "// input", "final", "int", "numBytesToEncode", ",", "// input, must be an int", "final", "short", "[", "]", "encodingTable", ",", "// input", "final", "int", "[", "]", "...
It is the caller's responsibility to ensure that the compressedWords array is long enough.
[ "It", "is", "the", "caller", "s", "responsibility", "to", "ensure", "that", "the", "compressedWords", "array", "is", "long", "enough", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcCompression.java#L137-L177
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/cpc/CpcCompression.java
CpcCompression.uncompressTheSurprisingValues
private static int[] uncompressTheSurprisingValues(final CompressedState source) { final int srcK = 1 << source.lgK; final int numPairs = source.numCsv; assert numPairs > 0; final int[] pairs = new int[numPairs]; final int numBaseBits = CpcCompression.golombChooseNumberOfBaseBits(srcK + numPairs, nu...
java
private static int[] uncompressTheSurprisingValues(final CompressedState source) { final int srcK = 1 << source.lgK; final int numPairs = source.numCsv; assert numPairs > 0; final int[] pairs = new int[numPairs]; final int numBaseBits = CpcCompression.golombChooseNumberOfBaseBits(srcK + numPairs, nu...
[ "private", "static", "int", "[", "]", "uncompressTheSurprisingValues", "(", "final", "CompressedState", "source", ")", "{", "final", "int", "srcK", "=", "1", "<<", "source", ".", "lgK", ";", "final", "int", "numPairs", "=", "source", ".", "numCsv", ";", "a...
the length of this array is known to the source sketch.
[ "the", "length", "of", "this", "array", "is", "known", "to", "the", "source", "sketch", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcCompression.java#L510-L518
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/cpc/CpcCompression.java
CpcCompression.trickyGetPairsFromWindow
private static int[] trickyGetPairsFromWindow(final byte[] window, final int k, final int numPairsToGet, final int emptySpace) { final int outputLength = emptySpace + numPairsToGet; final int[] pairs = new int[outputLength]; int rowIndex = 0; int pairIndex = emptySpace; for (rowIndex = 0; rowI...
java
private static int[] trickyGetPairsFromWindow(final byte[] window, final int k, final int numPairsToGet, final int emptySpace) { final int outputLength = emptySpace + numPairsToGet; final int[] pairs = new int[outputLength]; int rowIndex = 0; int pairIndex = emptySpace; for (rowIndex = 0; rowI...
[ "private", "static", "int", "[", "]", "trickyGetPairsFromWindow", "(", "final", "byte", "[", "]", "window", ",", "final", "int", "k", ",", "final", "int", "numPairsToGet", ",", "final", "int", "emptySpace", ")", "{", "final", "int", "outputLength", "=", "e...
will be filled in later by the caller.
[ "will", "be", "filled", "in", "later", "by", "the", "caller", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcCompression.java#L540-L557
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/cpc/CpcCompression.java
CpcCompression.compressHybridFlavor
private static void compressHybridFlavor(final CompressedState target, final CpcSketch source) { final int srcK = 1 << source.lgK; final PairTable srcPairTable = source.pairTable; final int srcNumPairs = srcPairTable.getNumPairs(); final int[] srcPairArr = PairTable.unwrappingGetItems(srcPairTable, srcN...
java
private static void compressHybridFlavor(final CompressedState target, final CpcSketch source) { final int srcK = 1 << source.lgK; final PairTable srcPairTable = source.pairTable; final int srcNumPairs = srcPairTable.getNumPairs(); final int[] srcPairArr = PairTable.unwrappingGetItems(srcPairTable, srcN...
[ "private", "static", "void", "compressHybridFlavor", "(", "final", "CompressedState", "target", ",", "final", "CpcSketch", "source", ")", "{", "final", "int", "srcK", "=", "1", "<<", "source", ".", "lgK", ";", "final", "PairTable", "srcPairTable", "=", "source...
of a Pinned sketch before compressing it. Hence the name Hybrid.
[ "of", "a", "Pinned", "sketch", "before", "compressing", "it", ".", "Hence", "the", "name", "Hybrid", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcCompression.java#L561-L589
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/cpc/CpcCompression.java
CpcCompression.compressSlidingFlavor
private static void compressSlidingFlavor(final CompressedState target, final CpcSketch source) { compressTheWindow(target, source); final PairTable srcPairTable = source.pairTable; final int numPairs = srcPairTable.getNumPairs(); if (numPairs > 0) { final int[] pairs = PairTable.unwrappingGetI...
java
private static void compressSlidingFlavor(final CompressedState target, final CpcSketch source) { compressTheWindow(target, source); final PairTable srcPairTable = source.pairTable; final int numPairs = srcPairTable.getNumPairs(); if (numPairs > 0) { final int[] pairs = PairTable.unwrappingGetI...
[ "private", "static", "void", "compressSlidingFlavor", "(", "final", "CompressedState", "target", ",", "final", "CpcSketch", "source", ")", "{", "compressTheWindow", "(", "target", ",", "source", ")", ";", "final", "PairTable", "srcPairTable", "=", "source", ".", ...
Complicated by the existence of both a left fringe and a right fringe.
[ "Complicated", "by", "the", "existence", "of", "both", "a", "left", "fringe", "and", "a", "right", "fringe", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcCompression.java#L673-L709
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java
KllFloatsSketch.update
public void update(final float value) { if (Float.isNaN(value)) { return; } if (isEmpty()) { minValue_ = value; maxValue_ = value; } else { if (value < minValue_) { minValue_ = value; } if (value > maxValue_) { maxValue_ = value; } } if (levels_[0] == 0) { compressWhile...
java
public void update(final float value) { if (Float.isNaN(value)) { return; } if (isEmpty()) { minValue_ = value; maxValue_ = value; } else { if (value < minValue_) { minValue_ = value; } if (value > maxValue_) { maxValue_ = value; } } if (levels_[0] == 0) { compressWhile...
[ "public", "void", "update", "(", "final", "float", "value", ")", "{", "if", "(", "Float", ".", "isNaN", "(", "value", ")", ")", "{", "return", ";", "}", "if", "(", "isEmpty", "(", ")", ")", "{", "minValue_", "=", "value", ";", "maxValue_", "=", "...
Updates this sketch with the given data item. @param value an item from a stream of items. NaNs are ignored.
[ "Updates", "this", "sketch", "with", "the", "given", "data", "item", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java#L328-L346
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java
KllFloatsSketch.merge
public void merge(final KllFloatsSketch other) { if ((other == null) || other.isEmpty()) { return; } if (m_ != other.m_) { throw new SketchesArgumentException("incompatible M: " + m_ + " and " + other.m_); } final long finalN = n_ + other.n_; for (int i = other.levels_[0]; i < other.levels_[1]...
java
public void merge(final KllFloatsSketch other) { if ((other == null) || other.isEmpty()) { return; } if (m_ != other.m_) { throw new SketchesArgumentException("incompatible M: " + m_ + " and " + other.m_); } final long finalN = n_ + other.n_; for (int i = other.levels_[0]; i < other.levels_[1]...
[ "public", "void", "merge", "(", "final", "KllFloatsSketch", "other", ")", "{", "if", "(", "(", "other", "==", "null", ")", "||", "other", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "if", "(", "m_", "!=", "other", ".", "m_", ")", "{",...
Merges another sketch into this one. @param other sketch to merge into this one
[ "Merges", "another", "sketch", "into", "this", "one", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java#L352-L371
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java
KllFloatsSketch.getQuantile
public float getQuantile(final double fraction) { if (isEmpty()) { return Float.NaN; } if (fraction == 0.0) { return minValue_; } if (fraction == 1.0) { return maxValue_; } if ((fraction < 0.0) || (fraction > 1.0)) { throw new SketchesArgumentException("Fraction cannot be less than zero or greater...
java
public float getQuantile(final double fraction) { if (isEmpty()) { return Float.NaN; } if (fraction == 0.0) { return minValue_; } if (fraction == 1.0) { return maxValue_; } if ((fraction < 0.0) || (fraction > 1.0)) { throw new SketchesArgumentException("Fraction cannot be less than zero or greater...
[ "public", "float", "getQuantile", "(", "final", "double", "fraction", ")", "{", "if", "(", "isEmpty", "(", ")", ")", "{", "return", "Float", ".", "NaN", ";", "}", "if", "(", "fraction", "==", "0.0", ")", "{", "return", "minValue_", ";", "}", "if", ...
Returns an approximation to the value of the data item that would be preceded by the given fraction of a hypothetical sorted version of the input stream so far. <p>We note that this method has a fairly large overhead (microseconds instead of nanoseconds) so it should not be called multiple times to get different quant...
[ "Returns", "an", "approximation", "to", "the", "value", "of", "the", "data", "item", "that", "would", "be", "preceded", "by", "the", "given", "fraction", "of", "a", "hypothetical", "sorted", "version", "of", "the", "input", "stream", "so", "far", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java#L411-L420
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java
KllFloatsSketch.getKFromEpsilon
public static int getKFromEpsilon(final double epsilon, final boolean pmf) { //Ensure that eps is >= than the lowest possible eps given MAX_K and pmf=false. final double eps = max(epsilon, 4.7634E-5); final double kdbl = pmf ? exp(log(2.446 / eps) / 0.9433) : exp(log(2.296 / eps) / 0.9723); ...
java
public static int getKFromEpsilon(final double epsilon, final boolean pmf) { //Ensure that eps is >= than the lowest possible eps given MAX_K and pmf=false. final double eps = max(epsilon, 4.7634E-5); final double kdbl = pmf ? exp(log(2.446 / eps) / 0.9433) : exp(log(2.296 / eps) / 0.9723); ...
[ "public", "static", "int", "getKFromEpsilon", "(", "final", "double", "epsilon", ",", "final", "boolean", "pmf", ")", "{", "//Ensure that eps is >= than the lowest possible eps given MAX_K and pmf=false.", "final", "double", "eps", "=", "max", "(", "epsilon", ",", "4.76...
thousands of trials
[ "thousands", "of", "trials" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java#L653-L663
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java
KllFloatsSketch.toByteArray
public byte[] toByteArray() { final byte[] bytes = new byte[getSerializedSizeBytes()]; final boolean isSingleItem = n_ == 1; bytes[PREAMBLE_INTS_BYTE] = (byte) (isEmpty() || isSingleItem ? PREAMBLE_INTS_SHORT : PREAMBLE_INTS_FULL); bytes[SER_VER_BYTE] = isSingleItem ? serialVersionUID2 : serialVersionUI...
java
public byte[] toByteArray() { final byte[] bytes = new byte[getSerializedSizeBytes()]; final boolean isSingleItem = n_ == 1; bytes[PREAMBLE_INTS_BYTE] = (byte) (isEmpty() || isSingleItem ? PREAMBLE_INTS_SHORT : PREAMBLE_INTS_FULL); bytes[SER_VER_BYTE] = isSingleItem ? serialVersionUID2 : serialVersionUI...
[ "public", "byte", "[", "]", "toByteArray", "(", ")", "{", "final", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "getSerializedSizeBytes", "(", ")", "]", ";", "final", "boolean", "isSingleItem", "=", "n_", "==", "1", ";", "bytes", "[", "PREAMBLE_...
Returns serialized sketch in a byte array form. @return serialized sketch in a byte array form.
[ "Returns", "serialized", "sketch", "in", "a", "byte", "array", "form", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java#L757-L793
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java
KllFloatsSketch.heapify
public static KllFloatsSketch heapify(final Memory mem) { final int preambleInts = mem.getByte(PREAMBLE_INTS_BYTE) & 0xff; final int serialVersion = mem.getByte(SER_VER_BYTE) & 0xff; final int family = mem.getByte(FAMILY_BYTE) & 0xff; final int flags = mem.getByte(FLAGS_BYTE) & 0xff; final int m = m...
java
public static KllFloatsSketch heapify(final Memory mem) { final int preambleInts = mem.getByte(PREAMBLE_INTS_BYTE) & 0xff; final int serialVersion = mem.getByte(SER_VER_BYTE) & 0xff; final int family = mem.getByte(FAMILY_BYTE) & 0xff; final int flags = mem.getByte(FLAGS_BYTE) & 0xff; final int m = m...
[ "public", "static", "KllFloatsSketch", "heapify", "(", "final", "Memory", "mem", ")", "{", "final", "int", "preambleInts", "=", "mem", ".", "getByte", "(", "PREAMBLE_INTS_BYTE", ")", "&", "0xff", ";", "final", "int", "serialVersion", "=", "mem", ".", "getByt...
Heapify takes the sketch image in Memory and instantiates an on-heap sketch. The resulting sketch will not retain any link to the source Memory. @param mem a Memory image of a sketch. <a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a> @return a heap-based sketch based on the given Memory
[ "Heapify", "takes", "the", "sketch", "image", "in", "Memory", "and", "instantiates", "an", "on", "-", "heap", "sketch", ".", "The", "resulting", "sketch", "will", "not", "retain", "any", "link", "to", "the", "source", "Memory", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java#L802-L835
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java
KllFloatsSketch.checkK
static void checkK(final int k) { if ((k < MIN_K) || (k > MAX_K)) { throw new SketchesArgumentException( "K must be >= " + MIN_K + " and <= " + MAX_K + ": " + k); } }
java
static void checkK(final int k) { if ((k < MIN_K) || (k > MAX_K)) { throw new SketchesArgumentException( "K must be >= " + MIN_K + " and <= " + MAX_K + ": " + k); } }
[ "static", "void", "checkK", "(", "final", "int", "k", ")", "{", "if", "(", "(", "k", "<", "MIN_K", ")", "||", "(", "k", ">", "MAX_K", ")", ")", "{", "throw", "new", "SketchesArgumentException", "(", "\"K must be >= \"", "+", "MIN_K", "+", "\" and <= \"...
Checks the validity of the given value k @param k must be greater than 7 and less than 65536.
[ "Checks", "the", "validity", "of", "the", "given", "value", "k" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java#L845-L850
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java
KllFloatsSketch.compressWhileUpdating
private void compressWhileUpdating() { final int level = findLevelToCompact(); // It is important to do add the new top level right here. Be aware that this operation // grows the buffer and shifts the data and also the boundaries of the data and grows the // levels array and increments numLevels_ ...
java
private void compressWhileUpdating() { final int level = findLevelToCompact(); // It is important to do add the new top level right here. Be aware that this operation // grows the buffer and shifts the data and also the boundaries of the data and grows the // levels array and increments numLevels_ ...
[ "private", "void", "compressWhileUpdating", "(", ")", "{", "final", "int", "level", "=", "findLevelToCompact", "(", ")", ";", "// It is important to do add the new top level right here. Be aware that this operation", "// grows the buffer and shifts the data and also the boundaries of t...
It cannot be used while merging, while reducing k, or anything else.
[ "It", "cannot", "be", "used", "while", "merging", "while", "reducing", "k", "or", "anything", "else", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/kll/KllFloatsSketch.java#L924-L975
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/UpdateDoublesSketch.java
UpdateDoublesSketch.compact
public CompactDoublesSketch compact(final WritableMemory dstMem) { if (dstMem == null) { return HeapCompactDoublesSketch.createFromUpdateSketch(this); } return DirectCompactDoublesSketch.createFromUpdateSketch(this, dstMem); }
java
public CompactDoublesSketch compact(final WritableMemory dstMem) { if (dstMem == null) { return HeapCompactDoublesSketch.createFromUpdateSketch(this); } return DirectCompactDoublesSketch.createFromUpdateSketch(this, dstMem); }
[ "public", "CompactDoublesSketch", "compact", "(", "final", "WritableMemory", "dstMem", ")", "{", "if", "(", "dstMem", "==", "null", ")", "{", "return", "HeapCompactDoublesSketch", ".", "createFromUpdateSketch", "(", "this", ")", ";", "}", "return", "DirectCompactD...
Returns a compact version of this sketch. If passing in a Memory object, the compact sketch will use that direct memory; otherwise, an on-heap sketch will be returned. @param dstMem An optional target memory to hold the sketch. @return A compact version of this sketch
[ "Returns", "a", "compact", "version", "of", "this", "sketch", ".", "If", "passing", "in", "a", "Memory", "object", "the", "compact", "sketch", "will", "use", "that", "direct", "memory", ";", "otherwise", "an", "on", "-", "heap", "sketch", "will", "be", "...
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/UpdateDoublesSketch.java#L55-L60
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java
ItemsSketch.getInstance
public static <T> ItemsSketch<T> getInstance(final Comparator<? super T> comparator) { return getInstance(PreambleUtil.DEFAULT_K, comparator); }
java
public static <T> ItemsSketch<T> getInstance(final Comparator<? super T> comparator) { return getInstance(PreambleUtil.DEFAULT_K, comparator); }
[ "public", "static", "<", "T", ">", "ItemsSketch", "<", "T", ">", "getInstance", "(", "final", "Comparator", "<", "?", "super", "T", ">", "comparator", ")", "{", "return", "getInstance", "(", "PreambleUtil", ".", "DEFAULT_K", ",", "comparator", ")", ";", ...
Obtains a new instance of an ItemsSketch using the DEFAULT_K. @param <T> type of item @param comparator to compare items @return a GenericQuantileSketch
[ "Obtains", "a", "new", "instance", "of", "an", "ItemsSketch", "using", "the", "DEFAULT_K", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java#L125-L127
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java
ItemsSketch.getInstance
public static <T> ItemsSketch<T> getInstance(final int k, final Comparator<? super T> comparator) { final ItemsSketch<T> qs = new ItemsSketch<>(k, comparator); final int bufAlloc = 2 * Math.min(DoublesSketch.MIN_K, k); //the min is important qs.n_ = 0; qs.combinedBufferItemCapacity_ = bufAlloc; qs.c...
java
public static <T> ItemsSketch<T> getInstance(final int k, final Comparator<? super T> comparator) { final ItemsSketch<T> qs = new ItemsSketch<>(k, comparator); final int bufAlloc = 2 * Math.min(DoublesSketch.MIN_K, k); //the min is important qs.n_ = 0; qs.combinedBufferItemCapacity_ = bufAlloc; qs.c...
[ "public", "static", "<", "T", ">", "ItemsSketch", "<", "T", ">", "getInstance", "(", "final", "int", "k", ",", "final", "Comparator", "<", "?", "super", "T", ">", "comparator", ")", "{", "final", "ItemsSketch", "<", "T", ">", "qs", "=", "new", "Items...
Obtains a new instance of an ItemsSketch. @param <T> type of item @param k Parameter that controls space usage of sketch and accuracy of estimates. Must be greater than 2 and less than 65536 and a power of 2. @param comparator to compare items @return a GenericQuantileSketch
[ "Obtains", "a", "new", "instance", "of", "an", "ItemsSketch", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java#L137-L148
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java
ItemsSketch.getInstance
public static <T> ItemsSketch<T> getInstance(final Memory srcMem, final Comparator<? super T> comparator, final ArrayOfItemsSerDe<T> serDe) { final long memCapBytes = srcMem.getCapacity(); if (memCapBytes < 8) { ...
java
public static <T> ItemsSketch<T> getInstance(final Memory srcMem, final Comparator<? super T> comparator, final ArrayOfItemsSerDe<T> serDe) { final long memCapBytes = srcMem.getCapacity(); if (memCapBytes < 8) { ...
[ "public", "static", "<", "T", ">", "ItemsSketch", "<", "T", ">", "getInstance", "(", "final", "Memory", "srcMem", ",", "final", "Comparator", "<", "?", "super", "T", ">", "comparator", ",", "final", "ArrayOfItemsSerDe", "<", "T", ">", "serDe", ")", "{", ...
Heapifies the given srcMem, which must be a Memory image of a ItemsSketch @param <T> type of item @param srcMem a Memory image of a sketch. <a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a> @param comparator to compare items @param serDe an instance of ArrayOfItemsSerDe @return a ItemsSketch on the Java...
[ "Heapifies", "the", "given", "srcMem", "which", "must", "be", "a", "Memory", "image", "of", "a", "ItemsSketch" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java#L159-L205
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java
ItemsSketch.copy
static <T> ItemsSketch<T> copy(final ItemsSketch<T> sketch) { final ItemsSketch<T> qsCopy = ItemsSketch.getInstance(sketch.k_, sketch.comparator_); qsCopy.n_ = sketch.n_; qsCopy.minValue_ = sketch.getMinValue(); qsCopy.maxValue_ = sketch.getMaxValue(); qsCopy.combinedBufferItemCapacity_ = sketch.get...
java
static <T> ItemsSketch<T> copy(final ItemsSketch<T> sketch) { final ItemsSketch<T> qsCopy = ItemsSketch.getInstance(sketch.k_, sketch.comparator_); qsCopy.n_ = sketch.n_; qsCopy.minValue_ = sketch.getMinValue(); qsCopy.maxValue_ = sketch.getMaxValue(); qsCopy.combinedBufferItemCapacity_ = sketch.get...
[ "static", "<", "T", ">", "ItemsSketch", "<", "T", ">", "copy", "(", "final", "ItemsSketch", "<", "T", ">", "sketch", ")", "{", "final", "ItemsSketch", "<", "T", ">", "qsCopy", "=", "ItemsSketch", ".", "getInstance", "(", "sketch", ".", "k_", ",", "sk...
Returns a copy of the given sketch @param <T> the data type @param sketch the given sketch @return a copy of the given sketch
[ "Returns", "a", "copy", "of", "the", "given", "sketch" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java#L213-L224
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java
ItemsSketch.update
public void update(final T dataItem) { // this method only uses the base buffer part of the combined buffer if (dataItem == null) { return; } if ((maxValue_ == null) || (comparator_.compare(dataItem, maxValue_) > 0)) { maxValue_ = dataItem; } if ((minValue_ == null) || (comparator_.compare(dataItem, mi...
java
public void update(final T dataItem) { // this method only uses the base buffer part of the combined buffer if (dataItem == null) { return; } if ((maxValue_ == null) || (comparator_.compare(dataItem, maxValue_) > 0)) { maxValue_ = dataItem; } if ((minValue_ == null) || (comparator_.compare(dataItem, mi...
[ "public", "void", "update", "(", "final", "T", "dataItem", ")", "{", "// this method only uses the base buffer part of the combined buffer", "if", "(", "dataItem", "==", "null", ")", "{", "return", ";", "}", "if", "(", "(", "maxValue_", "==", "null", ")", "||", ...
Updates this sketch with the given double data item @param dataItem an item from a stream of items. NaNs are ignored.
[ "Updates", "this", "sketch", "with", "the", "given", "double", "data", "item" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java#L230-L245
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java
ItemsSketch.getQuantileUpperBound
public T getQuantileUpperBound(final double fraction) { return getQuantile(min(1.0, fraction + Util.getNormalizedRankError(k_, false))); }
java
public T getQuantileUpperBound(final double fraction) { return getQuantile(min(1.0, fraction + Util.getNormalizedRankError(k_, false))); }
[ "public", "T", "getQuantileUpperBound", "(", "final", "double", "fraction", ")", "{", "return", "getQuantile", "(", "min", "(", "1.0", ",", "fraction", "+", "Util", ".", "getNormalizedRankError", "(", "k_", ",", "false", ")", ")", ")", ";", "}" ]
Gets the upper bound of the value interval in which the true quantile of the given rank exists with a confidence of at least 99%. @param fraction the given normalized rank as a fraction @return the upper bound of the value interval in which the true quantile of the given rank exists with a confidence of at least 99%. R...
[ "Gets", "the", "upper", "bound", "of", "the", "value", "interval", "in", "which", "the", "true", "quantile", "of", "the", "given", "rank", "exists", "with", "a", "confidence", "of", "at", "least", "99%", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java#L282-L284
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java
ItemsSketch.getQuantileLowerBound
public T getQuantileLowerBound(final double fraction) { return getQuantile(max(0, fraction - Util.getNormalizedRankError(k_, false))); }
java
public T getQuantileLowerBound(final double fraction) { return getQuantile(max(0, fraction - Util.getNormalizedRankError(k_, false))); }
[ "public", "T", "getQuantileLowerBound", "(", "final", "double", "fraction", ")", "{", "return", "getQuantile", "(", "max", "(", "0", ",", "fraction", "-", "Util", ".", "getNormalizedRankError", "(", "k_", ",", "false", ")", ")", ")", ";", "}" ]
Gets the lower bound of the value interval in which the true quantile of the given rank exists with a confidence of at least 99%. @param fraction the given normalized rank as a fraction @return the lower bound of the value interval in which the true quantile of the given rank exists with a confidence of at least 99%. R...
[ "Gets", "the", "lower", "bound", "of", "the", "value", "interval", "in", "which", "the", "true", "quantile", "of", "the", "given", "rank", "exists", "with", "a", "confidence", "of", "at", "least", "99%", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java#L293-L295
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java
ItemsSketch.reset
public void reset() { n_ = 0; combinedBufferItemCapacity_ = 2 * Math.min(DoublesSketch.MIN_K, k_); //the min is important combinedBuffer_ = new Object[combinedBufferItemCapacity_]; baseBufferCount_ = 0; bitPattern_ = 0; minValue_ = null; maxValue_ = null; }
java
public void reset() { n_ = 0; combinedBufferItemCapacity_ = 2 * Math.min(DoublesSketch.MIN_K, k_); //the min is important combinedBuffer_ = new Object[combinedBufferItemCapacity_]; baseBufferCount_ = 0; bitPattern_ = 0; minValue_ = null; maxValue_ = null; }
[ "public", "void", "reset", "(", ")", "{", "n_", "=", "0", ";", "combinedBufferItemCapacity_", "=", "2", "*", "Math", ".", "min", "(", "DoublesSketch", ".", "MIN_K", ",", "k_", ")", ";", "//the min is important", "combinedBuffer_", "=", "new", "Object", "["...
Resets this sketch to a virgin state, but retains the original value of k.
[ "Resets", "this", "sketch", "to", "a", "virgin", "state", "but", "retains", "the", "original", "value", "of", "k", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java#L568-L576
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java
ItemsSketch.downSample
public ItemsSketch<T> downSample(final int newK) { final ItemsSketch<T> newSketch = ItemsSketch.getInstance(newK, comparator_); ItemsMergeImpl.downSamplingMergeInto(this, newSketch); return newSketch; }
java
public ItemsSketch<T> downSample(final int newK) { final ItemsSketch<T> newSketch = ItemsSketch.getInstance(newK, comparator_); ItemsMergeImpl.downSamplingMergeInto(this, newSketch); return newSketch; }
[ "public", "ItemsSketch", "<", "T", ">", "downSample", "(", "final", "int", "newK", ")", "{", "final", "ItemsSketch", "<", "T", ">", "newSketch", "=", "ItemsSketch", ".", "getInstance", "(", "newK", ",", "comparator_", ")", ";", "ItemsMergeImpl", ".", "down...
From an existing sketch, this creates a new sketch that can have a smaller value of K. The original sketch is not modified. @param newK the new value of K that must be smaller than current value of K. It is required that this.getK() = newK * 2^(nonnegative integer). @return the new sketch.
[ "From", "an", "existing", "sketch", "this", "creates", "a", "new", "sketch", "that", "can", "have", "a", "smaller", "value", "of", "K", ".", "The", "original", "sketch", "is", "not", "modified", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java#L642-L646
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java
ItemsSketch.putMemory
public void putMemory(final WritableMemory dstMem, final ArrayOfItemsSerDe<T> serDe) { final byte[] byteArr = toByteArray(serDe); final long memCap = dstMem.getCapacity(); if (memCap < byteArr.length) { throw new SketchesArgumentException( "Destination Memory not large enough: " + memCap + "...
java
public void putMemory(final WritableMemory dstMem, final ArrayOfItemsSerDe<T> serDe) { final byte[] byteArr = toByteArray(serDe); final long memCap = dstMem.getCapacity(); if (memCap < byteArr.length) { throw new SketchesArgumentException( "Destination Memory not large enough: " + memCap + "...
[ "public", "void", "putMemory", "(", "final", "WritableMemory", "dstMem", ",", "final", "ArrayOfItemsSerDe", "<", "T", ">", "serDe", ")", "{", "final", "byte", "[", "]", "byteArr", "=", "toByteArray", "(", "serDe", ")", ";", "final", "long", "memCap", "=", ...
Puts the current sketch into the given Memory if there is sufficient space. Otherwise, throws an error. @param dstMem the given memory. @param serDe an instance of ArrayOfItemsSerDe
[ "Puts", "the", "current", "sketch", "into", "the", "given", "Memory", "if", "there", "is", "sufficient", "space", ".", "Otherwise", "throws", "an", "error", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java#L663-L671
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java
ItemsSketch.itemsArrayToCombinedBuffer
private void itemsArrayToCombinedBuffer(final T[] itemsArray) { final int extra = 2; // space for min and max values //Load min, max minValue_ = itemsArray[0]; maxValue_ = itemsArray[1]; //Load base buffer System.arraycopy(itemsArray, extra, combinedBuffer_, 0, baseBufferCount_); //Load l...
java
private void itemsArrayToCombinedBuffer(final T[] itemsArray) { final int extra = 2; // space for min and max values //Load min, max minValue_ = itemsArray[0]; maxValue_ = itemsArray[1]; //Load base buffer System.arraycopy(itemsArray, extra, combinedBuffer_, 0, baseBufferCount_); //Load l...
[ "private", "void", "itemsArrayToCombinedBuffer", "(", "final", "T", "[", "]", "itemsArray", ")", "{", "final", "int", "extra", "=", "2", ";", "// space for min and max values", "//Load min, max", "minValue_", "=", "itemsArray", "[", "0", "]", ";", "maxValue_", "...
Loads the Combined Buffer, min and max from the given items array. The Combined Buffer is always in non-compact form and must be pre-allocated. @param itemsArray the given items array
[ "Loads", "the", "Combined", "Buffer", "min", "and", "max", "from", "the", "given", "items", "array", ".", "The", "Combined", "Buffer", "is", "always", "in", "non", "-", "compact", "form", "and", "must", "be", "pre", "-", "allocated", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsSketch.java#L720-L741
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/HeapAnotB.java
HeapAnotB.scanAllAsearchB
private void scanAllAsearchB() { final long[] scanAArr = a_.getCache(); final int arrLongsIn = scanAArr.length; cache_ = new long[arrLongsIn]; for (int i = 0; i < arrLongsIn; i++ ) { final long hashIn = scanAArr[i]; if ((hashIn <= 0L) || (hashIn >= thetaLong_)) { continue; } final int ...
java
private void scanAllAsearchB() { final long[] scanAArr = a_.getCache(); final int arrLongsIn = scanAArr.length; cache_ = new long[arrLongsIn]; for (int i = 0; i < arrLongsIn; i++ ) { final long hashIn = scanAArr[i]; if ((hashIn <= 0L) || (hashIn >= thetaLong_)) { continue; } final int ...
[ "private", "void", "scanAllAsearchB", "(", ")", "{", "final", "long", "[", "]", "scanAArr", "=", "a_", ".", "getCache", "(", ")", ";", "final", "int", "arrLongsIn", "=", "scanAArr", ".", "length", ";", "cache_", "=", "new", "long", "[", "arrLongsIn", "...
Sketch A is either unordered compact or hash table
[ "Sketch", "A", "is", "either", "unordered", "compact", "or", "hash", "table" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/HeapAnotB.java#L262-L273
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/BoundsOnBinomialProportions.java
BoundsOnBinomialProportions.approximateLowerBoundOnP
public static double approximateLowerBoundOnP(final long n, final long k, final double numStdDevs) { checkInputs(n, k); if (n == 0) { return 0.0; } // the coin was never flipped, so we know nothing else if (k == 0) { return 0.0; } else if (k == 1) { return (exactLowerBoundOnPForKequalsOne(n, deltaOfNumS...
java
public static double approximateLowerBoundOnP(final long n, final long k, final double numStdDevs) { checkInputs(n, k); if (n == 0) { return 0.0; } // the coin was never flipped, so we know nothing else if (k == 0) { return 0.0; } else if (k == 1) { return (exactLowerBoundOnPForKequalsOne(n, deltaOfNumS...
[ "public", "static", "double", "approximateLowerBoundOnP", "(", "final", "long", "n", ",", "final", "long", "k", ",", "final", "double", "numStdDevs", ")", "{", "checkInputs", "(", "n", ",", "k", ")", ";", "if", "(", "n", "==", "0", ")", "{", "return", ...
Computes lower bound of approximate Clopper-Pearson confidence interval for a binomial proportion. <p>Implementation Notes:<br> The approximateLowerBoundOnP is defined with respect to the right tail of the binomial distribution.</p> <ul> <li>We want to solve for the <i>p</i> for which sum<sub><i>j,k,n</i></sub>bino(<i...
[ "Computes", "lower", "bound", "of", "approximate", "Clopper", "-", "Pearson", "confidence", "interval", "for", "a", "binomial", "proportion", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/BoundsOnBinomialProportions.java#L93-L103
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/BoundsOnBinomialProportions.java
BoundsOnBinomialProportions.approximateUpperBoundOnP
public static double approximateUpperBoundOnP(final long n, final long k, final double numStdDevs) { checkInputs(n, k); if (n == 0) { return 1.0; } // the coin was never flipped, so we know nothing else if (k == n) { return 1.0; } else if (k == (n - 1)) { return (exactUpperBoundOnPForKequalsNminus...
java
public static double approximateUpperBoundOnP(final long n, final long k, final double numStdDevs) { checkInputs(n, k); if (n == 0) { return 1.0; } // the coin was never flipped, so we know nothing else if (k == n) { return 1.0; } else if (k == (n - 1)) { return (exactUpperBoundOnPForKequalsNminus...
[ "public", "static", "double", "approximateUpperBoundOnP", "(", "final", "long", "n", ",", "final", "long", "k", ",", "final", "double", "numStdDevs", ")", "{", "checkInputs", "(", "n", ",", "k", ")", ";", "if", "(", "n", "==", "0", ")", "{", "return", ...
Computes upper bound of approximate Clopper-Pearson confidence interval for a binomial proportion. <p>Implementation Notes:<br> The approximateUpperBoundOnP is defined with respect to the left tail of the binomial distribution.</p> <ul> <li>We want to solve for the <i>p</i> for which sum<sub><i>j,0,k</i></sub>bino(<i>...
[ "Computes", "upper", "bound", "of", "approximate", "Clopper", "-", "Pearson", "confidence", "interval", "for", "a", "binomial", "proportion", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/BoundsOnBinomialProportions.java#L128-L142
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/BoundsOnBinomialProportions.java
BoundsOnBinomialProportions.erf_of_nonneg
private static double erf_of_nonneg(final double x) { // The constants that appear below, formatted for easy checking against the book. // a1 = 0.07052 30784 // a3 = 0.00927 05272 // a5 = 0.00027 65672 // a2 = 0.04228 20123 // a4 = 0.00015 20143 // a6 = 0.00004 30638 fi...
java
private static double erf_of_nonneg(final double x) { // The constants that appear below, formatted for easy checking against the book. // a1 = 0.07052 30784 // a3 = 0.00927 05272 // a5 = 0.00027 65672 // a2 = 0.04228 20123 // a4 = 0.00015 20143 // a6 = 0.00004 30638 fi...
[ "private", "static", "double", "erf_of_nonneg", "(", "final", "double", "x", ")", "{", "// The constants that appear below, formatted for easy checking against the book.", "// a1 = 0.07052 30784", "// a3 = 0.00927 05272", "// a5 = 0.00027 65672", "// a2 = 0.04228 20123", "/...
Abramowitz and Stegun formula 7.1.28, p. 88; Claims accuracy of about 7 decimal digits
[ "Abramowitz", "and", "Stegun", "formula", "7", ".", "1", ".", "28", "p", ".", "88", ";", "Claims", "accuracy", "of", "about", "7", "decimal", "digits" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/BoundsOnBinomialProportions.java#L183-L214
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/BoundsOnBinomialProportions.java
BoundsOnBinomialProportions.abramowitzStegunFormula26p5p22
private static double abramowitzStegunFormula26p5p22(final double a, final double b, final double yp) { final double b2m1 = (2.0 * b) - 1.0; final double a2m1 = (2.0 * a) - 1.0; final double lambda = ((yp * yp) - 3.0) / 6.0; final double htmp = (1.0 / a2m1) + (1.0 / b2m1); final double h = 2.0...
java
private static double abramowitzStegunFormula26p5p22(final double a, final double b, final double yp) { final double b2m1 = (2.0 * b) - 1.0; final double a2m1 = (2.0 * a) - 1.0; final double lambda = ((yp * yp) - 3.0) / 6.0; final double htmp = (1.0 / a2m1) + (1.0 / b2m1); final double h = 2.0...
[ "private", "static", "double", "abramowitzStegunFormula26p5p22", "(", "final", "double", "a", ",", "final", "double", "b", ",", "final", "double", "yp", ")", "{", "final", "double", "b2m1", "=", "(", "2.0", "*", "b", ")", "-", "1.0", ";", "final", "doubl...
that the formula was typed in correctly.
[ "that", "the", "formula", "was", "typed", "in", "correctly", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/BoundsOnBinomialProportions.java#L233-L246
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/sampling/ReservoirItemsSketch.java
ReservoirItemsSketch.newInstance
public static <T> ReservoirItemsSketch<T> newInstance(final int k, final ResizeFactor rf) { return new ReservoirItemsSketch<>(k, rf); }
java
public static <T> ReservoirItemsSketch<T> newInstance(final int k, final ResizeFactor rf) { return new ReservoirItemsSketch<>(k, rf); }
[ "public", "static", "<", "T", ">", "ReservoirItemsSketch", "<", "T", ">", "newInstance", "(", "final", "int", "k", ",", "final", "ResizeFactor", "rf", ")", "{", "return", "new", "ReservoirItemsSketch", "<>", "(", "k", ",", "rf", ")", ";", "}" ]
Construct a mergeable sampling sketch with up to k samples using a specified resize factor. @param k Maximum size of sampling. Allocated size may be smaller until reservoir fills. Unlike many sketches in this package, this value does <em>not</em> need to be a power of 2. @param rf <a href="{@docRoot}/resources/dict...
[ "Construct", "a", "mergeable", "sampling", "sketch", "with", "up", "to", "k", "samples", "using", "a", "specified", "resize", "factor", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/ReservoirItemsSketch.java#L168-L170
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/sampling/ReservoirItemsSketch.java
ReservoirItemsSketch.getSamples
@SuppressWarnings("unchecked") public T[] getSamples() { if (itemsSeen_ == 0) { return null; } final Class<?> clazz = data_.get(0).getClass(); return data_.toArray((T[]) Array.newInstance(clazz, 0)); }
java
@SuppressWarnings("unchecked") public T[] getSamples() { if (itemsSeen_ == 0) { return null; } final Class<?> clazz = data_.get(0).getClass(); return data_.toArray((T[]) Array.newInstance(clazz, 0)); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "T", "[", "]", "getSamples", "(", ")", "{", "if", "(", "itemsSeen_", "==", "0", ")", "{", "return", "null", ";", "}", "final", "Class", "<", "?", ">", "clazz", "=", "data_", ".", "get", ...
Returns a copy of the items in the reservoir, or null if empty. The returned array length may be smaller than the reservoir capacity. <p>In order to allocate an array of generic type T, uses the class of the first item in the array. This method method may throw an <tt>ArrayAssignmentException</tt> if the reservoir sto...
[ "Returns", "a", "copy", "of", "the", "items", "in", "the", "reservoir", "or", "null", "if", "empty", ".", "The", "returned", "array", "length", "may", "be", "smaller", "than", "the", "reservoir", "capacity", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/ReservoirItemsSketch.java#L343-L351
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/sampling/ReservoirItemsSketch.java
ReservoirItemsSketch.copy
@SuppressWarnings("unchecked") ReservoirItemsSketch<T> copy() { return new ReservoirItemsSketch<>(reservoirSize_, currItemsAlloc_, itemsSeen_, rf_, (ArrayList<T>) data_.clone()); }
java
@SuppressWarnings("unchecked") ReservoirItemsSketch<T> copy() { return new ReservoirItemsSketch<>(reservoirSize_, currItemsAlloc_, itemsSeen_, rf_, (ArrayList<T>) data_.clone()); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "ReservoirItemsSketch", "<", "T", ">", "copy", "(", ")", "{", "return", "new", "ReservoirItemsSketch", "<>", "(", "reservoirSize_", ",", "currItemsAlloc_", ",", "itemsSeen_", ",", "rf_", ",", "(", "ArrayList", ...
Used during union operations to ensure we do not overwrite an existing reservoir. Creates a shallow copy of the reservoir. @return A copy of the current sketch
[ "Used", "during", "union", "operations", "to", "ensure", "we", "do", "not", "overwrite", "an", "existing", "reservoir", ".", "Creates", "a", "shallow", "copy", "of", "the", "reservoir", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/ReservoirItemsSketch.java#L597-L601
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/Intersection.java
Intersection.intersect
public CompactSketch intersect(final Sketch a, final Sketch b) { return intersect(a, b, true, null); }
java
public CompactSketch intersect(final Sketch a, final Sketch b) { return intersect(a, b, true, null); }
[ "public", "CompactSketch", "intersect", "(", "final", "Sketch", "a", ",", "final", "Sketch", "b", ")", "{", "return", "intersect", "(", "a", ",", "b", ",", "true", ",", "null", ")", ";", "}" ]
Perform intersect set operation on the two given sketch arguments and return the result as an ordered CompactSketch on the heap. @param a The first sketch argument @param b The second sketch argument @return an ordered CompactSketch on the heap
[ "Perform", "intersect", "set", "operation", "on", "the", "two", "given", "sketch", "arguments", "and", "return", "the", "result", "as", "an", "ordered", "CompactSketch", "on", "the", "heap", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/Intersection.java#L80-L82
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hll/DirectCouponList.java
DirectCouponList.newInstance
static DirectCouponList newInstance(final int lgConfigK, final TgtHllType tgtHllType, final WritableMemory dstMem) { insertPreInts(dstMem, LIST_PREINTS); insertSerVer(dstMem); insertFamilyId(dstMem); insertLgK(dstMem, lgConfigK); insertLgArr(dstMem, LG_INIT_LIST_SIZE); insertFlags(dstMem, ...
java
static DirectCouponList newInstance(final int lgConfigK, final TgtHllType tgtHllType, final WritableMemory dstMem) { insertPreInts(dstMem, LIST_PREINTS); insertSerVer(dstMem); insertFamilyId(dstMem); insertLgK(dstMem, lgConfigK); insertLgArr(dstMem, LG_INIT_LIST_SIZE); insertFlags(dstMem, ...
[ "static", "DirectCouponList", "newInstance", "(", "final", "int", "lgConfigK", ",", "final", "TgtHllType", "tgtHllType", ",", "final", "WritableMemory", "dstMem", ")", "{", "insertPreInts", "(", "dstMem", ",", "LIST_PREINTS", ")", ";", "insertSerVer", "(", "dstMem...
Standard factory for new DirectCouponList. This initializes the given WritableMemory. @param lgConfigK the configured Lg K @param tgtHllType the configured HLL target @param dstMem the destination memory for the sketch. @return a new DirectCouponList
[ "Standard", "factory", "for", "new", "DirectCouponList", ".", "This", "initializes", "the", "given", "WritableMemory", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hll/DirectCouponList.java#L86-L97
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/IntersectionImplR.java
IntersectionImplR.checkMaxLgArrLongs
static final int checkMaxLgArrLongs(final Memory dstMem) { final int preBytes = CONST_PREAMBLE_LONGS << 3; final long cap = dstMem.getCapacity(); final int maxLgArrLongs = Integer.numberOfTrailingZeros(floorPowerOf2((int)(cap - preBytes)) >>> 3); if (maxLgArrLongs < MIN_LG_ARR_LONGS) { thr...
java
static final int checkMaxLgArrLongs(final Memory dstMem) { final int preBytes = CONST_PREAMBLE_LONGS << 3; final long cap = dstMem.getCapacity(); final int maxLgArrLongs = Integer.numberOfTrailingZeros(floorPowerOf2((int)(cap - preBytes)) >>> 3); if (maxLgArrLongs < MIN_LG_ARR_LONGS) { thr...
[ "static", "final", "int", "checkMaxLgArrLongs", "(", "final", "Memory", "dstMem", ")", "{", "final", "int", "preBytes", "=", "CONST_PREAMBLE_LONGS", "<<", "3", ";", "final", "long", "cap", "=", "dstMem", ".", "getCapacity", "(", ")", ";", "final", "int", "...
Returns the correct maximum lgArrLongs given the capacity of the Memory. Checks that the capacity is large enough for the minimum sized hash table. @param dstMem the given Memory @return the correct maximum lgArrLongs given the capacity of the Memory
[ "Returns", "the", "correct", "maximum", "lgArrLongs", "given", "the", "capacity", "of", "the", "Memory", ".", "Checks", "that", "the", "capacity", "is", "large", "enough", "for", "the", "minimum", "sized", "hash", "table", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/IntersectionImplR.java#L277-L287
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/IntersectionImpl.java
IntersectionImpl.initNewHeapInstance
static IntersectionImpl initNewHeapInstance(final long seed) { final IntersectionImpl impl = new IntersectionImpl(null, seed, false); impl.lgArrLongs_ = 0; impl.curCount_ = -1; //Universal Set is true impl.thetaLong_ = Long.MAX_VALUE; impl.empty_ = false; //A virgin intersection represents the Uni...
java
static IntersectionImpl initNewHeapInstance(final long seed) { final IntersectionImpl impl = new IntersectionImpl(null, seed, false); impl.lgArrLongs_ = 0; impl.curCount_ = -1; //Universal Set is true impl.thetaLong_ = Long.MAX_VALUE; impl.empty_ = false; //A virgin intersection represents the Uni...
[ "static", "IntersectionImpl", "initNewHeapInstance", "(", "final", "long", "seed", ")", "{", "final", "IntersectionImpl", "impl", "=", "new", "IntersectionImpl", "(", "null", ",", "seed", ",", "false", ")", ";", "impl", ".", "lgArrLongs_", "=", "0", ";", "im...
Construct a new Intersection target on the java heap. @param seed <a href="{@docRoot}/resources/dictionary.html#seed">See Seed</a> @return a new IntersectionImpl on the Java heap
[ "Construct", "a", "new", "Intersection", "target", "on", "the", "java", "heap", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/IntersectionImpl.java#L54-L62
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/IntersectionImpl.java
IntersectionImpl.initNewDirectInstance
static IntersectionImpl initNewDirectInstance(final long seed, final WritableMemory dstMem) { final IntersectionImpl impl = new IntersectionImpl(dstMem, seed, true); //Load Preamble insertPreLongs(dstMem, CONST_PREAMBLE_LONGS); //RF not used = 0 insertSerVer(dstMem, SER_VER); insertFamilyID(dstMem,...
java
static IntersectionImpl initNewDirectInstance(final long seed, final WritableMemory dstMem) { final IntersectionImpl impl = new IntersectionImpl(dstMem, seed, true); //Load Preamble insertPreLongs(dstMem, CONST_PREAMBLE_LONGS); //RF not used = 0 insertSerVer(dstMem, SER_VER); insertFamilyID(dstMem,...
[ "static", "IntersectionImpl", "initNewDirectInstance", "(", "final", "long", "seed", ",", "final", "WritableMemory", "dstMem", ")", "{", "final", "IntersectionImpl", "impl", "=", "new", "IntersectionImpl", "(", "dstMem", ",", "seed", ",", "true", ")", ";", "//Lo...
Construct a new Intersection target direct to the given destination Memory. Called by SetOperation.Builder. @param seed <a href="{@docRoot}/resources/dictionary.html#seed">See Seed</a> @param dstMem destination Memory. <a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a> @return a new IntersectionImpl tha...
[ "Construct", "a", "new", "Intersection", "target", "direct", "to", "the", "given", "destination", "Memory", ".", "Called", "by", "SetOperation", ".", "Builder", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/IntersectionImpl.java#L74-L98
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/IntersectionImpl.java
IntersectionImpl.heapifyInstance
static IntersectionImplR heapifyInstance(final Memory srcMem, final long seed) { final IntersectionImpl impl = new IntersectionImpl(null, seed, false); //Get Preamble //Note: Intersection does not use lgNomLongs (or k), per se. //seedHash loaded and checked in private constructor final int preLongs...
java
static IntersectionImplR heapifyInstance(final Memory srcMem, final long seed) { final IntersectionImpl impl = new IntersectionImpl(null, seed, false); //Get Preamble //Note: Intersection does not use lgNomLongs (or k), per se. //seedHash loaded and checked in private constructor final int preLongs...
[ "static", "IntersectionImplR", "heapifyInstance", "(", "final", "Memory", "srcMem", ",", "final", "long", "seed", ")", "{", "final", "IntersectionImpl", "impl", "=", "new", "IntersectionImpl", "(", "null", ",", "seed", ",", "false", ")", ";", "//Get Preamble", ...
Heapify an intersection target from a Memory image containing data. @param srcMem The source Memory object. <a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a> @param seed <a href="{@docRoot}/resources/dictionary.html#seed">See seed</a> @return a IntersectionImplR instance on the Java heap
[ "Heapify", "an", "intersection", "target", "from", "a", "Memory", "image", "containing", "data", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/IntersectionImpl.java#L107-L155
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/tuple/Intersection.java
Intersection.update
@SuppressWarnings({ "unchecked", "null" }) public void update(final Sketch<S> sketchIn) { final boolean isFirstCall = isFirstCall_; isFirstCall_ = false; if (sketchIn == null) { isEmpty_ = true; sketch_ = null; return; } theta_ = min(theta_, sketchIn.getThetaLong()); isEmpty_...
java
@SuppressWarnings({ "unchecked", "null" }) public void update(final Sketch<S> sketchIn) { final boolean isFirstCall = isFirstCall_; isFirstCall_ = false; if (sketchIn == null) { isEmpty_ = true; sketch_ = null; return; } theta_ = min(theta_, sketchIn.getThetaLong()); isEmpty_...
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"null\"", "}", ")", "public", "void", "update", "(", "final", "Sketch", "<", "S", ">", "sketchIn", ")", "{", "final", "boolean", "isFirstCall", "=", "isFirstCall_", ";", "isFirstCall_", "=", "false",...
Updates the internal set by intersecting it with the given sketch @param sketchIn input sketch to intersect with the internal set
[ "Updates", "the", "internal", "set", "by", "intersecting", "it", "with", "the", "given", "sketch" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/tuple/Intersection.java#L45-L101
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/BinomialBoundsN.java
BinomialBoundsN.contClassicLB
private static double contClassicLB(final double numSamplesF, final double theta, final double numSDev) { final double nHat = (numSamplesF - 0.5) / theta; final double b = numSDev * Math.sqrt((1.0 - theta) / theta); final double d = 0.5 * b * Math.sqrt((b * b) + (4.0 * nHat)); final double center...
java
private static double contClassicLB(final double numSamplesF, final double theta, final double numSDev) { final double nHat = (numSamplesF - 0.5) / theta; final double b = numSDev * Math.sqrt((1.0 - theta) / theta); final double d = 0.5 * b * Math.sqrt((b * b) + (4.0 * nHat)); final double center...
[ "private", "static", "double", "contClassicLB", "(", "final", "double", "numSamplesF", ",", "final", "double", "theta", ",", "final", "double", "numSDev", ")", "{", "final", "double", "nHat", "=", "(", "numSamplesF", "-", "0.5", ")", "/", "theta", ";", "fi...
our "classic" bounds, but now with continuity correction
[ "our", "classic", "bounds", "but", "now", "with", "continuity", "correction" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/BinomialBoundsN.java#L32-L39
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/BinomialBoundsN.java
BinomialBoundsN.getLowerBound
public static double getLowerBound(final long numSamples, final double theta, final int numSDev, final boolean noDataSeen) { //in earlier code numSamples was called numSamplesI if (noDataSeen) { return 0.0; } checkArgs(numSamples, theta, numSDev); final double lb = computeApproxBinoLB(numSamples, ...
java
public static double getLowerBound(final long numSamples, final double theta, final int numSDev, final boolean noDataSeen) { //in earlier code numSamples was called numSamplesI if (noDataSeen) { return 0.0; } checkArgs(numSamples, theta, numSDev); final double lb = computeApproxBinoLB(numSamples, ...
[ "public", "static", "double", "getLowerBound", "(", "final", "long", "numSamples", ",", "final", "double", "theta", ",", "final", "int", "numSDev", ",", "final", "boolean", "noDataSeen", ")", "{", "//in earlier code numSamples was called numSamplesI", "if", "(", "no...
Returns the approximate lower bound value @param numSamples the number of samples in the sample set @param theta the sampling probability @param numSDev the number of "standard deviations" from the mean for the tail bounds. This must be an integer value of 1, 2 or 3. @param noDataSeen this is normally false. However, i...
[ "Returns", "the", "approximate", "lower", "bound", "value" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/BinomialBoundsN.java#L218-L227
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/BinomialBoundsN.java
BinomialBoundsN.getUpperBound
public static double getUpperBound(final long numSamples, final double theta, final int numSDev, final boolean noDataSeen) { //in earlier code numSamples was called numSamplesI if (noDataSeen) { return 0.0; } checkArgs(numSamples, theta, numSDev); final double ub = computeApproxBinoUB(numSamples, ...
java
public static double getUpperBound(final long numSamples, final double theta, final int numSDev, final boolean noDataSeen) { //in earlier code numSamples was called numSamplesI if (noDataSeen) { return 0.0; } checkArgs(numSamples, theta, numSDev); final double ub = computeApproxBinoUB(numSamples, ...
[ "public", "static", "double", "getUpperBound", "(", "final", "long", "numSamples", ",", "final", "double", "theta", ",", "final", "int", "numSDev", ",", "final", "boolean", "noDataSeen", ")", "{", "//in earlier code numSamples was called numSamplesI", "if", "(", "no...
Returns the approximate upper bound value @param numSamples the number of samples in the sample set @param theta the sampling probability @param numSDev the number of "standard deviations" from the mean for the tail bounds. This must be an integer value of 1, 2 or 3. @param noDataSeen this is normally false. However, i...
[ "Returns", "the", "approximate", "upper", "bound", "value" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/BinomialBoundsN.java#L241-L250
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/BinomialBoundsN.java
BinomialBoundsN.checkArgs
static final void checkArgs(final long numSamples, final double theta, final int numSDev) { if ((numSDev | (numSDev - 1) | (3 - numSDev) | numSamples) < 0) { throw new SketchesArgumentException( "numSDev must only be 1,2, or 3 and numSamples must >= 0: numSDev=" + numSDev + ", numSampl...
java
static final void checkArgs(final long numSamples, final double theta, final int numSDev) { if ((numSDev | (numSDev - 1) | (3 - numSDev) | numSamples) < 0) { throw new SketchesArgumentException( "numSDev must only be 1,2, or 3 and numSamples must >= 0: numSDev=" + numSDev + ", numSampl...
[ "static", "final", "void", "checkArgs", "(", "final", "long", "numSamples", ",", "final", "double", "theta", ",", "final", "int", "numSDev", ")", "{", "if", "(", "(", "numSDev", "|", "(", "numSDev", "-", "1", ")", "|", "(", "3", "-", "numSDev", ")", ...
exposed only for test
[ "exposed", "only", "for", "test" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/BinomialBoundsN.java#L253-L262
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/sampling/ReservoirItemsUnion.java
ReservoirItemsUnion.update
public void update(final ReservoirItemsSketch<T> sketchIn) { if (sketchIn == null) { return; } final ReservoirItemsSketch<T> ris = (sketchIn.getK() <= maxK_ ? sketchIn : sketchIn.downsampledCopy(maxK_)); // can modify the sketch if we downsampled, otherwise may need to copy it final ...
java
public void update(final ReservoirItemsSketch<T> sketchIn) { if (sketchIn == null) { return; } final ReservoirItemsSketch<T> ris = (sketchIn.getK() <= maxK_ ? sketchIn : sketchIn.downsampledCopy(maxK_)); // can modify the sketch if we downsampled, otherwise may need to copy it final ...
[ "public", "void", "update", "(", "final", "ReservoirItemsSketch", "<", "T", ">", "sketchIn", ")", "{", "if", "(", "sketchIn", "==", "null", ")", "{", "return", ";", "}", "final", "ReservoirItemsSketch", "<", "T", ">", "ris", "=", "(", "sketchIn", ".", ...
Union the given sketch. This method can be repeatedly called. If the given sketch is null it is interpreted as an empty sketch. @param sketchIn The incoming sketch.
[ "Union", "the", "given", "sketch", ".", "This", "method", "can", "be", "repeatedly", "called", ".", "If", "the", "given", "sketch", "is", "null", "it", "is", "interpreted", "as", "an", "empty", "sketch", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/ReservoirItemsUnion.java#L134-L149
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/sampling/ReservoirItemsUnion.java
ReservoirItemsUnion.update
public void update(final T datum) { if (datum == null) { return; } if (gadget_ == null) { gadget_ = ReservoirItemsSketch.newInstance(maxK_); } gadget_.update(datum); }
java
public void update(final T datum) { if (datum == null) { return; } if (gadget_ == null) { gadget_ = ReservoirItemsSketch.newInstance(maxK_); } gadget_.update(datum); }
[ "public", "void", "update", "(", "final", "T", "datum", ")", "{", "if", "(", "datum", "==", "null", ")", "{", "return", ";", "}", "if", "(", "gadget_", "==", "null", ")", "{", "gadget_", "=", "ReservoirItemsSketch", ".", "newInstance", "(", "maxK_", ...
Present this union with a single item to be added to the union. @param datum The given datum of type T.
[ "Present", "this", "union", "with", "a", "single", "item", "to", "be", "added", "to", "the", "union", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/ReservoirItemsUnion.java#L180-L189
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/sampling/ReservoirItemsUnion.java
ReservoirItemsUnion.toByteArray
public byte[] toByteArray(final ArrayOfItemsSerDe<T> serDe) { if ((gadget_ == null) || (gadget_.getNumSamples() == 0)) { return toByteArray(serDe, null); } else { return toByteArray(serDe, gadget_.getValueAtPosition(0).getClass()); } }
java
public byte[] toByteArray(final ArrayOfItemsSerDe<T> serDe) { if ((gadget_ == null) || (gadget_.getNumSamples() == 0)) { return toByteArray(serDe, null); } else { return toByteArray(serDe, gadget_.getValueAtPosition(0).getClass()); } }
[ "public", "byte", "[", "]", "toByteArray", "(", "final", "ArrayOfItemsSerDe", "<", "T", ">", "serDe", ")", "{", "if", "(", "(", "gadget_", "==", "null", ")", "||", "(", "gadget_", ".", "getNumSamples", "(", ")", "==", "0", ")", ")", "{", "return", ...
Returns a byte array representation of this union @param serDe An instance of ArrayOfItemsSerDe @return a byte array representation of this union
[ "Returns", "a", "byte", "array", "representation", "of", "this", "union" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/ReservoirItemsUnion.java#L235-L241
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hll/RelativeErrorTables.java
RelativeErrorTables.getRelErr
static double getRelErr(final boolean upperBound, final boolean oooFlag, final int lgK, final int stdDev) { final int idx = ((lgK - 4) * 3) + (stdDev - 1); final int sw = (oooFlag ? 2 : 0) | (upperBound ? 1 : 0); double f = 0; switch (sw) { case 0 : { //HIP, LB f = HIP_LB[idx]; ...
java
static double getRelErr(final boolean upperBound, final boolean oooFlag, final int lgK, final int stdDev) { final int idx = ((lgK - 4) * 3) + (stdDev - 1); final int sw = (oooFlag ? 2 : 0) | (upperBound ? 1 : 0); double f = 0; switch (sw) { case 0 : { //HIP, LB f = HIP_LB[idx]; ...
[ "static", "double", "getRelErr", "(", "final", "boolean", "upperBound", ",", "final", "boolean", "oooFlag", ",", "final", "int", "lgK", ",", "final", "int", "stdDev", ")", "{", "final", "int", "idx", "=", "(", "(", "lgK", "-", "4", ")", "*", "3", ")"...
Return Relative Error for UB or LB for HIP or Non-HIP as a function of numStdDev. @param upperBound true if for upper bound @param oooFlag true if for Non-HIP @param lgK must be between 4 and 12 inclusive @param stdDev must be between 1 and 3 inclusive @return Relative Error for UB or LB for HIP or Non-HIP as a functio...
[ "Return", "Relative", "Error", "for", "UB", "or", "LB", "for", "HIP", "or", "Non", "-", "HIP", "as", "a", "function", "of", "numStdDev", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hll/RelativeErrorTables.java#L22-L46
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/cpc/CpcWrapper.java
CpcWrapper.getEstimate
public double getEstimate() { if (!hasHip(mem)) { return getIconEstimate(PreambleUtil.getLgK(mem), getNumCoupons(mem)); } return getHipAccum(mem); }
java
public double getEstimate() { if (!hasHip(mem)) { return getIconEstimate(PreambleUtil.getLgK(mem), getNumCoupons(mem)); } return getHipAccum(mem); }
[ "public", "double", "getEstimate", "(", ")", "{", "if", "(", "!", "hasHip", "(", "mem", ")", ")", "{", "return", "getIconEstimate", "(", "PreambleUtil", ".", "getLgK", "(", "mem", ")", ",", "getNumCoupons", "(", "mem", ")", ")", ";", "}", "return", "...
Returns the best estimate of the cardinality of the sketch. @return the best estimate of the cardinality of the sketch.
[ "Returns", "the", "best", "estimate", "of", "the", "cardinality", "of", "the", "sketch", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/cpc/CpcWrapper.java#L55-L60
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/HeapCompactOrderedSketch.java
HeapCompactOrderedSketch.heapifyInstance
static CompactSketch heapifyInstance(final Memory srcMem, final long seed) { final short memSeedHash = (short) extractSeedHash(srcMem); final short computedSeedHash = computeSeedHash(seed); checkSeedHashes(memSeedHash, computedSeedHash); final int preLongs = extractPreLongs(srcMem); final boolean e...
java
static CompactSketch heapifyInstance(final Memory srcMem, final long seed) { final short memSeedHash = (short) extractSeedHash(srcMem); final short computedSeedHash = computeSeedHash(seed); checkSeedHashes(memSeedHash, computedSeedHash); final int preLongs = extractPreLongs(srcMem); final boolean e...
[ "static", "CompactSketch", "heapifyInstance", "(", "final", "Memory", "srcMem", ",", "final", "long", "seed", ")", "{", "final", "short", "memSeedHash", "=", "(", "short", ")", "extractSeedHash", "(", "srcMem", ")", ";", "final", "short", "computedSeedHash", "...
Heapifies the given source Memory with seed @param srcMem <a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a> @param seed <a href="{@docRoot}/resources/dictionary.html#seed">See Update Hash Seed</a>. @return a CompactSketch
[ "Heapifies", "the", "given", "source", "Memory", "with", "seed" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/HeapCompactOrderedSketch.java#L45-L72
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/HeapCompactOrderedSketch.java
HeapCompactOrderedSketch.compact
static CompactSketch compact(final UpdateSketch sketch) { final int curCount = sketch.getRetainedEntries(true); long thetaLong = sketch.getThetaLong(); boolean empty = sketch.isEmpty(); thetaLong = thetaOnCompact(empty, curCount, thetaLong); empty = emptyOnCompact(curCount, thetaLong); final sho...
java
static CompactSketch compact(final UpdateSketch sketch) { final int curCount = sketch.getRetainedEntries(true); long thetaLong = sketch.getThetaLong(); boolean empty = sketch.isEmpty(); thetaLong = thetaOnCompact(empty, curCount, thetaLong); empty = emptyOnCompact(curCount, thetaLong); final sho...
[ "static", "CompactSketch", "compact", "(", "final", "UpdateSketch", "sketch", ")", "{", "final", "int", "curCount", "=", "sketch", ".", "getRetainedEntries", "(", "true", ")", ";", "long", "thetaLong", "=", "sketch", ".", "getThetaLong", "(", ")", ";", "bool...
Converts the given UpdateSketch to this compact form. @param sketch the given UpdateSketch @return a CompactSketch
[ "Converts", "the", "given", "UpdateSketch", "to", "this", "compact", "form", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/HeapCompactOrderedSketch.java#L79-L93
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/QuickSelect.java
QuickSelect.select
public static double select(final double[] arr, int lo, int hi, final int pivot) { while (hi > lo) { final int j = partition(arr, lo, hi); if (j == pivot) { return arr[pivot]; } if (j > pivot) { hi = j - 1; } else { lo = j + 1; } } return arr...
java
public static double select(final double[] arr, int lo, int hi, final int pivot) { while (hi > lo) { final int j = partition(arr, lo, hi); if (j == pivot) { return arr[pivot]; } if (j > pivot) { hi = j - 1; } else { lo = j + 1; } } return arr...
[ "public", "static", "double", "select", "(", "final", "double", "[", "]", "arr", ",", "int", "lo", ",", "int", "hi", ",", "final", "int", "pivot", ")", "{", "while", "(", "hi", ">", "lo", ")", "{", "final", "int", "j", "=", "partition", "(", "arr...
Gets the 0-based kth order statistic from the array. Warning! This changes the ordering of elements in the given array! @param arr The array to be re-arranged. @param lo The lowest 0-based index to be considered. @param hi The highest 0-based index to be considered. @param pivot The 0-based smallest value to pivot on....
[ "Gets", "the", "0", "-", "based", "kth", "order", "statistic", "from", "the", "array", ".", "Warning!", "This", "changes", "the", "ordering", "of", "elements", "in", "the", "given", "array!" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/QuickSelect.java#L136-L150
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/QuickSelect.java
QuickSelect.selectIncludingZeros
public static double selectIncludingZeros(final double[] arr, final int pivot) { final int arrSize = arr.length; final int adj = pivot - 1; return select(arr, 0, arrSize - 1, adj); }
java
public static double selectIncludingZeros(final double[] arr, final int pivot) { final int arrSize = arr.length; final int adj = pivot - 1; return select(arr, 0, arrSize - 1, adj); }
[ "public", "static", "double", "selectIncludingZeros", "(", "final", "double", "[", "]", "arr", ",", "final", "int", "pivot", ")", "{", "final", "int", "arrSize", "=", "arr", ".", "length", ";", "final", "int", "adj", "=", "pivot", "-", "1", ";", "retur...
Gets the 1-based kth order statistic from the array including any zero values in the array. Warning! This changes the ordering of elements in the given array! @param arr The hash array. @param pivot The 1-based index of the value that is chosen as the pivot for the array. After the operation all values below this 1-ba...
[ "Gets", "the", "1", "-", "based", "kth", "order", "statistic", "from", "the", "array", "including", "any", "zero", "values", "in", "the", "array", ".", "Warning!", "This", "changes", "the", "ordering", "of", "elements", "in", "the", "given", "array!" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/QuickSelect.java#L163-L167
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/QuickSelect.java
QuickSelect.selectExcludingZeros
public static double selectExcludingZeros(final double[] arr, final int nonZeros, final int pivot) { if (pivot > nonZeros) { return 0L; } final int arrSize = arr.length; final int zeros = arrSize - nonZeros; final int adjK = (pivot + zeros) - 1; return select(arr, 0, arrSize - 1, adjK); ...
java
public static double selectExcludingZeros(final double[] arr, final int nonZeros, final int pivot) { if (pivot > nonZeros) { return 0L; } final int arrSize = arr.length; final int zeros = arrSize - nonZeros; final int adjK = (pivot + zeros) - 1; return select(arr, 0, arrSize - 1, adjK); ...
[ "public", "static", "double", "selectExcludingZeros", "(", "final", "double", "[", "]", "arr", ",", "final", "int", "nonZeros", ",", "final", "int", "pivot", ")", "{", "if", "(", "pivot", ">", "nonZeros", ")", "{", "return", "0L", ";", "}", "final", "i...
Gets the 1-based kth order statistic from the array excluding any zero values in the array. Warning! This changes the ordering of elements in the given array! @param arr The hash array. @param nonZeros The number of non-zero values in the array. @param pivot The 1-based index of the value that is chosen as the pivot f...
[ "Gets", "the", "1", "-", "based", "kth", "order", "statistic", "from", "the", "array", "excluding", "any", "zero", "values", "in", "the", "array", ".", "Warning!", "This", "changes", "the", "ordering", "of", "elements", "in", "the", "given", "array!" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/QuickSelect.java#L181-L189
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hll/CouponHashSet.java
CouponHashSet.heapifySet
static final CouponHashSet heapifySet(final Memory mem) { final int lgConfigK = extractLgK(mem); final TgtHllType tgtHllType = extractTgtHllType(mem); final CurMode curMode = extractCurMode(mem); final int memArrStart = (curMode == CurMode.LIST) ? LIST_INT_ARR_START : HASH_SET_INT_ARR_START; final ...
java
static final CouponHashSet heapifySet(final Memory mem) { final int lgConfigK = extractLgK(mem); final TgtHllType tgtHllType = extractTgtHllType(mem); final CurMode curMode = extractCurMode(mem); final int memArrStart = (curMode == CurMode.LIST) ? LIST_INT_ARR_START : HASH_SET_INT_ARR_START; final ...
[ "static", "final", "CouponHashSet", "heapifySet", "(", "final", "Memory", "mem", ")", "{", "final", "int", "lgConfigK", "=", "extractLgK", "(", "mem", ")", ";", "final", "TgtHllType", "tgtHllType", "=", "extractTgtHllType", "(", "mem", ")", ";", "final", "Cu...
will also accept List, but results in a Set
[ "will", "also", "accept", "List", "but", "results", "in", "a", "Set" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hll/CouponHashSet.java#L61-L87
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/HeapQuickSelectSketch.java
HeapQuickSelectSketch.heapifyInstance
static HeapQuickSelectSketch heapifyInstance(final Memory srcMem, final long seed) { final int preambleLongs = extractPreLongs(srcMem); //byte 0 final int lgNomLongs = extractLgNomLongs(srcMem); //byte 3 final int lgArrLongs = extractLgArrLongs(srcMem); //byte 4 check...
java
static HeapQuickSelectSketch heapifyInstance(final Memory srcMem, final long seed) { final int preambleLongs = extractPreLongs(srcMem); //byte 0 final int lgNomLongs = extractLgNomLongs(srcMem); //byte 3 final int lgArrLongs = extractLgArrLongs(srcMem); //byte 4 check...
[ "static", "HeapQuickSelectSketch", "heapifyInstance", "(", "final", "Memory", "srcMem", ",", "final", "long", "seed", ")", "{", "final", "int", "preambleLongs", "=", "extractPreLongs", "(", "srcMem", ")", ";", "//byte 0", "final", "int", "lgNomLongs", "=", "extr...
Heapify a sketch from a Memory UpdateSketch or Union object containing sketch data. @param srcMem The source Memory object. <a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a> @param seed <a href="{@docRoot}/resources/dictionary.html#seed">See seed</a> @return instance of this sketch
[ "Heapify", "a", "sketch", "from", "a", "Memory", "UpdateSketch", "or", "Union", "object", "containing", "sketch", "data", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/HeapQuickSelectSketch.java#L97-L126
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/HeapQuickSelectSketch.java
HeapQuickSelectSketch.quickSelectAndRebuild
private final void quickSelectAndRebuild() { final int arrLongs = 1 << lgArrLongs_; final int pivot = (1 << lgNomLongs_) + 1; // pivot for QS thetaLong_ = selectExcludingZeros(cache_, curCount_, pivot); //messes up the cache_ // now we rebuild to clean up dirty data, update count, reconfigure as a ha...
java
private final void quickSelectAndRebuild() { final int arrLongs = 1 << lgArrLongs_; final int pivot = (1 << lgNomLongs_) + 1; // pivot for QS thetaLong_ = selectExcludingZeros(cache_, curCount_, pivot); //messes up the cache_ // now we rebuild to clean up dirty data, update count, reconfigure as a ha...
[ "private", "final", "void", "quickSelectAndRebuild", "(", ")", "{", "final", "int", "arrLongs", "=", "1", "<<", "lgArrLongs_", ";", "final", "int", "pivot", "=", "(", "1", "<<", "lgNomLongs_", ")", "+", "1", ";", "// pivot for QS", "thetaLong_", "=", "sele...
array stays the same size. Changes theta and thus count
[ "array", "stays", "the", "same", "size", ".", "Changes", "theta", "and", "thus", "count" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/HeapQuickSelectSketch.java#L277-L289
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/sampling/VarOptItemsSamples.java
VarOptItemsSamples.items
public T items(final int i) { loadArrays(); return (sampleLists == null ? null : sampleLists.items[i]); }
java
public T items(final int i) { loadArrays(); return (sampleLists == null ? null : sampleLists.items[i]); }
[ "public", "T", "items", "(", "final", "int", "i", ")", "{", "loadArrays", "(", ")", ";", "return", "(", "sampleLists", "==", "null", "?", "null", ":", "sampleLists", ".", "items", "[", "i", "]", ")", ";", "}" ]
Returns a single item from the samples contained in the sketch. Does not perform bounds checking on the input. If this is the first getter call, copies data arrays from the sketch. @param i An index into the list of samples @return The sample at array position <tt>i</tt>
[ "Returns", "a", "single", "item", "from", "the", "samples", "contained", "in", "the", "sketch", ".", "Does", "not", "perform", "bounds", "checking", "on", "the", "input", ".", "If", "this", "is", "the", "first", "getter", "call", "copies", "data", "arrays"...
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/VarOptItemsSamples.java#L227-L230
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/sampling/VarOptItemsSamples.java
VarOptItemsSamples.weights
public double weights(final int i) { loadArrays(); return (sampleLists == null ? Double.NaN : sampleLists.weights[i]); }
java
public double weights(final int i) { loadArrays(); return (sampleLists == null ? Double.NaN : sampleLists.weights[i]); }
[ "public", "double", "weights", "(", "final", "int", "i", ")", "{", "loadArrays", "(", ")", ";", "return", "(", "sampleLists", "==", "null", "?", "Double", ".", "NaN", ":", "sampleLists", ".", "weights", "[", "i", "]", ")", ";", "}" ]
Returns a single weight from the samples contained in the sketch. Does not perform bounds checking on the input. If this is the first getter call, copies data arrays from the sketch. @param i An index into the list of weights @return The weight at array position <tt>i</tt>
[ "Returns", "a", "single", "weight", "from", "the", "samples", "contained", "in", "the", "sketch", ".", "Does", "not", "perform", "bounds", "checking", "on", "the", "input", ".", "If", "this", "is", "the", "first", "getter", "call", "copies", "data", "array...
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/VarOptItemsSamples.java#L248-L251
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/SetOperationBuilder.java
SetOperationBuilder.setNominalEntries
public SetOperationBuilder setNominalEntries(final int nomEntries) { bLgNomLongs = Integer.numberOfTrailingZeros(ceilingPowerOf2(nomEntries)); if ((bLgNomLongs > MAX_LG_NOM_LONGS) || (bLgNomLongs < MIN_LG_NOM_LONGS)) { throw new SketchesArgumentException("Nominal Entries must be >= 16 and <= 67108864: " ...
java
public SetOperationBuilder setNominalEntries(final int nomEntries) { bLgNomLongs = Integer.numberOfTrailingZeros(ceilingPowerOf2(nomEntries)); if ((bLgNomLongs > MAX_LG_NOM_LONGS) || (bLgNomLongs < MIN_LG_NOM_LONGS)) { throw new SketchesArgumentException("Nominal Entries must be >= 16 and <= 67108864: " ...
[ "public", "SetOperationBuilder", "setNominalEntries", "(", "final", "int", "nomEntries", ")", "{", "bLgNomLongs", "=", "Integer", ".", "numberOfTrailingZeros", "(", "ceilingPowerOf2", "(", "nomEntries", ")", ")", ";", "if", "(", "(", "bLgNomLongs", ">", "MAX_LG_NO...
Sets the Nominal Entries for this set operation. The minimum value is 16 and the maximum value is 67,108,864, which is 2^26. Be aware that Unions as large as this maximum value have not been thoroughly tested or characterized for performance. @param nomEntries <a href="{@docRoot}/resources/dictionary.html#nomEntries">N...
[ "Sets", "the", "Nominal", "Entries", "for", "this", "set", "operation", ".", "The", "minimum", "value", "is", "16", "and", "the", "maximum", "value", "is", "67", "108", "864", "which", "is", "2^26", ".", "Be", "aware", "that", "Unions", "as", "large", ...
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/SetOperationBuilder.java#L61-L68
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/SetOperationBuilder.java
SetOperationBuilder.build
public SetOperation build(final Family family, final WritableMemory dstMem) { SetOperation setOp = null; switch (family) { case UNION: { if (dstMem == null) { setOp = UnionImpl.initNewHeapInstance(bLgNomLongs, bSeed, bP, bRF); } else { setOp = UnionImpl.initNewD...
java
public SetOperation build(final Family family, final WritableMemory dstMem) { SetOperation setOp = null; switch (family) { case UNION: { if (dstMem == null) { setOp = UnionImpl.initNewHeapInstance(bLgNomLongs, bSeed, bP, bRF); } else { setOp = UnionImpl.initNewD...
[ "public", "SetOperation", "build", "(", "final", "Family", "family", ",", "final", "WritableMemory", "dstMem", ")", "{", "SetOperation", "setOp", "=", "null", ";", "switch", "(", "family", ")", "{", "case", "UNION", ":", "{", "if", "(", "dstMem", "==", "...
Returns a SetOperation with the current configuration of this Builder, the given Family and the given destination memory. Note that the destination memory cannot be used with AnotB. @param family the chosen SetOperation family @param dstMem The destination Memory. @return a SetOperation
[ "Returns", "a", "SetOperation", "with", "the", "current", "configuration", "of", "this", "Builder", "the", "given", "Family", "and", "the", "given", "destination", "memory", ".", "Note", "that", "the", "destination", "memory", "cannot", "be", "used", "with", "...
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/SetOperationBuilder.java#L173-L209
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/frequencies/ReversePurgeLongHashMap.java
ReversePurgeLongHashMap.getInstance
static ReversePurgeLongHashMap getInstance(final String string) { final String[] tokens = string.split(","); if (tokens.length < 2) { throw new SketchesArgumentException( "String not long enough to specify length and capacity."); } final int numActive = Integer.parseInt(tokens[0]); f...
java
static ReversePurgeLongHashMap getInstance(final String string) { final String[] tokens = string.split(","); if (tokens.length < 2) { throw new SketchesArgumentException( "String not long enough to specify length and capacity."); } final int numActive = Integer.parseInt(tokens[0]); f...
[ "static", "ReversePurgeLongHashMap", "getInstance", "(", "final", "String", "string", ")", "{", "final", "String", "[", "]", "tokens", "=", "string", ".", "split", "(", "\",\"", ")", ";", "if", "(", "tokens", ".", "length", "<", "2", ")", "{", "throw", ...
Returns an instance of this class from the given String, which must be a String representation of this class. @param string a String representation of this class. @return an instance of this class.
[ "Returns", "an", "instance", "of", "this", "class", "from", "the", "given", "String", "which", "must", "be", "a", "String", "representation", "of", "this", "class", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/frequencies/ReversePurgeLongHashMap.java#L59-L75
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/frequencies/ReversePurgeLongHashMap.java
ReversePurgeLongHashMap.serializeToString
String serializeToString() { final StringBuilder sb = new StringBuilder(); sb.append(String.format("%d,%d,", numActive, keys.length)); for (int i = 0; i < keys.length; i++) { if (states[i] != 0) { sb.append(String.format("%d,%d,", keys[i], values[i])); } } return sb.toString(); ...
java
String serializeToString() { final StringBuilder sb = new StringBuilder(); sb.append(String.format("%d,%d,", numActive, keys.length)); for (int i = 0; i < keys.length; i++) { if (states[i] != 0) { sb.append(String.format("%d,%d,", keys[i], values[i])); } } return sb.toString(); ...
[ "String", "serializeToString", "(", ")", "{", "final", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "String", ".", "format", "(", "\"%d,%d,\"", ",", "numActive", ",", "keys", ".", "length", ")", ")", ";", ...
Returns a String representation of this hash map. @return a String representation of this hash map.
[ "Returns", "a", "String", "representation", "of", "this", "hash", "map", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/frequencies/ReversePurgeLongHashMap.java#L84-L94
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/frequencies/ReversePurgeLongHashMap.java
ReversePurgeLongHashMap.keepOnlyPositiveCounts
void keepOnlyPositiveCounts() { // Starting from the back, find the first empty cell, which marks a boundary between clusters. int firstProbe = keys.length - 1; while (states[firstProbe] > 0) { firstProbe--; } //Work towards the front; delete any non-positive entries. for (int probe = fir...
java
void keepOnlyPositiveCounts() { // Starting from the back, find the first empty cell, which marks a boundary between clusters. int firstProbe = keys.length - 1; while (states[firstProbe] > 0) { firstProbe--; } //Work towards the front; delete any non-positive entries. for (int probe = fir...
[ "void", "keepOnlyPositiveCounts", "(", ")", "{", "// Starting from the back, find the first empty cell, which marks a boundary between clusters.", "int", "firstProbe", "=", "keys", ".", "length", "-", "1", ";", "while", "(", "states", "[", "firstProbe", "]", ">", "0", "...
Processes the map arrays and retains only keys with positive counts.
[ "Processes", "the", "map", "arrays", "and", "retains", "only", "keys", "with", "positive", "counts", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/frequencies/ReversePurgeLongHashMap.java#L154-L177
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/BoundsOnRatiosInThetaSketchedSets.java
BoundsOnRatiosInThetaSketchedSets.getLowerBoundForBoverA
public static double getLowerBoundForBoverA(final Sketch sketchA, final Sketch sketchB) { final double thetaA = sketchA.getTheta(); final double thetaB = sketchB.getTheta(); checkThetas(thetaA, thetaB); final int countB = sketchB.getRetainedEntries(true); final int countA = (thetaB == thetaA) ? ske...
java
public static double getLowerBoundForBoverA(final Sketch sketchA, final Sketch sketchB) { final double thetaA = sketchA.getTheta(); final double thetaB = sketchB.getTheta(); checkThetas(thetaA, thetaB); final int countB = sketchB.getRetainedEntries(true); final int countA = (thetaB == thetaA) ? ske...
[ "public", "static", "double", "getLowerBoundForBoverA", "(", "final", "Sketch", "sketchA", ",", "final", "Sketch", "sketchB", ")", "{", "final", "double", "thetaA", "=", "sketchA", ".", "getTheta", "(", ")", ";", "final", "double", "thetaB", "=", "sketchB", ...
Gets the approximate lower bound for B over A based on a 95% confidence interval @param sketchA the sketch A @param sketchB the sketch B @return the approximate lower bound for B over A
[ "Gets", "the", "approximate", "lower", "bound", "for", "B", "over", "A", "based", "on", "a", "95%", "confidence", "interval" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/BoundsOnRatiosInThetaSketchedSets.java#L41-L53
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/ItemsMergeImpl.java
ItemsMergeImpl.blockyTandemMergeSort
static <T> void blockyTandemMergeSort(final T[] keyArr, final long[] valArr, final int arrLen, final int blkSize, final Comparator<? super T> comparator) { assert blkSize >= 1; if (arrLen <= blkSize) { return; } int numblks = arrLen / blkSize; if ((numblks * blkSize) < arrLen) { numblks += 1; } ...
java
static <T> void blockyTandemMergeSort(final T[] keyArr, final long[] valArr, final int arrLen, final int blkSize, final Comparator<? super T> comparator) { assert blkSize >= 1; if (arrLen <= blkSize) { return; } int numblks = arrLen / blkSize; if ((numblks * blkSize) < arrLen) { numblks += 1; } ...
[ "static", "<", "T", ">", "void", "blockyTandemMergeSort", "(", "final", "T", "[", "]", "keyArr", ",", "final", "long", "[", "]", "valArr", ",", "final", "int", "arrLen", ",", "final", "int", "blkSize", ",", "final", "Comparator", "<", "?", "super", "T"...
also used by ItemsAuxiliary
[ "also", "used", "by", "ItemsAuxiliary" ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsMergeImpl.java#L216-L232
train
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/sampling/ReservoirSize.java
ReservoirSize.decodeValue
public static int decodeValue(final short encodedSize) { final int value = encodedSize & 0xFFFF; if (value > MAX_ENC_VALUE) { throw new SketchesArgumentException("Maximum valid encoded value is " + Integer.toHexString(MAX_ENC_VALUE) + ", found: " + value); } final int p = (value >>...
java
public static int decodeValue(final short encodedSize) { final int value = encodedSize & 0xFFFF; if (value > MAX_ENC_VALUE) { throw new SketchesArgumentException("Maximum valid encoded value is " + Integer.toHexString(MAX_ENC_VALUE) + ", found: " + value); } final int p = (value >>...
[ "public", "static", "int", "decodeValue", "(", "final", "short", "encodedSize", ")", "{", "final", "int", "value", "=", "encodedSize", "&", "0xFFFF", ";", "if", "(", "value", ">", "MAX_ENC_VALUE", ")", "{", "throw", "new", "SketchesArgumentException", "(", "...
Decodes the 16-bit reservoir size value into an int. @param encodedSize Encoded 16-bit value @return int represented by <tt>encodedSize</tt>
[ "Decodes", "the", "16", "-", "bit", "reservoir", "size", "value", "into", "an", "int", "." ]
900c8c9668a1e2f1d54d453e956caad54702e540
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/ReservoirSize.java#L95-L107
train
mokies/ratelimitj
ratelimitj-core/src/main/java/es/moki/ratelimitj/core/limiter/concurrent/ConcurrentLimitRule.java
ConcurrentLimitRule.of
public static ConcurrentLimitRule of(int concurrentLimit, TimeUnit timeOutUnit, long timeOut) { requireNonNull(timeOutUnit, "time out unit can not be null"); return new ConcurrentLimitRule(concurrentLimit, timeOutUnit.toMillis(timeOut)); }
java
public static ConcurrentLimitRule of(int concurrentLimit, TimeUnit timeOutUnit, long timeOut) { requireNonNull(timeOutUnit, "time out unit can not be null"); return new ConcurrentLimitRule(concurrentLimit, timeOutUnit.toMillis(timeOut)); }
[ "public", "static", "ConcurrentLimitRule", "of", "(", "int", "concurrentLimit", ",", "TimeUnit", "timeOutUnit", ",", "long", "timeOut", ")", "{", "requireNonNull", "(", "timeOutUnit", ",", "\"time out unit can not be null\"", ")", ";", "return", "new", "ConcurrentLimi...
Initialise a concurrent rate limit. @param concurrentLimit The concurrent limit. @param timeOutUnit The time unit. @param timeOut A timeOut for the checkout baton. @return A concurrent limit rule.
[ "Initialise", "a", "concurrent", "rate", "limit", "." ]
eb15ec42055c46b2b3f6f84131d86f570e489c32
https://github.com/mokies/ratelimitj/blob/eb15ec42055c46b2b3f6f84131d86f570e489c32/ratelimitj-core/src/main/java/es/moki/ratelimitj/core/limiter/concurrent/ConcurrentLimitRule.java#L35-L38
train
mokies/ratelimitj
ratelimitj-core/src/main/java/es/moki/ratelimitj/core/limiter/request/RequestLimitRule.java
RequestLimitRule.of
public static RequestLimitRule of(Duration duration, long limit) { checkDuration(duration); if (limit < 0) { throw new IllegalArgumentException("limit must be greater than zero."); } int durationSeconds = (int) duration.getSeconds(); return new RequestLimitRule(durati...
java
public static RequestLimitRule of(Duration duration, long limit) { checkDuration(duration); if (limit < 0) { throw new IllegalArgumentException("limit must be greater than zero."); } int durationSeconds = (int) duration.getSeconds(); return new RequestLimitRule(durati...
[ "public", "static", "RequestLimitRule", "of", "(", "Duration", "duration", ",", "long", "limit", ")", "{", "checkDuration", "(", "duration", ")", ";", "if", "(", "limit", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"limit must be gre...
Initialise a request rate limit. Imagine the whole duration window as being one large bucket with a single count. @param duration The time the limit will be applied over. The duration must be greater than 1 second. @param limit A number representing the maximum operations that can be performed in the given duration...
[ "Initialise", "a", "request", "rate", "limit", ".", "Imagine", "the", "whole", "duration", "window", "as", "being", "one", "large", "bucket", "with", "a", "single", "count", "." ]
eb15ec42055c46b2b3f6f84131d86f570e489c32
https://github.com/mokies/ratelimitj/blob/eb15ec42055c46b2b3f6f84131d86f570e489c32/ratelimitj-core/src/main/java/es/moki/ratelimitj/core/limiter/request/RequestLimitRule.java#L55-L62
train
mokies/ratelimitj
ratelimitj-core/src/main/java/es/moki/ratelimitj/core/limiter/request/RequestLimitRule.java
RequestLimitRule.withName
public RequestLimitRule withName(String name) { return new RequestLimitRule(this.durationSeconds, this.limit, this.precision, name, this.keys); }
java
public RequestLimitRule withName(String name) { return new RequestLimitRule(this.durationSeconds, this.limit, this.precision, name, this.keys); }
[ "public", "RequestLimitRule", "withName", "(", "String", "name", ")", "{", "return", "new", "RequestLimitRule", "(", "this", ".", "durationSeconds", ",", "this", ".", "limit", ",", "this", ".", "precision", ",", "name", ",", "this", ".", "keys", ")", ";", ...
Applies a name to the rate limit that is useful for metrics. @param name Defines a descriptive name for the rule limit. @return a limit rule
[ "Applies", "a", "name", "to", "the", "rate", "limit", "that", "is", "useful", "for", "metrics", "." ]
eb15ec42055c46b2b3f6f84131d86f570e489c32
https://github.com/mokies/ratelimitj/blob/eb15ec42055c46b2b3f6f84131d86f570e489c32/ratelimitj-core/src/main/java/es/moki/ratelimitj/core/limiter/request/RequestLimitRule.java#L81-L83
train
mokies/ratelimitj
ratelimitj-core/src/main/java/es/moki/ratelimitj/core/limiter/request/RequestLimitRule.java
RequestLimitRule.matchingKeys
public RequestLimitRule matchingKeys(String... keys) { Set<String> keySet = keys.length > 0 ? new HashSet<>(Arrays.asList(keys)) : null; return matchingKeys(keySet); }
java
public RequestLimitRule matchingKeys(String... keys) { Set<String> keySet = keys.length > 0 ? new HashSet<>(Arrays.asList(keys)) : null; return matchingKeys(keySet); }
[ "public", "RequestLimitRule", "matchingKeys", "(", "String", "...", "keys", ")", "{", "Set", "<", "String", ">", "keySet", "=", "keys", ".", "length", ">", "0", "?", "new", "HashSet", "<>", "(", "Arrays", ".", "asList", "(", "keys", ")", ")", ":", "n...
Applies a key to the rate limit that defines to which keys, the rule applies, empty for any unmatched key. @param keys Defines a set of keys to which the rule applies. @return a limit rule
[ "Applies", "a", "key", "to", "the", "rate", "limit", "that", "defines", "to", "which", "keys", "the", "rule", "applies", "empty", "for", "any", "unmatched", "key", "." ]
eb15ec42055c46b2b3f6f84131d86f570e489c32
https://github.com/mokies/ratelimitj/blob/eb15ec42055c46b2b3f6f84131d86f570e489c32/ratelimitj-core/src/main/java/es/moki/ratelimitj/core/limiter/request/RequestLimitRule.java#L91-L94
train
mokies/ratelimitj
ratelimitj-core/src/main/java/es/moki/ratelimitj/core/limiter/request/RequestLimitRule.java
RequestLimitRule.matchingKeys
public RequestLimitRule matchingKeys(Set<String> keys) { return new RequestLimitRule(this.durationSeconds, this.limit, this.precision, this.name, keys); }
java
public RequestLimitRule matchingKeys(Set<String> keys) { return new RequestLimitRule(this.durationSeconds, this.limit, this.precision, this.name, keys); }
[ "public", "RequestLimitRule", "matchingKeys", "(", "Set", "<", "String", ">", "keys", ")", "{", "return", "new", "RequestLimitRule", "(", "this", ".", "durationSeconds", ",", "this", ".", "limit", ",", "this", ".", "precision", ",", "this", ".", "name", ",...
Applies a key to the rate limit that defines to which keys, the rule applies, null for any unmatched key. @param keys Defines a set of keys to which the rule applies. @return a limit rule
[ "Applies", "a", "key", "to", "the", "rate", "limit", "that", "defines", "to", "which", "keys", "the", "rule", "applies", "null", "for", "any", "unmatched", "key", "." ]
eb15ec42055c46b2b3f6f84131d86f570e489c32
https://github.com/mokies/ratelimitj/blob/eb15ec42055c46b2b3f6f84131d86f570e489c32/ratelimitj-core/src/main/java/es/moki/ratelimitj/core/limiter/request/RequestLimitRule.java#L102-L104
train
Netflix/governator
governator-core/src/main/java/com/netflix/governator/internal/PreDestroyMonitor.java
PreDestroyMonitor.addScopeBindings
public void addScopeBindings(Map<Class<? extends Annotation>, Scope> bindings) { if (scopeCleaner.isRunning()) { scopeBindings.putAll(bindings); } }
java
public void addScopeBindings(Map<Class<? extends Annotation>, Scope> bindings) { if (scopeCleaner.isRunning()) { scopeBindings.putAll(bindings); } }
[ "public", "void", "addScopeBindings", "(", "Map", "<", "Class", "<", "?", "extends", "Annotation", ">", ",", "Scope", ">", "bindings", ")", "{", "if", "(", "scopeCleaner", ".", "isRunning", "(", ")", ")", "{", "scopeBindings", ".", "putAll", "(", "bindin...
allows late-binding of scopes to PreDestroyMonitor, useful if more than one Injector contributes scope bindings @param bindings additional annotation-to-scope bindings to add
[ "allows", "late", "-", "binding", "of", "scopes", "to", "PreDestroyMonitor", "useful", "if", "more", "than", "one", "Injector", "contributes", "scope", "bindings" ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-core/src/main/java/com/netflix/governator/internal/PreDestroyMonitor.java#L181-L185
train
Netflix/governator
governator-core/src/main/java/com/netflix/governator/internal/PreDestroyMonitor.java
PreDestroyMonitor.close
@Override public void close() throws Exception { if (scopeCleaner.close()) { // executor thread to exit processing loop LOGGER.info("closing PreDestroyMonitor..."); List<Map.Entry<Object, UnscopedCleanupAction>> actions = new ArrayList<>(cleanupActions.entrySet()); ...
java
@Override public void close() throws Exception { if (scopeCleaner.close()) { // executor thread to exit processing loop LOGGER.info("closing PreDestroyMonitor..."); List<Map.Entry<Object, UnscopedCleanupAction>> actions = new ArrayList<>(cleanupActions.entrySet()); ...
[ "@", "Override", "public", "void", "close", "(", ")", "throws", "Exception", "{", "if", "(", "scopeCleaner", ".", "close", "(", ")", ")", "{", "// executor thread to exit processing loop ", "LOGGER", ".", "info", "(", "\"closing PreDestroyMonitor...\"", "...
final cleanup of managed instances if any
[ "final", "cleanup", "of", "managed", "instances", "if", "any" ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-core/src/main/java/com/netflix/governator/internal/PreDestroyMonitor.java#L190-L212
train
Netflix/governator
governator-core/src/main/java/com/netflix/governator/InjectorBuilder.java
InjectorBuilder.combineWith
public InjectorBuilder combineWith(Module ... modules) { List<Module> m = new ArrayList<>(); m.add(module); m.addAll(Arrays.asList(modules)); this.module = Modules.combine(m); return this; }
java
public InjectorBuilder combineWith(Module ... modules) { List<Module> m = new ArrayList<>(); m.add(module); m.addAll(Arrays.asList(modules)); this.module = Modules.combine(m); return this; }
[ "public", "InjectorBuilder", "combineWith", "(", "Module", "...", "modules", ")", "{", "List", "<", "Module", ">", "m", "=", "new", "ArrayList", "<>", "(", ")", ";", "m", ".", "add", "(", "module", ")", ";", "m", ".", "addAll", "(", "Arrays", ".", ...
Add additional bindings to the module tracked by the DSL @param modules
[ "Add", "additional", "bindings", "to", "the", "module", "tracked", "by", "the", "DSL" ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-core/src/main/java/com/netflix/governator/InjectorBuilder.java#L96-L102
train
Netflix/governator
governator-core/src/main/java/com/netflix/governator/InjectorBuilder.java
InjectorBuilder.forEachElement
public <T> InjectorBuilder forEachElement(ElementVisitor<T> visitor, Consumer<T> consumer) { Elements .getElements(module) .forEach(element -> Optional.ofNullable(element.acceptVisitor(visitor)).ifPresent(consumer)); return this; }
java
public <T> InjectorBuilder forEachElement(ElementVisitor<T> visitor, Consumer<T> consumer) { Elements .getElements(module) .forEach(element -> Optional.ofNullable(element.acceptVisitor(visitor)).ifPresent(consumer)); return this; }
[ "public", "<", "T", ">", "InjectorBuilder", "forEachElement", "(", "ElementVisitor", "<", "T", ">", "visitor", ",", "Consumer", "<", "T", ">", "consumer", ")", "{", "Elements", ".", "getElements", "(", "module", ")", ".", "forEach", "(", "element", "->", ...
Iterate through all elements of the current module and pass the output of the ElementVisitor to the provided consumer. 'null' responses from the visitor are ignored. This call will not modify any bindings @param visitor
[ "Iterate", "through", "all", "elements", "of", "the", "current", "module", "and", "pass", "the", "output", "of", "the", "ElementVisitor", "to", "the", "provided", "consumer", ".", "null", "responses", "from", "the", "visitor", "are", "ignored", "." ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-core/src/main/java/com/netflix/governator/InjectorBuilder.java#L123-L128
train
Netflix/governator
governator-core/src/main/java/com/netflix/governator/InjectorBuilder.java
InjectorBuilder.forEachElement
public <T> InjectorBuilder forEachElement(ElementVisitor<T> visitor) { Elements .getElements(module) .forEach(element -> element.acceptVisitor(visitor)); return this; }
java
public <T> InjectorBuilder forEachElement(ElementVisitor<T> visitor) { Elements .getElements(module) .forEach(element -> element.acceptVisitor(visitor)); return this; }
[ "public", "<", "T", ">", "InjectorBuilder", "forEachElement", "(", "ElementVisitor", "<", "T", ">", "visitor", ")", "{", "Elements", ".", "getElements", "(", "module", ")", ".", "forEach", "(", "element", "->", "element", ".", "acceptVisitor", "(", "visitor"...
Call the provided visitor for all elements of the current module. This call will not modify any bindings @param visitor
[ "Call", "the", "provided", "visitor", "for", "all", "elements", "of", "the", "current", "module", "." ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-core/src/main/java/com/netflix/governator/InjectorBuilder.java#L136-L141
train
Netflix/governator
governator-core/src/main/java/com/netflix/governator/InjectorBuilder.java
InjectorBuilder.filter
public InjectorBuilder filter(ElementVisitor<Boolean> predicate) { List<Element> elements = new ArrayList<Element>(); for (Element element : Elements.getElements(Stage.TOOL, module)) { if (element.acceptVisitor(predicate)) { elements.add(element); } } ...
java
public InjectorBuilder filter(ElementVisitor<Boolean> predicate) { List<Element> elements = new ArrayList<Element>(); for (Element element : Elements.getElements(Stage.TOOL, module)) { if (element.acceptVisitor(predicate)) { elements.add(element); } } ...
[ "public", "InjectorBuilder", "filter", "(", "ElementVisitor", "<", "Boolean", ">", "predicate", ")", "{", "List", "<", "Element", ">", "elements", "=", "new", "ArrayList", "<", "Element", ">", "(", ")", ";", "for", "(", "Element", "element", ":", "Elements...
Filter out elements for which the provided visitor returns true. @param predicate
[ "Filter", "out", "elements", "for", "which", "the", "provided", "visitor", "returns", "true", "." ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-core/src/main/java/com/netflix/governator/InjectorBuilder.java#L173-L182
train
Netflix/governator
governator-legacy/src/main/java/com/netflix/governator/guice/ModulesEx.java
ModulesEx.combineAndOverride
public static Module combineAndOverride(List<? extends Module> modules) { Iterator<? extends Module> iter = modules.iterator(); Module current = Modules.EMPTY_MODULE; if (iter.hasNext()) { current = iter.next(); if (iter.hasNext()) { current = Modules.over...
java
public static Module combineAndOverride(List<? extends Module> modules) { Iterator<? extends Module> iter = modules.iterator(); Module current = Modules.EMPTY_MODULE; if (iter.hasNext()) { current = iter.next(); if (iter.hasNext()) { current = Modules.over...
[ "public", "static", "Module", "combineAndOverride", "(", "List", "<", "?", "extends", "Module", ">", "modules", ")", "{", "Iterator", "<", "?", "extends", "Module", ">", "iter", "=", "modules", ".", "iterator", "(", ")", ";", "Module", "current", "=", "M...
Generate a single module that is produced by accumulating and overriding each module with the next. <pre> {@code Guice.createInjector(ModuleUtils.combineAndOverride(moduleA, moduleAOverrides, moduleB)); } </pre> @param modules @return
[ "Generate", "a", "single", "module", "that", "is", "produced", "by", "accumulating", "and", "overriding", "each", "module", "with", "the", "next", "." ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-legacy/src/main/java/com/netflix/governator/guice/ModulesEx.java#L43-L54
train
Netflix/governator
governator-legacy/src/main/java/com/netflix/governator/guice/ModulesEx.java
ModulesEx.fromClass
public static Module fromClass(final Class<?> cls, final boolean override) { List<Module> modules = new ArrayList<>(); // Iterate through all annotations of the main class, create a binding for the annotation // and add the module to the list of modules to install for (final Annotation a...
java
public static Module fromClass(final Class<?> cls, final boolean override) { List<Module> modules = new ArrayList<>(); // Iterate through all annotations of the main class, create a binding for the annotation // and add the module to the list of modules to install for (final Annotation a...
[ "public", "static", "Module", "fromClass", "(", "final", "Class", "<", "?", ">", "cls", ",", "final", "boolean", "override", ")", "{", "List", "<", "Module", ">", "modules", "=", "new", "ArrayList", "<>", "(", ")", ";", "// Iterate through all annotations of...
Create a single module that derived from all bootstrap annotations on a class, where that class itself is a module. For example, <pre> {@code public class MainApplicationModule extends AbstractModule { @Override public void configure() { // Application specific bindings here } public static void main(String[] args) {...
[ "Create", "a", "single", "module", "that", "derived", "from", "all", "bootstrap", "annotations", "on", "a", "class", "where", "that", "class", "itself", "is", "a", "module", "." ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-legacy/src/main/java/com/netflix/governator/guice/ModulesEx.java#L81-L109
train
Netflix/governator
governator-core/src/main/java/com/netflix/governator/Governator.java
Governator.setFeature
public <T> Governator setFeature(GovernatorFeature<T> feature, T value) { this.featureOverrides.put(feature, value); return this; }
java
public <T> Governator setFeature(GovernatorFeature<T> feature, T value) { this.featureOverrides.put(feature, value); return this; }
[ "public", "<", "T", ">", "Governator", "setFeature", "(", "GovernatorFeature", "<", "T", ">", "feature", ",", "T", "value", ")", "{", "this", ".", "featureOverrides", ".", "put", "(", "feature", ",", "value", ")", ";", "return", "this", ";", "}" ]
Set a feature @param feature Feature to set @return this
[ "Set", "a", "feature" ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-core/src/main/java/com/netflix/governator/Governator.java#L190-L193
train
Netflix/governator
governator-core/src/main/java/com/netflix/governator/Governator.java
Governator.run
private LifecycleInjector run(Module externalModule, final String[] args) { return InjectorBuilder .fromModules(modules) .combineWith(externalModule) .map(new ModuleTransformer() { @Override public Module transform(Module module) { ...
java
private LifecycleInjector run(Module externalModule, final String[] args) { return InjectorBuilder .fromModules(modules) .combineWith(externalModule) .map(new ModuleTransformer() { @Override public Module transform(Module module) { ...
[ "private", "LifecycleInjector", "run", "(", "Module", "externalModule", ",", "final", "String", "[", "]", "args", ")", "{", "return", "InjectorBuilder", ".", "fromModules", "(", "modules", ")", ".", "combineWith", "(", "externalModule", ")", ".", "map", "(", ...
Create the injector and call any LifecycleListeners @param args - Runtime parameter (from main) injectable as {@literal @}Arguments String[] @return the LifecycleInjector for this run
[ "Create", "the", "injector", "and", "call", "any", "LifecycleListeners" ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-core/src/main/java/com/netflix/governator/Governator.java#L288-L308
train
Netflix/governator
governator-legacy/src/main/java/com/netflix/governator/guice/Grapher.java
Grapher.toFile
public String toFile() throws Exception { File file = File.createTempFile("GuiceDependencies_", ".dot"); toFile(file); return file.getCanonicalPath(); }
java
public String toFile() throws Exception { File file = File.createTempFile("GuiceDependencies_", ".dot"); toFile(file); return file.getCanonicalPath(); }
[ "public", "String", "toFile", "(", ")", "throws", "Exception", "{", "File", "file", "=", "File", ".", "createTempFile", "(", "\"GuiceDependencies_\"", ",", "\".dot\"", ")", ";", "toFile", "(", "file", ")", ";", "return", "file", ".", "getCanonicalPath", "(",...
Writes the "Dot" graph to a new temp file. @return the name of the newly created file
[ "Writes", "the", "Dot", "graph", "to", "a", "new", "temp", "file", "." ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-legacy/src/main/java/com/netflix/governator/guice/Grapher.java#L120-L124
train
Netflix/governator
governator-legacy/src/main/java/com/netflix/governator/guice/Grapher.java
Grapher.toFile
public void toFile(File file) throws Exception { PrintWriter out = new PrintWriter(file, "UTF-8"); try { out.write(graph()); } finally { Closeables.close(out, true); } }
java
public void toFile(File file) throws Exception { PrintWriter out = new PrintWriter(file, "UTF-8"); try { out.write(graph()); } finally { Closeables.close(out, true); } }
[ "public", "void", "toFile", "(", "File", "file", ")", "throws", "Exception", "{", "PrintWriter", "out", "=", "new", "PrintWriter", "(", "file", ",", "\"UTF-8\"", ")", ";", "try", "{", "out", ".", "write", "(", "graph", "(", ")", ")", ";", "}", "final...
Writes the "Dot" graph to a given file. @param file file to write to
[ "Writes", "the", "Dot", "graph", "to", "a", "given", "file", "." ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-legacy/src/main/java/com/netflix/governator/guice/Grapher.java#L131-L139
train
Netflix/governator
governator-legacy/src/main/java/com/netflix/governator/guice/Grapher.java
Grapher.graph
public String graph() throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintWriter out = new PrintWriter(baos); Injector localInjector = Guice.createInjector(new GraphvizModule()); GraphvizGrapher renderer = localInjector.getInstance(GraphvizGrapher.class); ...
java
public String graph() throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintWriter out = new PrintWriter(baos); Injector localInjector = Guice.createInjector(new GraphvizModule()); GraphvizGrapher renderer = localInjector.getInstance(GraphvizGrapher.class); ...
[ "public", "String", "graph", "(", ")", "throws", "Exception", "{", "ByteArrayOutputStream", "baos", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "PrintWriter", "out", "=", "new", "PrintWriter", "(", "baos", ")", ";", "Injector", "localInjector", "=", "G...
Returns a String containing the "Dot" graph definition. @return the "Dot" graph definition
[ "Returns", "a", "String", "containing", "the", "Dot", "graph", "definition", "." ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-legacy/src/main/java/com/netflix/governator/guice/Grapher.java#L146-L158
train
Netflix/governator
governator-jersey/src/main/java/com/netflix/governator/guice/jersey/GovernatorComponentProviderFactory.java
GovernatorComponentProviderFactory.isGuiceConstructorInjected
public boolean isGuiceConstructorInjected(Class<?> c) { for (Constructor<?> con : c.getDeclaredConstructors()) { if (isInjectable(con)) { return true; } } return false; }
java
public boolean isGuiceConstructorInjected(Class<?> c) { for (Constructor<?> con : c.getDeclaredConstructors()) { if (isInjectable(con)) { return true; } } return false; }
[ "public", "boolean", "isGuiceConstructorInjected", "(", "Class", "<", "?", ">", "c", ")", "{", "for", "(", "Constructor", "<", "?", ">", "con", ":", "c", ".", "getDeclaredConstructors", "(", ")", ")", "{", "if", "(", "isInjectable", "(", "con", ")", ")...
Determine if a class is an implicit Guice component that can be instantiated by Guice and the life-cycle managed by Jersey. @param c the class. @return true if the class is an implicit Guice component.
[ "Determine", "if", "a", "class", "is", "an", "implicit", "Guice", "component", "that", "can", "be", "instantiated", "by", "Guice", "and", "the", "life", "-", "cycle", "managed", "by", "Jersey", "." ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-jersey/src/main/java/com/netflix/governator/guice/jersey/GovernatorComponentProviderFactory.java#L163-L171
train
Netflix/governator
governator-jersey/src/main/java/com/netflix/governator/guice/jersey/GovernatorComponentProviderFactory.java
GovernatorComponentProviderFactory.createScopeMap
public Map<Scope, ComponentScope> createScopeMap() { Map<Scope, ComponentScope> result = new HashMap<Scope, ComponentScope>(); result.put(Scopes.SINGLETON, ComponentScope.Singleton); result.put(Scopes.NO_SCOPE, ComponentScope.PerRequest); result.put(ServletScopes.REQUEST, ComponentScope....
java
public Map<Scope, ComponentScope> createScopeMap() { Map<Scope, ComponentScope> result = new HashMap<Scope, ComponentScope>(); result.put(Scopes.SINGLETON, ComponentScope.Singleton); result.put(Scopes.NO_SCOPE, ComponentScope.PerRequest); result.put(ServletScopes.REQUEST, ComponentScope....
[ "public", "Map", "<", "Scope", ",", "ComponentScope", ">", "createScopeMap", "(", ")", "{", "Map", "<", "Scope", ",", "ComponentScope", ">", "result", "=", "new", "HashMap", "<", "Scope", ",", "ComponentScope", ">", "(", ")", ";", "result", ".", "put", ...
Maps a Guice scope to a Jersey scope. @return the map
[ "Maps", "a", "Guice", "scope", "to", "a", "Jersey", "scope", "." ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-jersey/src/main/java/com/netflix/governator/guice/jersey/GovernatorComponentProviderFactory.java#L206-L212
train
Netflix/governator
governator-legacy/src/main/java/com/netflix/governator/configuration/ColumnPrinter.java
ColumnPrinter.addColumn
void addColumn(String columnName) { data.add(new ArrayList<String>()); columnNames.add(columnName); }
java
void addColumn(String columnName) { data.add(new ArrayList<String>()); columnNames.add(columnName); }
[ "void", "addColumn", "(", "String", "columnName", ")", "{", "data", ".", "add", "(", "new", "ArrayList", "<", "String", ">", "(", ")", ")", ";", "columnNames", ".", "add", "(", "columnName", ")", ";", "}" ]
Add a column @param columnName name of the column
[ "Add", "a", "column" ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-legacy/src/main/java/com/netflix/governator/configuration/ColumnPrinter.java#L48-L52
train