Skip to content

Commit d1e10c3

Browse files
committed
Change name of /theta/Sketch to /theta/ThetaSketch
1 parent 63c371a commit d1e10c3

50 files changed

Lines changed: 287 additions & 287 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/main/java/org/apache/datasketches/theta/AnotB.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public Family getFamily() {
9292
*
9393
* @param skA The incoming sketch for the first argument, <i>A</i>.
9494
*/
95-
public abstract void setA(Sketch skA);
95+
public abstract void setA(ThetaSketch skA);
9696

9797
/**
9898
* This is part of a multistep, stateful AnotB operation and sets the given Theta sketch as the
@@ -111,12 +111,12 @@ public Family getFamily() {
111111
*
112112
* @param skB The incoming Theta sketch for the second (or following) argument <i>B</i>.
113113
*/
114-
public abstract void notB(Sketch skB);
114+
public abstract void notB(ThetaSketch skB);
115115

116116
/**
117117
* Gets the result of the multistep, stateful operation AnotB that have been executed with calls
118-
* to {@link #setA(Sketch)} and ({@link #notB(Sketch)} or
119-
* {@link #notB(org.apache.datasketches.theta.Sketch)}).
118+
* to {@link #setA(ThetaSketch)} and ({@link #notB(ThetaSketch)} or
119+
* {@link #notB(org.apache.datasketches.theta.ThetaSketch)}).
120120
*
121121
* @param reset If <i>true</i>, clears this operator to the empty state after this result is
122122
* returned. Set this to <i>false</i> if you wish to obtain an intermediate result.
@@ -127,8 +127,8 @@ public Family getFamily() {
127127

128128
/**
129129
* Gets the result of the multistep, stateful operation AnotB that have been executed with calls
130-
* to {@link #setA(Sketch)} and ({@link #notB(Sketch)} or
131-
* {@link #notB(org.apache.datasketches.theta.Sketch)}).
130+
* to {@link #setA(ThetaSketch)} and ({@link #notB(ThetaSketch)} or
131+
* {@link #notB(org.apache.datasketches.theta.ThetaSketch)}).
132132
*
133133
* @param dstOrdered If <i>true</i>, the result will be an ordered {@link CompactSketch}.
134134
* <a href="{@docRoot}/resources/dictionary.html#dstOrdered">See Destination Ordered</a>.
@@ -147,8 +147,8 @@ public Family getFamily() {
147147
* ordered CompactSketch on the heap.
148148
*
149149
* <p>This a stateless operation and has no impact on the internal state of this operator.
150-
* Thus, this is not an accumulating update and does not interact with the {@link #setA(Sketch)},
151-
* {@link #notB(Sketch)}, {@link #getResult(boolean)}, or
150+
* Thus, this is not an accumulating update and does not interact with the {@link #setA(ThetaSketch)},
151+
* {@link #notB(ThetaSketch)}, {@link #getResult(boolean)}, or
152152
* {@link #getResult(boolean, MemorySegment, boolean)} methods.</p>
153153
*
154154
* <p>If either argument is null an exception is thrown.</p>
@@ -166,7 +166,7 @@ public Family getFamily() {
166166
* @param skB The incoming sketch for the second argument. It must not be null.
167167
* @return an ordered CompactSketch on the heap
168168
*/
169-
public CompactSketch aNotB(final Sketch skA, final Sketch skB) {
169+
public CompactSketch aNotB(final ThetaSketch skA, final ThetaSketch skB) {
170170
return aNotB(skA, skB, true, null);
171171
}
172172

@@ -175,8 +175,8 @@ public CompactSketch aNotB(final Sketch skA, final Sketch skB) {
175175
* CompactSketch.
176176
*
177177
* <p>This a stateless operation and has no impact on the internal state of this operator.
178-
* Thus, this is not an accumulating update and does not interact with the {@link #setA(Sketch)},
179-
* {@link #notB(Sketch)}, {@link #getResult(boolean)}, or
178+
* Thus, this is not an accumulating update and does not interact with the {@link #setA(ThetaSketch)},
179+
* {@link #notB(ThetaSketch)}, {@link #getResult(boolean)}, or
180180
* {@link #getResult(boolean, MemorySegment, boolean)} methods.</p>
181181
*
182182
* <p>If either argument is null an exception is thrown.</p>
@@ -197,7 +197,7 @@ public CompactSketch aNotB(final Sketch skA, final Sketch skB) {
197197
* @param dstSeg the destination MemorySegment
198198
* @return the result as a CompactSketch.
199199
*/
200-
public abstract CompactSketch aNotB(Sketch skA, Sketch skB, boolean dstOrdered,
200+
public abstract CompactSketch aNotB(ThetaSketch skA, ThetaSketch skB, boolean dstOrdered,
201201
MemorySegment dstSeg);
202202

203203
}

src/main/java/org/apache/datasketches/theta/AnotBimpl.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ private AnotBimpl(final short seedHash) {
6565
}
6666

6767
@Override
68-
public void setA(final Sketch skA) {
68+
public void setA(final ThetaSketch skA) {
6969
if (skA == null) {
7070
reset();
7171
throw new SketchesArgumentException("The input argument <i>A</i> must not be null");
@@ -85,7 +85,7 @@ public void setA(final Sketch skA) {
8585
}
8686

8787
@Override
88-
public void notB(final Sketch skB) {
88+
public void notB(final ThetaSketch skB) {
8989
if (empty_ || (skB == null) || skB.isEmpty()) { return; }
9090
//local and skB is not empty
9191
Util.checkSeedHashes(seedHash_, skB.getSeedHash());
@@ -113,7 +113,7 @@ public CompactSketch getResult(final boolean dstOrdered, final MemorySegment dst
113113
}
114114

115115
@Override
116-
public CompactSketch aNotB(final Sketch skA, final Sketch skB, final boolean dstOrdered,
116+
public CompactSketch aNotB(final ThetaSketch skA, final ThetaSketch skB, final boolean dstOrdered,
117117
final MemorySegment dstSeg) {
118118
if ((skA == null) || (skB == null)) {
119119
throw new SketchesArgumentException("Neither argument may be null");
@@ -152,7 +152,7 @@ int getRetainedEntries() {
152152

153153
//restricted
154154

155-
private static long[] getHashArrA(final Sketch skA) { //returns a new array
155+
private static long[] getHashArrA(final ThetaSketch skA) { //returns a new array
156156
//Get skA cache as array
157157
final CompactSketch cskA = skA.compact(false, null); //sorting not required
158158
return cskA.getCache().clone();
@@ -162,7 +162,7 @@ private static long[] getResultHashArr( //returns a new array
162162
final long minThetaLong,
163163
final int countA,
164164
final long[] hashArrA,
165-
final Sketch skB) {
165+
final ThetaSketch skB) {
166166

167167
// Rebuild or get hashtable of skB
168168
final long[] hashTableB; //read only
@@ -192,7 +192,7 @@ private static long[] getResultHashArr( //returns a new array
192192
}
193193

194194
private static long[] convertToHashTable(
195-
final Sketch sketch,
195+
final ThetaSketch sketch,
196196
final long thetaLong,
197197
final double rebuildThreshold) {
198198
final int lgArrLongs = minLgHashTableSize(sketch.getRetainedEntries(true), rebuildThreshold);

src/main/java/org/apache/datasketches/theta/CompactSketch.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
*
5959
* @author Lee Rhodes
6060
*/
61-
public abstract class CompactSketch extends Sketch {
61+
public abstract class CompactSketch extends ThetaSketch {
6262

6363
/**
6464
* Heapify takes a CompactSketch image in a MemorySegment and instantiates an on-heap CompactSketch.
@@ -303,7 +303,7 @@ public boolean isSameResource(final MemorySegment that) {
303303

304304
@Override
305305
public double getEstimate() {
306-
return Sketch.estimate(getThetaLong(), getRetainedEntries());
306+
return ThetaSketch.estimate(getThetaLong(), getRetainedEntries());
307307
}
308308

309309
/**
@@ -386,7 +386,7 @@ private byte[] toByteArrayV4() {
386386
}
387387

388388
private static CompactSketch heapifyV4(final MemorySegment srcSeg, final long seed) {
389-
final int preLongs = Sketch.getPreambleLongs(srcSeg);
389+
final int preLongs = ThetaSketch.getPreambleLongs(srcSeg);
390390
final int entryBits = extractEntryBitsV4(srcSeg);
391391
final int numEntriesBytes = extractNumEntriesBytesV4(srcSeg);
392392
final short seedHash = (short) extractSeedHash(srcSeg);

src/main/java/org/apache/datasketches/theta/ConcurrentBackgroundThetaPropagation.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ final class ConcurrentBackgroundThetaPropagation implements Runnable {
4040
private final AtomicBoolean localPropagationInProgress;
4141

4242
// Sketch to be propagated to shared sketch. Can be null if only a single hash is propagated
43-
private final Sketch sketchIn;
43+
private final ThetaSketch sketchIn;
4444

4545
// Hash of the datum to be propagated to shared sketch. Can be ConcurrentSharedThetaSketch.NOT_SINGLE_HASH
4646
// if the data is propagated through a sketch.
@@ -52,7 +52,7 @@ final class ConcurrentBackgroundThetaPropagation implements Runnable {
5252
private final long epoch;
5353

5454
ConcurrentBackgroundThetaPropagation(final ConcurrentSharedThetaSketch sharedThetaSketch,
55-
final AtomicBoolean localPropagationInProgress, final Sketch sketchIn, final long singleHash,
55+
final AtomicBoolean localPropagationInProgress, final ThetaSketch sketchIn, final long singleHash,
5656
final long epoch) {
5757
this.sharedThetaSketch = sharedThetaSketch;
5858
this.localPropagationInProgress = localPropagationInProgress;

src/main/java/org/apache/datasketches/theta/ConcurrentDirectQuickSelectSketch.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public void initBgPropagationService() {
207207

208208
@Override
209209
public boolean propagate(final AtomicBoolean localPropagationInProgress,
210-
final Sketch sketchIn, final long singleHash) {
210+
final ThetaSketch sketchIn, final long singleHash) {
211211
final long epoch = epoch_;
212212
if (singleHash != NOT_SINGLE_HASH // namely, is a single hash and
213213
&& getRetainedEntries(false) < exactLimit_) { // a small sketch then propagate myself (blocking)

src/main/java/org/apache/datasketches/theta/ConcurrentHeapQuickSelectSketch.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public void initBgPropagationService() {
199199

200200
@Override
201201
public boolean propagate(final AtomicBoolean localPropagationInProgress,
202-
final Sketch sketchIn, final long singleHash) {
202+
final ThetaSketch sketchIn, final long singleHash) {
203203
final long epoch = epoch_;
204204
if ((singleHash != NOT_SINGLE_HASH) //namely, is a single hash and
205205
&& (getRetainedEntries(false) < exactLimit_)) { //a small sketch then propagate myself (blocking)

src/main/java/org/apache/datasketches/theta/ConcurrentSharedThetaSketch.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static long computeExactLimit(final long k, final double error) {
8686
* @param singleHash a single hash value
8787
* @return true if propagation successfully started
8888
*/
89-
boolean propagate(final AtomicBoolean localPropagationInProgress, final Sketch sketchIn,
89+
boolean propagate(final AtomicBoolean localPropagationInProgress, final ThetaSketch sketchIn,
9090
final long singleHash);
9191

9292
/**

src/main/java/org/apache/datasketches/theta/DirectCompactCompressedSketch.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public CompactSketch compact(final boolean dstOrdered, final MemorySegment dstSe
7474

7575
@Override
7676
public int getCurrentBytes() {
77-
final int preLongs = Sketch.getPreambleLongs(seg_);
77+
final int preLongs = ThetaSketch.getPreambleLongs(seg_);
7878
final int entryBits = extractEntryBitsV4(seg_);
7979
final int numEntriesBytes = extractNumEntriesBytesV4(seg_);
8080
return preLongs * Long.BYTES + numEntriesBytes + wholeBytesToHoldBits(getRetainedEntries() * entryBits);
@@ -88,7 +88,7 @@ public int getRetainedEntries(final boolean valid) { //valid is only relevant fo
8888
// number of entries is stored using variable length encoding
8989
// most significant bytes with all zeros are not stored
9090
// one byte in the preamble has the number of non-zero bytes used
91-
final int preLongs = Sketch.getPreambleLongs(seg_); // if > 1 then the second long has theta
91+
final int preLongs = ThetaSketch.getPreambleLongs(seg_); // if > 1 then the second long has theta
9292
final int numEntriesBytes = extractNumEntriesBytesV4(seg_);
9393
int offsetBytes = preLongs > 1 ? START_PACKED_DATA_ESTIMATION_MODE : START_PACKED_DATA_EXACT_MODE;
9494
int numEntries = 0;
@@ -100,7 +100,7 @@ public int getRetainedEntries(final boolean valid) { //valid is only relevant fo
100100

101101
@Override
102102
public long getThetaLong() {
103-
final int preLongs = Sketch.getPreambleLongs(seg_);
103+
final int preLongs = ThetaSketch.getPreambleLongs(seg_);
104104
return (preLongs > 1) ? extractThetaLongV4(seg_) : Long.MAX_VALUE;
105105
}
106106

@@ -118,7 +118,7 @@ public boolean isOrdered() {
118118
public HashIterator iterator() {
119119
return new MemorySegmentCompactCompressedHashIterator(
120120
seg_,
121-
(Sketch.getPreambleLongs(seg_) > 1 ? START_PACKED_DATA_ESTIMATION_MODE : START_PACKED_DATA_EXACT_MODE)
121+
(ThetaSketch.getPreambleLongs(seg_) > 1 ? START_PACKED_DATA_ESTIMATION_MODE : START_PACKED_DATA_EXACT_MODE)
122122
+ extractNumEntriesBytesV4(seg_),
123123
extractEntryBitsV4(seg_),
124124
getRetainedEntries()

src/main/java/org/apache/datasketches/theta/DirectCompactSketch.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,21 @@ public CompactSketch compact(final boolean dstOrdered, final MemorySegment dstSe
8181
@Override
8282
public int getCurrentBytes() {
8383
if (checkForSingleItem(seg_)) { return 16; }
84-
final int preLongs = Sketch.getPreambleLongs(seg_);
84+
final int preLongs = ThetaSketch.getPreambleLongs(seg_);
8585
final int curCount = (preLongs == 1) ? 0 : extractCurCount(seg_);
8686
return (preLongs + curCount) << 3;
8787
}
8888

8989
@Override
9090
public int getRetainedEntries(final boolean valid) { //valid is only relevant for the Alpha Sketch
9191
if (checkForSingleItem(seg_)) { return 1; }
92-
final int preLongs = Sketch.getPreambleLongs(seg_);
92+
final int preLongs = ThetaSketch.getPreambleLongs(seg_);
9393
return (preLongs == 1) ? 0 : extractCurCount(seg_);
9494
}
9595

9696
@Override
9797
public long getThetaLong() {
98-
final int preLongs = Sketch.getPreambleLongs(seg_);
98+
final int preLongs = ThetaSketch.getPreambleLongs(seg_);
9999
return (preLongs > 2) ? extractThetaLong(seg_) : Long.MAX_VALUE;
100100
}
101101

@@ -147,7 +147,7 @@ public byte[] toByteArray() {
147147
@Override
148148
long[] getCache() {
149149
if (checkForSingleItem(seg_)) { return new long[] { seg_.get(JAVA_LONG_UNALIGNED, 8) }; }
150-
final int preLongs = Sketch.getPreambleLongs(seg_);
150+
final int preLongs = ThetaSketch.getPreambleLongs(seg_);
151151
final int curCount = (preLongs == 1) ? 0 : extractCurCount(seg_);
152152
if (curCount > 0) {
153153
final long[] cache = new long[curCount];
@@ -159,12 +159,12 @@ long[] getCache() {
159159

160160
@Override
161161
int getCompactPreambleLongs() {
162-
return Sketch.getPreambleLongs(seg_);
162+
return ThetaSketch.getPreambleLongs(seg_);
163163
}
164164

165165
@Override
166166
int getCurrentPreambleLongs() {
167-
return Sketch.getPreambleLongs(seg_);
167+
return ThetaSketch.getPreambleLongs(seg_);
168168
}
169169

170170
@Override

src/main/java/org/apache/datasketches/theta/DirectQuickSelectSketch.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ static DirectQuickSelectSketch writableWrap(
175175
final MemorySegment srcSeg,
176176
final MemorySegmentRequest mSegReq,
177177
final long seed) {
178-
final int preambleLongs = Sketch.getPreambleLongs(srcSeg); //byte 0
178+
final int preambleLongs = ThetaSketch.getPreambleLongs(srcSeg); //byte 0
179179
final int lgNomLongs = extractLgNomLongs(srcSeg); //byte 3
180180
final int lgArrLongs = extractLgArrLongs(srcSeg); //byte 4
181181

0 commit comments

Comments
 (0)