From 77ab955c266375ec90551857e5fbd8af894f50c6 Mon Sep 17 00:00:00 2001 From: Jon Bratseth Date: Tue, 24 Sep 2019 19:35:35 +0200 Subject: Nonfunctional changes only --- .../searchlib/aggregation/AggregationResult.java | 14 +++--- .../com/yahoo/searchlib/aggregation/FS4Hit.java | 5 ++- .../com/yahoo/searchlib/aggregation/Group.java | 52 +++++++++------------- .../java/com/yahoo/searchlib/aggregation/Hit.java | 3 +- .../aggregation/HitsAggregationResult.java | 10 ++--- .../searchlib/aggregation/GroupingTestCase.java | 1 + 6 files changed, 39 insertions(+), 46 deletions(-) (limited to 'searchlib/src') diff --git a/searchlib/src/main/java/com/yahoo/searchlib/aggregation/AggregationResult.java b/searchlib/src/main/java/com/yahoo/searchlib/aggregation/AggregationResult.java index 264a9d4d4e9..c3ad7cbe879 100644 --- a/searchlib/src/main/java/com/yahoo/searchlib/aggregation/AggregationResult.java +++ b/searchlib/src/main/java/com/yahoo/searchlib/aggregation/AggregationResult.java @@ -8,7 +8,7 @@ import com.yahoo.vespa.objects.ObjectVisitor; import com.yahoo.vespa.objects.Serializer; /** - *

This is the aggregation super-class from which all types of aggregation inherits.

+ * The result of some aggregation * * @author baldersheim * @author Simon Thoresen Hult @@ -20,7 +20,7 @@ public abstract class AggregationResult extends ExpressionNode { private int tag = -1; /** - *

Returns the tag of this aggregation result. This is useful for uniquely identifying a result.

+ * Returns the tag of this aggregation result. This is useful for uniquely identifying a result. * * @return The numerical tag. */ @@ -50,8 +50,8 @@ public abstract class AggregationResult extends ExpressionNode { } /** - *

This method is called when all aggregation results have been merged. This method can be overloaded by - * subclasses that need special behaviour to occur after merge.

+ * This method is called when all aggregation results have been merged. This method can be overloaded by + * subclasses that need special behaviour to occur after merge. */ public void postMerge() { // empty @@ -85,10 +85,10 @@ public abstract class AggregationResult extends ExpressionNode { } /** - *

This method must be implemented by subclasses to support merge. It is called as the {@link - * #merge(AggregationResult)} method is invoked.

+ * This method must be implemented by subclasses to support merge. It is called as the {@link + * #merge(AggregationResult)} method is invoked. * - * @param result The result to merge with. + * @param result the result to merge with */ protected abstract void onMerge(AggregationResult result); diff --git a/searchlib/src/main/java/com/yahoo/searchlib/aggregation/FS4Hit.java b/searchlib/src/main/java/com/yahoo/searchlib/aggregation/FS4Hit.java index 399ffd3128f..07de8bbdc55 100644 --- a/searchlib/src/main/java/com/yahoo/searchlib/aggregation/FS4Hit.java +++ b/searchlib/src/main/java/com/yahoo/searchlib/aggregation/FS4Hit.java @@ -7,7 +7,7 @@ import com.yahoo.vespa.objects.ObjectVisitor; import com.yahoo.vespa.objects.Serializer; /** - * This class represents a single hit from the fastserver4 backend + * A single hit from a Vespa content cluster * * @author havardpe */ @@ -103,7 +103,7 @@ public class FS4Hit extends Hit { return super.hashCode() + path + globalId.hashCode() + distributionKey; } - @SuppressWarnings({ "EqualsWhichDoesntCheckParameterClass", "RedundantIfStatement" }) + @SuppressWarnings("RedundantIfStatement") @Override public boolean equals(Object obj) { if (!super.equals(obj)) { @@ -129,4 +129,5 @@ public class FS4Hit extends Hit { visitor.visit("globalId", globalId.toString()); visitor.visit("distributionKey", distributionKey); } + } diff --git a/searchlib/src/main/java/com/yahoo/searchlib/aggregation/Group.java b/searchlib/src/main/java/com/yahoo/searchlib/aggregation/Group.java index 73171f4dd00..126bdd474a9 100644 --- a/searchlib/src/main/java/com/yahoo/searchlib/aggregation/Group.java +++ b/searchlib/src/main/java/com/yahoo/searchlib/aggregation/Group.java @@ -12,28 +12,28 @@ public class Group extends Identifiable { public static final int classId = registerClass(0x4000 + 90, Group.class); private static final ObjectPredicate REF_LOCATOR = new RefLocator(); - private List orderByIdx = new ArrayList(); - private List orderByExp = new ArrayList(); - private List aggregationResults = new ArrayList(); - private List children = new ArrayList(); + private List orderByIdx = new ArrayList<>(); + private List orderByExp = new ArrayList<>(); + private List aggregationResults = new ArrayList<>(); + private List children = new ArrayList<>(); private ResultNode id = null; private double rank; private int tag = -1; private SortType sortType = SortType.UNSORTED; /** - *

This tells you if the children are ranked by the pure relevance or by a more complex expression. That - * indicates if the rank score from the child can be used for ordering.

+ * This tells you if the children are ranked by the pure relevance or by a more complex expression. + * That indicates if the rank score from the child can be used for ordering. * - * @return True if it ranked by pure relevance. + * @return true if it ranked by pure relevance. */ public boolean isRankedByRelevance() { return orderByIdx.isEmpty(); } /** - *

Merges the content of the given group into this. When this function returns, make sure to call {@link - * #postMerge(java.util.List, int, int)}.

+ * Merges the content of the given group into this. When this function returns, make sure to call + * {@link #postMerge(java.util.List, int, int)}. * * @param firstLevel The first level to merge. * @param currentLevel The current level. @@ -49,7 +49,7 @@ public class Group extends Identifiable { } } - ArrayList merged = new ArrayList(); + ArrayList merged = new ArrayList<>(); Iterator lhsChild = children.iterator(), rhsChild = rhs.children.iterator(); if (lhsChild.hasNext() && rhsChild.hasNext()) { Group lhsGroup = lhsChild.next(); @@ -93,8 +93,8 @@ public class Group extends Identifiable { } /** - *

After merging, this method will prune all levels so that they do not exceed the configured maximum number of - * groups per level.

+ * After merging, this method will prune all levels so that they do not exceed the configured maximum number of + * groups per level. * * @param levels The specs of all grouping levels. * @param firstLevel The first level to merge. @@ -127,9 +127,7 @@ public class Group extends Identifiable { } - /** - *

Will sort the children by their id, if they are not sorted already.

- */ + /** Sorts the children by their id, if they are not sorted already. */ public void sortChildrenById() { if (sortType == SortType.BYID) { return; @@ -142,9 +140,7 @@ public class Group extends Identifiable { sortType = SortType.BYID; } - /** - *

Will sort the children by their rank, if they are not sorted already.

- */ + /** Sorts the children by their rank, if they are not sorted already. */ public void sortChildrenByRank() { if (sortType == SortType.BYRANK) { return; @@ -158,18 +154,16 @@ public class Group extends Identifiable { } /** - *

Returns the label to use for this group. See comment on {@link #setId(com.yahoo.searchlib.expression.ResultNode)} - * on the rationale of this being a {@link ResultNode}.

- * - * @return The label. + * Returns the label to use for this group. See comment on {@link #setId(com.yahoo.searchlib.expression.ResultNode)} + * on the rationale of this being a {@link ResultNode}. */ public ResultNode getId() { return id; } /** - *

Sets the label to use for this group. This is a {@link ResultNode} so that a group can be labeled with - * whatever value the classifier expression returns.

+ * Sets the label to use for this group. This is a {@link ResultNode} so that a group can be labeled with + * whatever value the classifier expression returns. * * @param id The label to set. * @return This, to allow chaining. @@ -180,7 +174,7 @@ public class Group extends Identifiable { } /** - *

Sets the relevancy to use for this group.

+ * Sets the relevancy to use for this group. * * @param rank The rank to set. * @return This, to allow chaining. @@ -190,17 +184,13 @@ public class Group extends Identifiable { return this; } - /** - *

Return the relevancy of this group.

- * - * @return Relevance. - */ + /** Return the rank score of this group. */ public double getRank() { return rank; } /** - *

Adds a child group to this.

+ * Adds a child group to this. * * @param child The group to add. * @return This, to allow chaining. diff --git a/searchlib/src/main/java/com/yahoo/searchlib/aggregation/Hit.java b/searchlib/src/main/java/com/yahoo/searchlib/aggregation/Hit.java index 6b2ce5c3b72..cbbecbdfa22 100644 --- a/searchlib/src/main/java/com/yahoo/searchlib/aggregation/Hit.java +++ b/searchlib/src/main/java/com/yahoo/searchlib/aggregation/Hit.java @@ -79,7 +79,7 @@ public abstract class Hit extends Identifiable { return super.hashCode() + (int)rank; } - @SuppressWarnings({ "RedundantIfStatement", "EqualsWhichDoesntCheckParameterClass" }) + @SuppressWarnings({ "RedundantIfStatement" }) @Override public boolean equals(Object obj) { if (!super.equals(obj)) { @@ -101,4 +101,5 @@ public abstract class Hit extends Identifiable { visitor.visit("rank", rank); visitor.visit("context", context); } + } diff --git a/searchlib/src/main/java/com/yahoo/searchlib/aggregation/HitsAggregationResult.java b/searchlib/src/main/java/com/yahoo/searchlib/aggregation/HitsAggregationResult.java index 275f38f7350..c7ecdbd798d 100644 --- a/searchlib/src/main/java/com/yahoo/searchlib/aggregation/HitsAggregationResult.java +++ b/searchlib/src/main/java/com/yahoo/searchlib/aggregation/HitsAggregationResult.java @@ -73,8 +73,8 @@ public class HitsAggregationResult extends AggregationResult { /** * Sets the summary class of hits to collect. * - * @param summaryClass The summary class to collect. - * @return This, to allow chaining. + * @param summaryClass the summary class to collect. + * @return this, to allow chaining. */ public HitsAggregationResult setSummaryClass(String summaryClass) { this.summaryClass = summaryClass; @@ -84,8 +84,8 @@ public class HitsAggregationResult extends AggregationResult { /** * Sets the maximum number of hits to collect. * - * @param maxHits The number of hits to collect. - * @return This, to allow chaining. + * @param maxHits the number of hits to collect. + * @return this, to allow chaining. */ public HitsAggregationResult setMaxHits(int maxHits) { this.maxHits = maxHits; @@ -102,7 +102,7 @@ public class HitsAggregationResult extends AggregationResult { } /** - * Add a hit to this aggregation result + * Adds a hit to this aggregation result * * @param h the hit * @return this object diff --git a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/GroupingTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/GroupingTestCase.java index fe5405ecb6a..ec379e5f8af 100644 --- a/searchlib/src/test/java/com/yahoo/searchlib/aggregation/GroupingTestCase.java +++ b/searchlib/src/test/java/com/yahoo/searchlib/aggregation/GroupingTestCase.java @@ -223,5 +223,6 @@ public class GroupingTestCase { Grouping other = (Grouping)Grouping.create(buf); assertEquals(grouping, other); } + } -- cgit v1.2.3