in src/main/java/org/apache/datasketches/tuple/AnotB.java [145:196]
public void notB(final Sketch<S> skB) {
if (skB == null) { return; } //ignore
final long thetaLongB = skB.getThetaLong();
final int countB = skB.getRetainedEntries();
final boolean emptyB = skB.isEmpty();
final int id =
SetOperationCornerCases.createCornerCaseId(thetaLong_, curCount_, empty_, thetaLongB, countB, emptyB);
final CornerCase cCase = CornerCase.caseIdToCornerCase(id);
final AnotbAction anotbAction = cCase.getAnotbAction();
switch (anotbAction) {
case EMPTY_1_0_T: {
reset();
break;
}
case DEGEN_MIN_0_F: {
reset();
thetaLong_ = min(thetaLong_, thetaLongB);
empty_ = false;
break;
}
case DEGEN_THA_0_F: {
empty_ = false;
curCount_ = 0;
//thetaLong_ is ok
break;
}
case TRIM_A: {
thetaLong_ = min(thetaLong_, thetaLongB);
final DataArrays<S> da = trimAndCopyDataArrays(hashArr_, summaryArr_, thetaLong_, true);
hashArr_ = da.hashArr;
curCount_ = (hashArr_ == null) ? 0 : hashArr_.length;
summaryArr_ = da.summaryArr;
//empty_ = is whatever SkA is,
break;
}
case SKETCH_A: {
break; //result is already in A
}
case FULL_ANOTB: { //both A and B should have valid entries.
thetaLong_ = min(thetaLong_, thetaLongB);
final DataArrays<S> daR = getCopyOfResultArraysTuple(thetaLong_, curCount_, hashArr_, summaryArr_, skB);
hashArr_ = daR.hashArr;
curCount_ = (hashArr_ == null) ? 0 : hashArr_.length;
summaryArr_ = daR.summaryArr;
//empty_ = is whatever SkA is,
}
//default: not possible
}
}