summaryrefslogtreecommitdiffstats
path: root/searchlib/src/main
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-04-07 21:45:14 +0200
committerJon Bratseth <bratseth@gmail.com>2022-04-07 21:45:14 +0200
commite764aaebe9139046da77557689b6eaa712719df0 (patch)
treeb529960a8e89a7b7243882272c7dccff147fc5fc /searchlib/src/main
parent2e2baaa12ad6f6ac784a1db310d58fc9fef6be68 (diff)
No functional changes
Diffstat (limited to 'searchlib/src/main')
-rw-r--r--searchlib/src/main/java/com/yahoo/searchlib/aggregation/CountAggregationResult.java17
-rw-r--r--searchlib/src/main/java/com/yahoo/searchlib/aggregation/ExpressionCountAggregationResult.java6
-rw-r--r--searchlib/src/main/java/com/yahoo/searchlib/aggregation/Grouping.java77
3 files changed, 40 insertions, 60 deletions
diff --git a/searchlib/src/main/java/com/yahoo/searchlib/aggregation/CountAggregationResult.java b/searchlib/src/main/java/com/yahoo/searchlib/aggregation/CountAggregationResult.java
index b1ee77318ff..479269a8bbd 100644
--- a/searchlib/src/main/java/com/yahoo/searchlib/aggregation/CountAggregationResult.java
+++ b/searchlib/src/main/java/com/yahoo/searchlib/aggregation/CountAggregationResult.java
@@ -18,9 +18,7 @@ public class CountAggregationResult extends AggregationResult {
public static final int classId = registerClass(0x4000 + 81, CountAggregationResult.class);
private long count = 0;
- /**
- * Constructs an empty result node. <b>NOTE:</b> This instance is broken until non-optional member data is set.
- */
+ /** Constructs an empty result node. <b>NOTE:</b> This instance is broken until non-optional member data is set. */
public CountAggregationResult() {
}
@@ -28,17 +26,13 @@ public class CountAggregationResult extends AggregationResult {
/**
* Constructs an instance of this class with given count value.
*
- * @param count The initial number of hits.
+ * @param count the initial number of hits
*/
public CountAggregationResult(long count) {
setCount(count);
}
- /**
- * Returns the number of aggregated hits.
- *
- * @return The count.
- */
+ /** Returns the number of aggregated hits. */
public final long getCount() {
return count;
}
@@ -46,8 +40,8 @@ public class CountAggregationResult extends AggregationResult {
/**
* Sets the number of aggregated hits.
*
- * @param count The count.
- * @return This, to allow chaining.
+ * @param count the count
+ * @return this, to allow chaining
*/
public final CountAggregationResult setCount(long count) {
this.count = count;
@@ -96,4 +90,5 @@ public class CountAggregationResult extends AggregationResult {
super.visitMembers(visitor);
visitor.visit("count", count);
}
+
}
diff --git a/searchlib/src/main/java/com/yahoo/searchlib/aggregation/ExpressionCountAggregationResult.java b/searchlib/src/main/java/com/yahoo/searchlib/aggregation/ExpressionCountAggregationResult.java
index 6f2a588acbc..4d45f5785b7 100644
--- a/searchlib/src/main/java/com/yahoo/searchlib/aggregation/ExpressionCountAggregationResult.java
+++ b/searchlib/src/main/java/com/yahoo/searchlib/aggregation/ExpressionCountAggregationResult.java
@@ -28,9 +28,7 @@ public class ExpressionCountAggregationResult extends AggregationResult {
private long estimatedUniqueCount = UNDEFINED;
- /**
- * Constructor used for deserialization. Will be instantiated with a default sketch.
- */
+ /** Constructor used for deserialization. Will be instantiated with a default sketch. */
@SuppressWarnings("UnusedDeclaration")
public ExpressionCountAggregationResult() {
this(new SparseSketch(), new HyperLogLogEstimator());
@@ -39,7 +37,7 @@ public class ExpressionCountAggregationResult extends AggregationResult {
/**
* Constructs an instance with a given sketch, sketch merger and unique count estimator. For test purposes.
*
- * @param initialSketch The HLL sketch.
+ * @param initialSketch the HLL sketch
*/
public ExpressionCountAggregationResult(Sketch<?> initialSketch, UniqueCountEstimator<Sketch<?>> estimator) {
this.sketch = initialSketch;
diff --git a/searchlib/src/main/java/com/yahoo/searchlib/aggregation/Grouping.java b/searchlib/src/main/java/com/yahoo/searchlib/aggregation/Grouping.java
index dcbedf924b4..b4032f7a415 100644
--- a/searchlib/src/main/java/com/yahoo/searchlib/aggregation/Grouping.java
+++ b/searchlib/src/main/java/com/yahoo/searchlib/aggregation/Grouping.java
@@ -4,10 +4,16 @@ package com.yahoo.searchlib.aggregation;
import com.yahoo.searchlib.expression.BucketResultNode;
import com.yahoo.searchlib.expression.NullResultNode;
import com.yahoo.searchlib.expression.ResultNode;
-import com.yahoo.vespa.objects.*;
+import com.yahoo.vespa.objects.Deserializer;
+import com.yahoo.vespa.objects.Identifiable;
+import com.yahoo.vespa.objects.ObjectOperation;
+import com.yahoo.vespa.objects.ObjectPredicate;
+import com.yahoo.vespa.objects.ObjectVisitor;
+import com.yahoo.vespa.objects.Serializer;
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
public class Grouping extends Identifiable {
@@ -53,21 +59,13 @@ public class Grouping extends Identifiable {
super();
}
- /**
- * Constructs an instance of this class with given client id.
- *
- * @param id the client id for this grouping request
- */
+ /** Constructs an instance of this class with given client id. */
public Grouping(int id) {
super();
setId(id);
}
- /**
- * Merges the content of the given grouping <b>into</b> this.
- *
- * @param rhs the grouping to merge with
- */
+ /** Merges the content of the given grouping <b>into</b> this. */
public void merge(Grouping rhs) {
root.merge(firstLevel, 0, rhs.root);
}
@@ -184,11 +182,10 @@ public class Grouping extends Identifiable {
*
* @param level the level to add
* @return this, to allow chaining
- * @throws NullPointerException If <code>level</code> argument is null.
+ * @throws NullPointerException ff <code>level</code> argument is null
*/
public Grouping addLevel(GroupingLevel level) {
- level.getClass(); // throws NullPointerException
- groupingLevels.add(level);
+ groupingLevels.add(Objects.requireNonNull(level));
return this;
}
@@ -202,49 +199,39 @@ public class Grouping extends Identifiable {
*
* @param root the group to set as root
* @return this, to allow chaining
- * @throws NullPointerException If <code>root</code> argument is null
+ * @throws NullPointerException if <code>root</code> argument is null
*/
public Grouping setRoot(Group root) {
- root.getClass(); // throws NullPointerException
- this.root = root;
+ this.root = Objects.requireNonNull(root);
return this;
}
- /**
- * <p>Returns whether or not single pass execution of grouping is forced.</p>
- *
- * @return True if single pass grouping is forced.
- */
+ /** Returns whether single pass execution of grouping is forced. */
public boolean getForceSinglePass() {
return forceSinglePass;
}
/**
- * <p>Sets whether or not grouping should be forced to execute in a single pass. If false, this <code>Grouping</code>
- * might still execute in a single pass due to other constraints.</p>
+ * Sets whether or not grouping should be forced to execute in a single pass.
+ * If false, this <code>Grouping</code>
+ * might still execute in a single pass due to other constraints.
*
- * @param forceSinglePass True to force execution in single pass.
- * @return This, to allow chaining.
+ * @param forceSinglePass true to force execution in single pass
+ * @return this, to allow chaining
*/
public Grouping setForceSinglePass(boolean forceSinglePass) {
this.forceSinglePass = forceSinglePass;
return this;
}
- /**
- * <p>Returns whether or not grouping should be executed in a single pass.</p>
- *
- * @return True if grouping should be executed in a single pass.
- */
+ /** Returns whether grouping should be executed in a single pass. */
public boolean useSinglePass() {
return needDeepResultCollection() || getForceSinglePass();
}
/**
- * <p>Tell if ordering will need results collected in children. in that case we will probably just do a single
- * pass.</p>
- *
- * @return If deeper resultcollection is needed.
+ * Returns whether ordering will need results collected in children.
+ * In that case we will probably just do a single pass.
*/
public boolean needDeepResultCollection() {
if (forceSinglePass) {
@@ -389,20 +376,19 @@ public class Grouping extends Identifiable {
}
/**
- * <p>This is a helper function to perform recursive traversal of all groups contained in this grouping object. It
+ * This is a helper function to perform recursive traversal of all groups contained in this grouping object. It
* is invoked by the {@link #selectMembers(ObjectPredicate, ObjectOperation)} method and itself. This method will
- * only evaluate the groups that belong to active levels.</p>
+ * only evaluate the groups that belong to active levels.
*
- * @param predicate The object predicate to evaluate.
- * @param operation The operation to execute when the predicate is true.
- * @param group The group to evaluate.
- * @param first The first active level.
- * @param last The last active level.
- * @param current The level being evaluated.
+ * @param predicate the object predicate to evaluate
+ * @param operation the operation to execute when the predicate is true
+ * @param group the group to evaluate
+ * @param first the first active level
+ * @param last the last active level
+ * @param current the level being evaluated
*/
private static void selectGroups(ObjectPredicate predicate, ObjectOperation operation,
- Group group, int first, int last, int current)
- {
+ Group group, int first, int last, int current) {
if (current > last) {
return;
}
@@ -413,4 +399,5 @@ public class Grouping extends Identifiable {
selectGroups(predicate, operation, child, first, last, current + 1);
}
}
+
}