Backport: Refactor aggregation base classes to remove doEquals() and doHashCode() (#43363)

This PR is a backport a of #43214 from v8.0.0

A number of the aggregation base classes have an abstract doEquals() and doHashCode() (e.g. InternalAggregation.java, AbstractPipelineAggregationBuilder.java).

Theoretically this is so the sub-classes can add to the equals/hashCode and don't need to worry about calling super.equals(). In practice, it's mostly just confusing/inconsistent. And if there are more than two levels, we end up with situations like InternalMappedSignificantTerms which has to call super.doEquals() which defeats the point of having these overridable methods.

This PR removes the do versions and just use equals/hashCode ensuring the super when necessary.
This commit is contained in:
Christos Soulios 2019-06-19 22:31:06 +03:00 committed by GitHub
parent be42b2c70c
commit d1637ca476
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
106 changed files with 652 additions and 694 deletions

View File

@ -256,12 +256,16 @@ public class InternalMatrixStats extends InternalAggregation implements MatrixSt
}
@Override
protected int doHashCode() {
return Objects.hash(stats, results);
public int hashCode() {
return Objects.hash(super.hashCode(), stats, results);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalMatrixStats other = (InternalMatrixStats) obj;
return Objects.equals(this.stats, other.stats) &&
Objects.equals(this.results, other.results);

View File

@ -91,16 +91,6 @@ public class MatrixStatsAggregationBuilder
return builder;
}
@Override
protected int innerHashCode() {
return 0;
}
@Override
protected boolean innerEquals(Object obj) {
return true;
}
@Override
public String getType() {
return NAME;

View File

@ -354,30 +354,21 @@ public abstract class ArrayValuesSourceAggregationBuilder<VS extends ValuesSourc
protected abstract XContentBuilder doXContentBody(XContentBuilder builder, Params params) throws IOException;
@Override
protected final int doHashCode() {
return Objects.hash(fields, format, missing, targetValueType, valueType, valuesSourceType,
innerHashCode());
public int hashCode() {
return Objects.hash(super.hashCode(), fields, format, missing, targetValueType, valueType, valuesSourceType);
}
protected abstract int innerHashCode();
@Override
protected final boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
ArrayValuesSourceAggregationBuilder<?, ?> other = (ArrayValuesSourceAggregationBuilder<?, ?>) obj;
if (!Objects.equals(fields, other.fields))
return false;
if (!Objects.equals(format, other.format))
return false;
if (!Objects.equals(missing, other.missing))
return false;
if (!Objects.equals(targetValueType, other.targetValueType))
return false;
if (!Objects.equals(valueType, other.valueType))
return false;
if (!Objects.equals(valuesSourceType, other.valuesSourceType))
return false;
return innerEquals(obj);
return Objects.equals(fields, other.fields)
&& Objects.equals(format, other.format)
&& Objects.equals(missing, other.missing)
&& Objects.equals(targetValueType, other.targetValueType)
&& Objects.equals(valueType, other.valueType)
&& Objects.equals(valuesSourceType, other.valuesSourceType);
}
protected abstract boolean innerEquals(Object obj);
}

View File

@ -159,12 +159,15 @@ public class ChildrenAggregationBuilder
}
@Override
protected int innerHashCode() {
return Objects.hash(childType);
public int hashCode() {
return Objects.hash(super.hashCode(), childType);
}
@Override
protected boolean innerEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
ChildrenAggregationBuilder other = (ChildrenAggregationBuilder) obj;
return Objects.equals(childType, other.childType);
}

View File

@ -159,12 +159,15 @@ public class ParentAggregationBuilder
}
@Override
protected int innerHashCode() {
return Objects.hash(childType);
public int hashCode() {
return Objects.hash(super.hashCode(), childType);
}
@Override
protected boolean innerEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
ParentAggregationBuilder other = (ParentAggregationBuilder) obj;
return Objects.equals(childType, other.childType);
}

View File

@ -164,28 +164,17 @@ public abstract class AbstractAggregationBuilder<AB extends AbstractAggregationB
@Override
public int hashCode() {
return Objects.hash(factoriesBuilder, metaData, name, doHashCode());
return Objects.hash(factoriesBuilder, metaData, name);
}
protected abstract int doHashCode();
@Override
public boolean equals(Object obj) {
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
@SuppressWarnings("unchecked")
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
AbstractAggregationBuilder<AB> other = (AbstractAggregationBuilder<AB>) obj;
if (!Objects.equals(name, other.name))
return false;
if (!Objects.equals(metaData, other.metaData))
return false;
if (!Objects.equals(factoriesBuilder, other.factoriesBuilder))
return false;
return doEquals(obj);
return Objects.equals(name, other.name)
&& Objects.equals(metaData, other.metaData)
&& Objects.equals(factoriesBuilder, other.factoriesBuilder);
}
protected abstract boolean doEquals(Object obj);
}

View File

@ -218,40 +218,22 @@ public abstract class InternalAggregation implements Aggregation, NamedWriteable
@Override
public int hashCode() {
return Objects.hash(name, metaData, pipelineAggregators, doHashCode());
return Objects.hash(name, metaData, pipelineAggregators);
}
/**
* Opportunity for subclasses to the {@link #hashCode()} for this
* class.
**/
protected abstract int doHashCode();
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (obj.getClass() != getClass()) {
if (obj == null || getClass() != obj.getClass()) {
return false;
}
if (obj == this) { return true; }
InternalAggregation other = (InternalAggregation) obj;
return Objects.equals(name, other.name) &&
Objects.equals(pipelineAggregators, other.pipelineAggregators) &&
Objects.equals(metaData, other.metaData) &&
doEquals(obj);
Objects.equals(metaData, other.metaData);
}
/**
* Opportunity for subclasses to add criteria to the {@link #equals(Object)}
* method for this class.
*
* This method can safely cast <code>obj</code> to the subclass since the
* {@link #equals(Object)} method checks that <code>obj</code> is the same
* class as <code>this</code>
*/
protected abstract boolean doEquals(Object obj);
@Override
public String toString() {
return Strings.toString(this);

View File

@ -137,14 +137,18 @@ public abstract class InternalSingleBucketAggregation extends InternalAggregatio
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalSingleBucketAggregation other = (InternalSingleBucketAggregation) obj;
return Objects.equals(docCount, other.docCount) &&
Objects.equals(aggregations, other.aggregations);
}
@Override
protected int doHashCode() {
return Objects.hash(docCount, aggregations);
public int hashCode() {
return Objects.hash(super.hashCode(), docCount, aggregations);
}
}

View File

@ -230,12 +230,15 @@ public class AdjacencyMatrixAggregationBuilder extends AbstractAggregationBuilde
}
@Override
protected int doHashCode() {
return Objects.hash(filters, separator);
public int hashCode() {
return Objects.hash(super.hashCode(), filters, separator);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
AdjacencyMatrixAggregationBuilder other = (AdjacencyMatrixAggregationBuilder) obj;
return Objects.equals(filters, other.filters) && Objects.equals(separator, other.separator);
}

View File

@ -239,12 +239,16 @@ public class InternalAdjacencyMatrix
}
@Override
protected int doHashCode() {
return Objects.hash(buckets);
public int hashCode() {
return Objects.hash(super.hashCode(), buckets);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalAdjacencyMatrix that = (InternalAdjacencyMatrix) obj;
return Objects.equals(buckets, that.buckets);
}

View File

@ -256,12 +256,15 @@ public class CompositeAggregationBuilder extends AbstractAggregationBuilder<Comp
}
@Override
protected int doHashCode() {
return Objects.hash(sources, size, after);
public int hashCode() {
return Objects.hash(super.hashCode(), sources, size, after);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
CompositeAggregationBuilder other = (CompositeAggregationBuilder) obj;
return size == other.size &&
Objects.equals(sources, other.sources) &&

View File

@ -138,12 +138,10 @@ public abstract class CompositeValuesSourceBuilder<AB extends CompositeValuesSou
}
@Override
public final int hashCode() {
return Objects.hash(field, missingBucket, script, valueType, order, format, innerHashCode());
public int hashCode() {
return Objects.hash(field, missingBucket, script, valueType, order, format);
}
protected abstract int innerHashCode();
@Override
public boolean equals(Object o) {
if (this == o) return true;
@ -156,12 +154,9 @@ public abstract class CompositeValuesSourceBuilder<AB extends CompositeValuesSou
Objects.equals(valueType, that.valueType()) &&
Objects.equals(missingBucket, that.missingBucket()) &&
Objects.equals(order, that.order()) &&
Objects.equals(format, that.format()) &&
innerEquals(that);
Objects.equals(format, that.format());
}
protected abstract boolean innerEquals(AB builder);
public String name() {
return name;
}

View File

@ -97,12 +97,16 @@ public class DateHistogramValuesSourceBuilder
}
@Override
protected int innerHashCode() {
return Objects.hash(dateHistogramInterval, timeZone);
public int hashCode() {
return Objects.hash(super.hashCode(), dateHistogramInterval, timeZone);
}
@Override
protected boolean innerEquals(DateHistogramValuesSourceBuilder other) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
DateHistogramValuesSourceBuilder other = (DateHistogramValuesSourceBuilder) obj;
return Objects.equals(dateHistogramInterval, other.dateHistogramInterval)
&& Objects.equals(timeZone, other.timeZone);
}

View File

@ -73,12 +73,16 @@ public class HistogramValuesSourceBuilder extends CompositeValuesSourceBuilder<H
}
@Override
protected int innerHashCode() {
return Objects.hash(interval);
public int hashCode() {
return Objects.hash(super.hashCode(), interval);
}
@Override
protected boolean innerEquals(HistogramValuesSourceBuilder other) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
HistogramValuesSourceBuilder other = (HistogramValuesSourceBuilder) obj;
return Objects.equals(interval, other.interval);
}

View File

@ -195,7 +195,11 @@ public class InternalComposite
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalComposite that = (InternalComposite) obj;
return Objects.equals(size, that.size) &&
Objects.equals(buckets, that.buckets) &&
@ -204,8 +208,8 @@ public class InternalComposite
}
@Override
protected int doHashCode() {
return Objects.hash(size, buckets, afterKey, Arrays.hashCode(reverseMuls));
public int hashCode() {
return Objects.hash(super.hashCode(), size, buckets, afterKey, Arrays.hashCode(reverseMuls));
}
private static class BucketIterator implements Comparable<BucketIterator> {

View File

@ -64,16 +64,6 @@ public class TermsValuesSourceBuilder extends CompositeValuesSourceBuilder<Terms
@Override
protected void doXContentBody(XContentBuilder builder, Params params) throws IOException {}
@Override
protected int innerHashCode() {
return 0;
}
@Override
protected boolean innerEquals(TermsValuesSourceBuilder builder) {
return true;
}
@Override
public String type() {
return TYPE;

View File

@ -112,12 +112,15 @@ public class FilterAggregationBuilder extends AbstractAggregationBuilder<FilterA
}
@Override
protected int doHashCode() {
return Objects.hash(filter);
public int hashCode() {
return Objects.hash(super.hashCode(), filter);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
FilterAggregationBuilder other = (FilterAggregationBuilder) obj;
return Objects.equals(filter, other.filter);
}

View File

@ -331,12 +331,15 @@ public class FiltersAggregationBuilder extends AbstractAggregationBuilder<Filter
}
@Override
protected int doHashCode() {
return Objects.hash(filters, keyed, otherBucket, otherBucketKey);
public int hashCode() {
return Objects.hash(super.hashCode(), filters, keyed, otherBucket, otherBucketKey);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
FiltersAggregationBuilder other = (FiltersAggregationBuilder) obj;
return Objects.equals(filters, other.filters)
&& Objects.equals(keyed, other.keyed)

View File

@ -251,12 +251,16 @@ public class InternalFilters extends InternalMultiBucketAggregation<InternalFilt
}
@Override
protected int doHashCode() {
return Objects.hash(buckets, keyed);
public int hashCode() {
return Objects.hash(super.hashCode(), buckets, keyed);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalFilters that = (InternalFilters) obj;
return Objects.equals(buckets, that.buckets)
&& Objects.equals(keyed, that.keyed);

View File

@ -180,22 +180,18 @@ public abstract class GeoGridAggregationBuilder extends ValuesSourceAggregationB
}
@Override
protected boolean innerEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
GeoGridAggregationBuilder other = (GeoGridAggregationBuilder) obj;
if (precision != other.precision) {
return false;
}
if (requiredSize != other.requiredSize) {
return false;
}
if (shardSize != other.shardSize) {
return false;
}
return true;
return precision == other.precision
&& requiredSize == other.requiredSize
&& shardSize == other.shardSize;
}
@Override
protected int innerHashCode() {
return Objects.hash(precision, requiredSize, shardSize);
public int hashCode() {
return Objects.hash(super.hashCode(), precision, requiredSize, shardSize);
}
}

View File

@ -133,15 +133,19 @@ public abstract class InternalGeoGrid<B extends InternalGeoGridBucket>
}
@Override
protected int doHashCode() {
return Objects.hash(requiredSize, buckets);
public int hashCode() {
return Objects.hash(super.hashCode(), requiredSize, buckets);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalGeoGrid other = (InternalGeoGrid) obj;
return Objects.equals(requiredSize, other.requiredSize) &&
Objects.equals(buckets, other.buckets);
return Objects.equals(requiredSize, other.requiredSize)
&& Objects.equals(buckets, other.buckets);
}
}

View File

@ -78,16 +78,6 @@ public class GlobalAggregationBuilder extends AbstractAggregationBuilder<GlobalA
return new GlobalAggregationBuilder(aggregationName);
}
@Override
protected boolean doEquals(Object obj) {
return true;
}
@Override
protected int doHashCode() {
return 0;
}
@Override
public String getType() {
return NAME;

View File

@ -221,12 +221,15 @@ public class AutoDateHistogramAggregationBuilder
}
@Override
protected int innerHashCode() {
return Objects.hash(numBuckets, minimumIntervalExpression);
public int hashCode() {
return Objects.hash(super.hashCode(), numBuckets, minimumIntervalExpression);
}
@Override
protected boolean innerEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
AutoDateHistogramAggregationBuilder other = (AutoDateHistogramAggregationBuilder) obj;
return Objects.equals(numBuckets, other.numBuckets) && Objects.equals(minimumIntervalExpression, other.minimumIntervalExpression);
}

View File

@ -506,12 +506,15 @@ public class DateHistogramAggregationBuilder extends ValuesSourceAggregationBuil
}
@Override
protected int innerHashCode() {
return Objects.hash(order, keyed, minDocCount, dateHistogramInterval, minDocCount, extendedBounds);
public int hashCode() {
return Objects.hash(super.hashCode(), order, keyed, minDocCount, dateHistogramInterval, minDocCount, extendedBounds);
}
@Override
protected boolean innerEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
DateHistogramAggregationBuilder other = (DateHistogramAggregationBuilder) obj;
return Objects.equals(order, other.order)
&& Objects.equals(keyed, other.keyed)

View File

@ -302,19 +302,22 @@ public class HistogramAggregationBuilder extends ValuesSourceAggregationBuilder<
}
@Override
protected int innerHashCode() {
return Objects.hash(order, keyed, minDocCount, interval, offset, minBound, maxBound);
public int hashCode() {
return Objects.hash(super.hashCode(), order, keyed, minDocCount, interval, offset, minBound, maxBound);
}
@Override
protected boolean innerEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
HistogramAggregationBuilder other = (HistogramAggregationBuilder) obj;
return Objects.equals(order, other.order)
&& Objects.equals(keyed, other.keyed)
&& Objects.equals(minDocCount, other.minDocCount)
&& Objects.equals(interval, other.interval)
&& Objects.equals(offset, other.offset)
&& Objects.equals(minBound, other.minBound)
&& Objects.equals(maxBound, other.maxBound);
&& Objects.equals(keyed, other.keyed)
&& Objects.equals(minDocCount, other.minDocCount)
&& Objects.equals(interval, other.interval)
&& Objects.equals(offset, other.offset)
&& Objects.equals(minBound, other.minBound)
&& Objects.equals(maxBound, other.maxBound);
}
}

View File

@ -598,7 +598,11 @@ public final class InternalAutoDateHistogram extends
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalAutoDateHistogram that = (InternalAutoDateHistogram) obj;
return Objects.equals(buckets, that.buckets)
&& Objects.equals(format, that.format)
@ -606,7 +610,7 @@ public final class InternalAutoDateHistogram extends
}
@Override
protected int doHashCode() {
return Objects.hash(buckets, format, bucketInfo);
public int hashCode() {
return Objects.hash(super.hashCode(), buckets, format, bucketInfo);
}
}

View File

@ -512,7 +512,11 @@ public final class InternalDateHistogram extends InternalMultiBucketAggregation<
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalDateHistogram that = (InternalDateHistogram) obj;
return Objects.equals(buckets, that.buckets)
&& Objects.equals(order, that.order)
@ -524,7 +528,7 @@ public final class InternalDateHistogram extends InternalMultiBucketAggregation<
}
@Override
protected int doHashCode() {
return Objects.hash(buckets, order, format, keyed, minDocCount, offset, emptyBucketInfo);
public int hashCode() {
return Objects.hash(super.hashCode(), buckets, order, format, keyed, minDocCount, offset, emptyBucketInfo);
}
}

View File

@ -489,7 +489,11 @@ public final class InternalHistogram extends InternalMultiBucketAggregation<Inte
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalHistogram that = (InternalHistogram) obj;
return Objects.equals(buckets, that.buckets)
&& Objects.equals(emptyBucketInfo, that.emptyBucketInfo)
@ -500,7 +504,7 @@ public final class InternalHistogram extends InternalMultiBucketAggregation<Inte
}
@Override
protected int doHashCode() {
return Objects.hash(buckets, emptyBucketInfo, format, keyed, minDocCount, order);
public int hashCode() {
return Objects.hash(super.hashCode(), buckets, emptyBucketInfo, format, keyed, minDocCount, order);
}
}

View File

@ -92,17 +92,7 @@ public class MissingAggregationBuilder extends ValuesSourceAggregationBuilder<Va
public XContentBuilder doXContentBody(XContentBuilder builder, Params params) throws IOException {
return builder;
}
@Override
protected int innerHashCode() {
return 0;
}
@Override
protected boolean innerEquals(Object obj) {
return true;
}
@Override
public String getType() {
return NAME;

View File

@ -143,14 +143,16 @@ public class NestedAggregationBuilder extends AbstractAggregationBuilder<NestedA
return new NestedAggregationBuilder(aggregationName, path);
}
@Override
protected int doHashCode() {
return Objects.hash(path);
public int hashCode() {
return Objects.hash(super.hashCode(), path);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
NestedAggregationBuilder other = (NestedAggregationBuilder) obj;
return Objects.equals(path, other.path);
}

View File

@ -168,14 +168,16 @@ public class ReverseNestedAggregationBuilder extends AbstractAggregationBuilder<
return factory;
}
@Override
protected int doHashCode() {
return Objects.hash(path);
public int hashCode() {
return Objects.hash(super.hashCode(), path);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
ReverseNestedAggregationBuilder other = (ReverseNestedAggregationBuilder) obj;
return Objects.equals(path, other.path);
}

View File

@ -140,12 +140,15 @@ public abstract class AbstractRangeBuilder<AB extends AbstractRangeBuilder<AB, R
}
@Override
protected int innerHashCode() {
return Objects.hash(ranges, keyed);
public int hashCode() {
return Objects.hash(super.hashCode(), ranges, keyed);
}
@Override
protected boolean innerEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
AbstractRangeBuilder<AB, R> other = (AbstractRangeBuilder<AB, R>) obj;
return Objects.equals(ranges, other.ranges)
&& Objects.equals(keyed, other.keyed);

View File

@ -433,12 +433,15 @@ public class GeoDistanceAggregationBuilder extends ValuesSourceAggregationBuilde
}
@Override
protected int innerHashCode() {
return Objects.hash(origin, ranges, keyed, distanceType, unit);
public int hashCode() {
return Objects.hash(super.hashCode(), origin, ranges, keyed, distanceType, unit);
}
@Override
protected boolean innerEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
GeoDistanceAggregationBuilder other = (GeoDistanceAggregationBuilder) obj;
return Objects.equals(origin, other.origin)
&& Objects.equals(ranges, other.ranges)

View File

@ -283,16 +283,20 @@ public final class InternalBinaryRange
return builder;
}
@Override
public boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalBinaryRange that = (InternalBinaryRange) obj;
return Objects.equals(buckets, that.buckets)
&& Objects.equals(format, that.format)
&& Objects.equals(keyed, that.keyed);
}
@Override
public int doHashCode() {
return Objects.hash(buckets, format, keyed);
public int hashCode() {
return Objects.hash(super.hashCode(), buckets, format, keyed);
}
}

View File

@ -345,12 +345,16 @@ public class InternalRange<B extends InternalRange.Bucket, R extends InternalRan
}
@Override
protected int doHashCode() {
return Objects.hash(ranges, format, keyed);
public int hashCode() {
return Objects.hash(super.hashCode(), ranges, format, keyed);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalRange<?,?> that = (InternalRange<?,?>) obj;
return Objects.equals(ranges, that.ranges)
&& Objects.equals(format, that.format)

View File

@ -387,14 +387,17 @@ public final class IpRangeAggregationBuilder
}
@Override
protected int innerHashCode() {
return Objects.hash(keyed, ranges);
public int hashCode() {
return Objects.hash(super.hashCode(), keyed, ranges);
}
@Override
protected boolean innerEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
IpRangeAggregationBuilder that = (IpRangeAggregationBuilder) obj;
return keyed == that.keyed
&& ranges.equals(that.ranges);
&& ranges.equals(that.ranges);
}
}

View File

@ -165,16 +165,19 @@ public class DiversifiedAggregationBuilder extends ValuesSourceAggregationBuilde
}
@Override
protected int innerHashCode() {
return Objects.hash(shardSize, maxDocsPerValue, executionHint);
public int hashCode() {
return Objects.hash(super.hashCode(), shardSize, maxDocsPerValue, executionHint);
}
@Override
protected boolean innerEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
DiversifiedAggregationBuilder other = (DiversifiedAggregationBuilder) obj;
return Objects.equals(shardSize, other.shardSize)
&& Objects.equals(maxDocsPerValue, other.maxDocsPerValue)
&& Objects.equals(executionHint, other.executionHint);
&& Objects.equals(maxDocsPerValue, other.maxDocsPerValue)
&& Objects.equals(executionHint, other.executionHint);
}
@Override

View File

@ -126,12 +126,15 @@ public class SamplerAggregationBuilder extends AbstractAggregationBuilder<Sample
}
@Override
protected int doHashCode() {
return Objects.hash(shardSize);
public int hashCode() {
return Objects.hash(super.hashCode(), shardSize);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
SamplerAggregationBuilder other = (SamplerAggregationBuilder) obj;
return Objects.equals(shardSize, other.shardSize);
}

View File

@ -109,10 +109,13 @@ public abstract class InternalMappedSignificantTerms<
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalMappedSignificantTerms<?, ?> that = (InternalMappedSignificantTerms<?, ?>) obj;
return super.doEquals(obj)
&& Objects.equals(format, that.format)
return Objects.equals(format, that.format)
&& subsetSize == that.subsetSize
&& supersetSize == that.supersetSize
&& Objects.equals(significanceHeuristic, that.significanceHeuristic)
@ -121,8 +124,8 @@ public abstract class InternalMappedSignificantTerms<
}
@Override
protected int doHashCode() {
return Objects.hash(super.doHashCode(), format, subsetSize, supersetSize, significanceHeuristic, buckets, bucketMap);
public int hashCode() {
return Objects.hash(super.hashCode(), format, subsetSize, supersetSize, significanceHeuristic, buckets, bucketMap);
}
@Override

View File

@ -272,12 +272,16 @@ public abstract class InternalSignificantTerms<A extends InternalSignificantTerm
protected abstract SignificanceHeuristic getSignificanceHeuristic();
@Override
protected int doHashCode() {
return Objects.hash(minDocCount, requiredSize);
public int hashCode() {
return Objects.hash(super.hashCode(), minDocCount, requiredSize);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalSignificantTerms<?, ?> that = (InternalSignificantTerms<?, ?>) obj;
return Objects.equals(minDocCount, that.minDocCount)
&& Objects.equals(requiredSize, that.requiredSize);

View File

@ -103,6 +103,10 @@ public class SignificantStringTerms extends InternalMappedSignificantTerms<Signi
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
return super.equals(obj) && Objects.equals(termBytes, ((SignificantStringTerms.Bucket) obj).termBytes);
}

View File

@ -307,12 +307,15 @@ public class SignificantTermsAggregationBuilder extends ValuesSourceAggregationB
}
@Override
protected int innerHashCode() {
return Objects.hash(bucketCountThresholds, executionHint, filterBuilder, includeExclude, significanceHeuristic);
public int hashCode() {
return Objects.hash(super.hashCode(), bucketCountThresholds, executionHint, filterBuilder, includeExclude, significanceHeuristic);
}
@Override
protected boolean innerEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
SignificantTermsAggregationBuilder other = (SignificantTermsAggregationBuilder) obj;
return Objects.equals(bucketCountThresholds, other.bucketCountThresholds)
&& Objects.equals(executionHint, other.executionHint)

View File

@ -378,13 +378,17 @@ public class SignificantTextAggregationBuilder extends AbstractAggregationBuilde
}
@Override
protected int doHashCode() {
return Objects.hash(bucketCountThresholds, fieldName, filterDuplicateText, filterBuilder,
includeExclude, significanceHeuristic, Arrays.hashCode(sourceFieldNames));
public int hashCode() {
return Objects.hash(super.hashCode(), bucketCountThresholds, fieldName,
filterDuplicateText, filterBuilder,
includeExclude, significanceHeuristic, Arrays.hashCode(sourceFieldNames));
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
SignificantTextAggregationBuilder other = (SignificantTextAggregationBuilder) obj;
return Objects.equals(bucketCountThresholds, other.bucketCountThresholds)
&& Objects.equals(fieldName, other.fieldName)

View File

@ -115,10 +115,13 @@ public abstract class InternalMappedTerms<A extends InternalTerms<A, B>, B exten
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalMappedTerms<?,?> that = (InternalMappedTerms<?,?>) obj;
return super.doEquals(obj)
&& Objects.equals(buckets, that.buckets)
return Objects.equals(buckets, that.buckets)
&& Objects.equals(format, that.format)
&& Objects.equals(otherDocCount, that.otherDocCount)
&& Objects.equals(showTermDocCountError, that.showTermDocCountError)
@ -127,8 +130,8 @@ public abstract class InternalMappedTerms<A extends InternalTerms<A, B>, B exten
}
@Override
protected int doHashCode() {
return Objects.hash(super.doHashCode(), buckets, format, otherDocCount, showTermDocCountError, shardSize);
public int hashCode() {
return Objects.hash(super.hashCode(), buckets, format, otherDocCount, showTermDocCountError, shardSize);
}
@Override

View File

@ -326,7 +326,11 @@ public abstract class InternalTerms<A extends InternalTerms<A, B>, B extends Int
protected abstract B[] createBucketsArray(int size);
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalTerms<?,?> that = (InternalTerms<?,?>) obj;
return Objects.equals(minDocCount, that.minDocCount)
&& Objects.equals(order, that.order)
@ -334,8 +338,8 @@ public abstract class InternalTerms<A extends InternalTerms<A, B>, B extends Int
}
@Override
protected int doHashCode() {
return Objects.hash(minDocCount, order, requiredSize);
public int hashCode() {
return Objects.hash(super.hashCode(), minDocCount, order, requiredSize);
}
protected static XContentBuilder doXContentCommon(XContentBuilder builder, Params params,

View File

@ -358,19 +358,23 @@ public class TermsAggregationBuilder extends ValuesSourceAggregationBuilder<Valu
}
@Override
protected int innerHashCode() {
return Objects.hash(bucketCountThresholds, collectMode, executionHint, includeExclude, order, showTermDocCountError);
public int hashCode() {
return Objects.hash(super.hashCode(), bucketCountThresholds, collectMode,
executionHint, includeExclude, order, showTermDocCountError);
}
@Override
protected boolean innerEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
TermsAggregationBuilder other = (TermsAggregationBuilder) obj;
return Objects.equals(bucketCountThresholds, other.bucketCountThresholds)
&& Objects.equals(collectMode, other.collectMode)
&& Objects.equals(executionHint, other.executionHint)
&& Objects.equals(includeExclude, other.includeExclude)
&& Objects.equals(order, other.order)
&& Objects.equals(showTermDocCountError, other.showTermDocCountError);
&& Objects.equals(collectMode, other.collectMode)
&& Objects.equals(executionHint, other.executionHint)
&& Objects.equals(includeExclude, other.includeExclude)
&& Objects.equals(order, other.order)
&& Objects.equals(showTermDocCountError, other.showTermDocCountError);
}
@Override

View File

@ -150,7 +150,11 @@ abstract class AbstractInternalHDRPercentiles extends InternalNumericMetricsAggr
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
AbstractInternalHDRPercentiles that = (AbstractInternalHDRPercentiles) obj;
return keyed == that.keyed
&& Arrays.equals(keys, that.keys)
@ -158,10 +162,14 @@ abstract class AbstractInternalHDRPercentiles extends InternalNumericMetricsAggr
}
@Override
protected int doHashCode() {
public int hashCode() {
// we cannot use state.hashCode at the moment because of:
// https://github.com/HdrHistogram/HdrHistogram/issues/81
// TODO: upgrade the HDRHistogram library
return Objects.hash(keyed, Arrays.hashCode(keys), state.getIntegerToDoubleValueConversionRatio(), state.getTotalCount());
return Objects.hash(super.hashCode(),
keyed,
Arrays.hashCode(keys),
state.getIntegerToDoubleValueConversionRatio(),
state.getTotalCount());
}
}

View File

@ -133,7 +133,11 @@ abstract class AbstractInternalTDigestPercentiles extends InternalNumericMetrics
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
AbstractInternalTDigestPercentiles that = (AbstractInternalTDigestPercentiles) obj;
return keyed == that.keyed
&& Arrays.equals(keys, that.keys)
@ -141,7 +145,7 @@ abstract class AbstractInternalTDigestPercentiles extends InternalNumericMetrics
}
@Override
protected int doHashCode() {
return Objects.hash(keyed, Arrays.hashCode(keys), state);
public int hashCode() {
return Objects.hash(super.hashCode(), keyed, Arrays.hashCode(keys), state);
}
}

View File

@ -88,16 +88,6 @@ public class AvgAggregationBuilder extends ValuesSourceAggregationBuilder.LeafOn
return builder;
}
@Override
protected int innerHashCode() {
return 0;
}
@Override
protected boolean innerEquals(Object obj) {
return true;
}
@Override
public String getType() {
return NAME;

View File

@ -137,12 +137,15 @@ public final class CardinalityAggregationBuilder
}
@Override
protected int innerHashCode() {
return Objects.hash(precisionThreshold);
public int hashCode() {
return Objects.hash(super.hashCode(), precisionThreshold);
}
@Override
protected boolean innerEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
CardinalityAggregationBuilder other = (CardinalityAggregationBuilder) obj;
return Objects.equals(precisionThreshold, other.precisionThreshold);
}

View File

@ -110,12 +110,15 @@ public class ExtendedStatsAggregationBuilder
}
@Override
protected int innerHashCode() {
return Objects.hash(sigma);
public int hashCode() {
return Objects.hash(super.hashCode(), sigma);
}
@Override
protected boolean innerEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
ExtendedStatsAggregationBuilder other = (ExtendedStatsAggregationBuilder) obj;
return Objects.equals(sigma, other.sigma);
}

View File

@ -110,12 +110,15 @@ public class GeoBoundsAggregationBuilder extends ValuesSourceAggregationBuilder<
}
@Override
protected int innerHashCode() {
return Objects.hash(wrapLongitude);
public int hashCode() {
return Objects.hash(super.hashCode(), wrapLongitude);
}
@Override
protected boolean innerEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
GeoBoundsAggregationBuilder other = (GeoBoundsAggregationBuilder) obj;
return Objects.equals(wrapLongitude, other.wrapLongitude);
}

View File

@ -88,16 +88,6 @@ public class GeoCentroidAggregationBuilder
return builder;
}
@Override
protected int innerHashCode() {
return 0;
}
@Override
protected boolean innerEquals(Object obj) {
return true;
}
@Override
public String getType() {
return NAME;

View File

@ -118,12 +118,15 @@ public class InternalAvg extends InternalNumericMetricsAggregation.SingleValue i
}
@Override
protected int doHashCode() {
return Objects.hash(sum, count, format.getWriteableName());
public int hashCode() {
return Objects.hash(super.hashCode(), sum, count, format.getWriteableName());
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalAvg other = (InternalAvg) obj;
return Objects.equals(sum, other.sum) &&
Objects.equals(count, other.count) &&

View File

@ -30,6 +30,7 @@ import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Objects;
public final class InternalCardinality extends InternalNumericMetricsAggregation.SingleValue implements Cardinality {
private final HyperLogLogPlusPlus counts;
@ -117,12 +118,16 @@ public final class InternalCardinality extends InternalNumericMetricsAggregation
}
@Override
protected int doHashCode() {
return counts.hashCode(0);
public int hashCode() {
return Objects.hash(super.hashCode(), counts.hashCode(0));
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalCardinality other = (InternalCardinality) obj;
return counts.equals(0, other.counts);
}

View File

@ -215,15 +215,18 @@ public class InternalExtendedStats extends InternalStats implements ExtendedStat
}
@Override
protected int doHashCode() {
return Objects.hash(super.doHashCode(), sumOfSqrs, sigma);
public int hashCode() {
return Objects.hash(super.hashCode(), sumOfSqrs, sigma);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalExtendedStats other = (InternalExtendedStats) obj;
return super.doEquals(obj) &&
Double.compare(sumOfSqrs, other.sumOfSqrs) == 0 &&
return Double.compare(sumOfSqrs, other.sumOfSqrs) == 0 &&
Double.compare(sigma, other.sigma) == 0;
}
}

View File

@ -252,7 +252,11 @@ public class InternalGeoBounds extends InternalAggregation implements GeoBounds
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalGeoBounds other = (InternalGeoBounds) obj;
return top == other.top &&
bottom == other.bottom &&
@ -264,7 +268,7 @@ public class InternalGeoBounds extends InternalAggregation implements GeoBounds
}
@Override
protected int doHashCode() {
return Objects.hash(bottom, posLeft, posRight, negLeft, negRight, wrapLongitude);
public int hashCode() {
return Objects.hash(super.hashCode(), bottom, posLeft, posRight, negLeft, negRight, wrapLongitude);
}
}

View File

@ -180,15 +180,18 @@ public class InternalGeoCentroid extends InternalAggregation implements GeoCentr
}
@Override
public boolean doEquals(Object o) {
InternalGeoCentroid that = (InternalGeoCentroid) o;
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalGeoCentroid that = (InternalGeoCentroid) obj;
return count == that.count &&
Objects.equals(centroid, that.centroid);
}
@Override
protected int doHashCode() {
return Objects.hash(centroid, count);
public int hashCode() {
return Objects.hash(super.hashCode(), centroid, count);
}
@Override

View File

@ -90,12 +90,15 @@ public class InternalMax extends InternalNumericMetricsAggregation.SingleValue i
}
@Override
protected int doHashCode() {
return Objects.hash(max);
public int hashCode() {
return Objects.hash(super.hashCode(), max);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalMax other = (InternalMax) obj;
return Objects.equals(max, other.max);
}

View File

@ -106,12 +106,15 @@ public class InternalMedianAbsoluteDeviation extends InternalNumericMetricsAggre
}
@Override
protected int doHashCode() {
return Objects.hash(valuesSketch);
public int hashCode() {
return Objects.hash(super.hashCode(), valuesSketch);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalMedianAbsoluteDeviation other = (InternalMedianAbsoluteDeviation) obj;
return Objects.equals(valuesSketch, other.valuesSketch);
}

View File

@ -90,12 +90,15 @@ public class InternalMin extends InternalNumericMetricsAggregation.SingleValue i
}
@Override
protected int doHashCode() {
return Objects.hash(min);
public int hashCode() {
return Objects.hash(super.hashCode(), min);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalMin other = (InternalMin) obj;
return Objects.equals(min, other.min);
}

View File

@ -107,19 +107,16 @@ public abstract class InternalNumericMetricsAggregation extends InternalAggregat
@Override
public int hashCode() {
return Objects.hash(format, super.hashCode());
return Objects.hash(super.hashCode(), format);
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (obj.getClass() != getClass()) {
return false;
}
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalNumericMetricsAggregation other = (InternalNumericMetricsAggregation) obj;
return super.equals(obj) &&
Objects.equals(format, other.format);
return Objects.equals(format, other.format);
}
}

View File

@ -135,15 +135,19 @@ public class InternalScriptedMetric extends InternalAggregation implements Scrip
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalScriptedMetric other = (InternalScriptedMetric) obj;
return Objects.equals(reduceScript, other.reduceScript) &&
Objects.equals(aggregation, other.aggregation);
}
@Override
protected int doHashCode() {
return Objects.hash(reduceScript, aggregation);
public int hashCode() {
return Objects.hash(super.hashCode(), reduceScript, aggregation);
}
}

View File

@ -212,12 +212,16 @@ public class InternalStats extends InternalNumericMetricsAggregation.MultiValue
}
@Override
protected int doHashCode() {
return Objects.hash(count, min, max, sum);
public int hashCode() {
return Objects.hash(super.hashCode(), count, min, max, sum);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalStats other = (InternalStats) obj;
return count == other.count &&
Double.compare(min, other.min) == 0 &&

View File

@ -100,12 +100,16 @@ public class InternalSum extends InternalNumericMetricsAggregation.SingleValue i
}
@Override
protected int doHashCode() {
return Objects.hashCode(sum);
public int hashCode() {
return Objects.hash(super.hashCode(), sum);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalSum that = (InternalSum) obj;
return Objects.equals(sum, that.sum);
}

View File

@ -180,7 +180,11 @@ public class InternalTopHits extends InternalAggregation implements TopHits {
// Equals and hashcode implemented for testing round trips
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalTopHits other = (InternalTopHits) obj;
if (from != other.from) return false;
if (size != other.size) return false;
@ -207,9 +211,10 @@ public class InternalTopHits extends InternalAggregation implements TopHits {
}
@Override
protected int doHashCode() {
int hashCode = from;
hashCode = 31 * hashCode + size;
public int hashCode() {
int hashCode = super.hashCode();
hashCode = 31 * hashCode + Integer.hashCode(from);
hashCode = 31 * hashCode + Integer.hashCode(size);
hashCode = 31 * hashCode + Long.hashCode(topDocs.topDocs.totalHits.value);
hashCode = 31 * hashCode + topDocs.topDocs.totalHits.relation.hashCode();
for (int d = 0; d < topDocs.topDocs.scoreDocs.length; d++) {

View File

@ -90,12 +90,16 @@ public class InternalValueCount extends InternalNumericMetricsAggregation.Single
}
@Override
protected int doHashCode() {
return Objects.hash(value);
public int hashCode() {
return Objects.hash(super.hashCode(), value);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalValueCount that = (InternalValueCount) obj;
return Objects.equals(this.value, that.value);
}

View File

@ -129,12 +129,15 @@ public class InternalWeightedAvg extends InternalNumericMetricsAggregation.Singl
}
@Override
protected int doHashCode() {
return Objects.hash(sum, weight, format.getWriteableName());
public int hashCode() {
return Objects.hash(super.hashCode(), sum, weight, format.getWriteableName());
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalWeightedAvg other = (InternalWeightedAvg) obj;
return Objects.equals(sum, other.sum) &&
Objects.equals(weight, other.weight) &&

View File

@ -88,16 +88,6 @@ public class MaxAggregationBuilder extends ValuesSourceAggregationBuilder.LeafOn
return builder;
}
@Override
protected int innerHashCode() {
return 0;
}
@Override
protected boolean innerEquals(Object obj) {
return true;
}
@Override
public String getType() {
return NAME;

View File

@ -123,12 +123,15 @@ public class MedianAbsoluteDeviationAggregationBuilder extends LeafOnly<ValuesSo
}
@Override
protected int innerHashCode() {
return Objects.hash(compression);
public int hashCode() {
return Objects.hash(super.hashCode(), compression);
}
@Override
protected boolean innerEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
MedianAbsoluteDeviationAggregationBuilder other = (MedianAbsoluteDeviationAggregationBuilder) obj;
return Objects.equals(compression, other.compression);
}

View File

@ -88,16 +88,6 @@ public class MinAggregationBuilder extends ValuesSourceAggregationBuilder.LeafOn
return builder;
}
@Override
protected int innerHashCode() {
return 0;
}
@Override
protected boolean innerEquals(Object obj) {
return true;
}
@Override
public String getType() {
return NAME;

View File

@ -269,37 +269,40 @@ public class PercentileRanksAggregationBuilder extends LeafOnly<ValuesSource.Num
}
@Override
protected boolean innerEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
PercentileRanksAggregationBuilder other = (PercentileRanksAggregationBuilder) obj;
if (!Objects.equals(method, other.method)) {
if (Objects.equals(method, other.method) == false) {
return false;
}
boolean equalSettings = false;
switch (method) {
case HDR:
equalSettings = Objects.equals(numberOfSignificantValueDigits, other.numberOfSignificantValueDigits);
break;
case TDIGEST:
equalSettings = Objects.equals(compression, other.compression);
break;
default:
throw new IllegalStateException("Illegal method [" + method + "]");
case HDR:
equalSettings = Objects.equals(numberOfSignificantValueDigits, other.numberOfSignificantValueDigits);
break;
case TDIGEST:
equalSettings = Objects.equals(compression, other.compression);
break;
default:
throw new IllegalStateException("Illegal method [" + method + "]");
}
return equalSettings
&& Objects.deepEquals(values, other.values)
&& Objects.equals(keyed, other.keyed)
&& Objects.equals(method, other.method);
&& Objects.deepEquals(values, other.values)
&& Objects.equals(keyed, other.keyed)
&& Objects.equals(method, other.method);
}
@Override
protected int innerHashCode() {
public int hashCode() {
switch (method) {
case HDR:
return Objects.hash(Arrays.hashCode(values), keyed, numberOfSignificantValueDigits, method);
case TDIGEST:
return Objects.hash(Arrays.hashCode(values), keyed, compression, method);
default:
throw new IllegalStateException("Illegal method [" + method + "]");
case HDR:
return Objects.hash(super.hashCode(), Arrays.hashCode(values), keyed, numberOfSignificantValueDigits, method);
case TDIGEST:
return Objects.hash(super.hashCode(), Arrays.hashCode(values), keyed, compression, method);
default:
throw new IllegalStateException("Illegal method [" + method + "]");
}
}

View File

@ -292,35 +292,39 @@ public class PercentilesAggregationBuilder extends LeafOnly<ValuesSource.Numeric
}
@Override
protected boolean innerEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
PercentilesAggregationBuilder other = (PercentilesAggregationBuilder) obj;
if (!Objects.equals(method, other.method)) {
if (Objects.equals(method, other.method) == false) {
return false;
}
boolean equalSettings = false;
switch (method) {
case HDR:
equalSettings = Objects.equals(numberOfSignificantValueDigits, other.numberOfSignificantValueDigits);
break;
case TDIGEST:
equalSettings = Objects.equals(compression, other.compression);
break;
default:
throw new IllegalStateException("Illegal method [" + method.toString() + "]");
case HDR:
equalSettings = Objects.equals(numberOfSignificantValueDigits, other.numberOfSignificantValueDigits);
break;
case TDIGEST:
equalSettings = Objects.equals(compression, other.compression);
break;
default:
throw new IllegalStateException("Illegal method [" + method.toString() + "]");
}
return equalSettings
&& Objects.deepEquals(percents, other.percents)
&& Objects.equals(keyed, other.keyed)
&& Objects.equals(method, other.method);
&& Objects.deepEquals(percents, other.percents)
&& Objects.equals(keyed, other.keyed)
&& Objects.equals(method, other.method);
}
@Override
protected int innerHashCode() {
public int hashCode() {
switch (method) {
case HDR:
return Objects.hash(Arrays.hashCode(percents), keyed, numberOfSignificantValueDigits, method);
return Objects.hash(super.hashCode(), Arrays.hashCode(percents), keyed, numberOfSignificantValueDigits, method);
case TDIGEST:
return Objects.hash(Arrays.hashCode(percents), keyed, compression, method);
return Objects.hash(super.hashCode(), Arrays.hashCode(percents), keyed, compression, method);
default:
throw new IllegalStateException("Illegal method [" + method.toString() + "]");
}

View File

@ -325,18 +325,21 @@ public class ScriptedMetricAggregationBuilder extends AbstractAggregationBuilder
}
@Override
protected int doHashCode() {
return Objects.hash(initScript, mapScript, combineScript, reduceScript, params);
public int hashCode() {
return Objects.hash(super.hashCode(), initScript, mapScript, combineScript, reduceScript, params);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
ScriptedMetricAggregationBuilder other = (ScriptedMetricAggregationBuilder) obj;
return Objects.equals(initScript, other.initScript)
&& Objects.equals(mapScript, other.mapScript)
&& Objects.equals(combineScript, other.combineScript)
&& Objects.equals(reduceScript, other.reduceScript)
&& Objects.equals(params, other.params);
&& Objects.equals(mapScript, other.mapScript)
&& Objects.equals(combineScript, other.combineScript)
&& Objects.equals(reduceScript, other.reduceScript)
&& Objects.equals(params, other.params);
}
}

View File

@ -89,16 +89,6 @@ public class StatsAggregationBuilder extends ValuesSourceAggregationBuilder.Leaf
return builder;
}
@Override
protected int innerHashCode() {
return 0;
}
@Override
protected boolean innerEquals(Object obj) {
return true;
}
@Override
public String getType() {
return NAME;

View File

@ -88,16 +88,6 @@ public class SumAggregationBuilder extends ValuesSourceAggregationBuilder.LeafOn
return builder;
}
@Override
protected int innerHashCode() {
return 0;
}
@Override
protected boolean innerEquals(Object obj) {
return true;
}
@Override
public String getType() {
return NAME;

View File

@ -775,26 +775,31 @@ public class TopHitsAggregationBuilder extends AbstractAggregationBuilder<TopHit
}
@Override
protected int doHashCode() {
return Objects.hash(explain, fetchSourceContext, docValueFields, storedFieldsContext, from, highlightBuilder,
scriptFields, size, sorts, trackScores, version, seqNoAndPrimaryTerm);
public int hashCode() {
return Objects.hash(super.hashCode(), explain, fetchSourceContext, docValueFields,
storedFieldsContext, from, highlightBuilder,
scriptFields, size, sorts, trackScores, version,
seqNoAndPrimaryTerm);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
TopHitsAggregationBuilder other = (TopHitsAggregationBuilder) obj;
return Objects.equals(explain, other.explain)
&& Objects.equals(fetchSourceContext, other.fetchSourceContext)
&& Objects.equals(docValueFields, other.docValueFields)
&& Objects.equals(storedFieldsContext, other.storedFieldsContext)
&& Objects.equals(from, other.from)
&& Objects.equals(highlightBuilder, other.highlightBuilder)
&& Objects.equals(scriptFields, other.scriptFields)
&& Objects.equals(size, other.size)
&& Objects.equals(sorts, other.sorts)
&& Objects.equals(trackScores, other.trackScores)
&& Objects.equals(version, other.version)
&& Objects.equals(seqNoAndPrimaryTerm, other.seqNoAndPrimaryTerm);
&& Objects.equals(fetchSourceContext, other.fetchSourceContext)
&& Objects.equals(docValueFields, other.docValueFields)
&& Objects.equals(storedFieldsContext, other.storedFieldsContext)
&& Objects.equals(from, other.from)
&& Objects.equals(highlightBuilder, other.highlightBuilder)
&& Objects.equals(scriptFields, other.scriptFields)
&& Objects.equals(size, other.size)
&& Objects.equals(sorts, other.sorts)
&& Objects.equals(trackScores, other.trackScores)
&& Objects.equals(version, other.version)
&& Objects.equals(seqNoAndPrimaryTerm, other.seqNoAndPrimaryTerm);
}
@Override

View File

@ -93,16 +93,6 @@ public class ValueCountAggregationBuilder extends ValuesSourceAggregationBuilder
return builder;
}
@Override
protected int innerHashCode() {
return 0;
}
@Override
protected boolean innerEquals(Object obj) {
return true;
}
@Override
public String getType() {
return NAME;

View File

@ -111,16 +111,6 @@ public class WeightedAvgAggregationBuilder extends MultiValuesSourceAggregationB
return builder;
}
@Override
protected int innerHashCode() {
return 0;
}
@Override
protected boolean innerEquals(Object obj) {
return true;
}
@Override
public String getType() {
return NAME;

View File

@ -171,32 +171,20 @@ public abstract class AbstractPipelineAggregationBuilder<PAB extends AbstractPip
@Override
public int hashCode() {
return Objects.hash(Arrays.hashCode(bucketsPaths), metaData, name, type, doHashCode());
return Objects.hash(Arrays.hashCode(bucketsPaths), metaData, name, type);
}
protected abstract int doHashCode();
@Override
public boolean equals(Object obj) {
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
@SuppressWarnings("unchecked")
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
AbstractPipelineAggregationBuilder<PAB> other = (AbstractPipelineAggregationBuilder<PAB>) obj;
if (!Objects.equals(name, other.name))
return false;
if (!Objects.equals(type, other.type))
return false;
if (!Objects.deepEquals(bucketsPaths, other.bucketsPaths))
return false;
if (!Objects.equals(metaData, other.metaData))
return false;
return doEquals(obj);
return Objects.equals(type, other.type)
&& Objects.equals(name, other.name)
&& Objects.equals(metaData, other.metaData)
&& Objects.deepEquals(bucketsPaths, other.bucketsPaths);
}
protected abstract boolean doEquals(Object obj);
@Override
public String getType() {
return type;

View File

@ -63,16 +63,6 @@ public class AvgBucketPipelineAggregationBuilder extends BucketMetricsPipelineAg
}
};
@Override
protected int innerHashCode() {
return 0;
}
@Override
protected boolean innerEquals(BucketMetricsPipelineAggregationBuilder<AvgBucketPipelineAggregationBuilder> other) {
return true;
}
@Override
public String getWriteableName() {
return NAME;

View File

@ -147,21 +147,19 @@ public abstract class BucketMetricsPipelineAggregationBuilder<AF extends BucketM
protected abstract XContentBuilder doXContentBody(XContentBuilder builder, Params params) throws IOException;
@Override
protected final int doHashCode() {
return Objects.hash(format, gapPolicy, innerHashCode());
public int hashCode() {
return Objects.hash(super.hashCode(), format, gapPolicy);
}
protected abstract int innerHashCode();
@Override
protected final boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
@SuppressWarnings("unchecked")
BucketMetricsPipelineAggregationBuilder<AF> other = (BucketMetricsPipelineAggregationBuilder<AF>) obj;
return Objects.equals(format, other.format)
&& Objects.equals(gapPolicy, other.gapPolicy)
&& innerEquals(other);
&& Objects.equals(gapPolicy, other.gapPolicy);
}
protected abstract boolean innerEquals(BucketMetricsPipelineAggregationBuilder<AF> other);
}

View File

@ -240,15 +240,20 @@ public class BucketScriptPipelineAggregationBuilder extends AbstractPipelineAggr
}
@Override
protected int doHashCode() {
return Objects.hash(bucketsPathsMap, script, format, gapPolicy);
public int hashCode() {
return Objects.hash(super.hashCode(), bucketsPathsMap, script, format, gapPolicy);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
BucketScriptPipelineAggregationBuilder other = (BucketScriptPipelineAggregationBuilder) obj;
return Objects.equals(bucketsPathsMap, other.bucketsPathsMap) && Objects.equals(script, other.script)
&& Objects.equals(format, other.format) && Objects.equals(gapPolicy, other.gapPolicy);
return Objects.equals(bucketsPathsMap, other.bucketsPathsMap)
&& Objects.equals(script, other.script)
&& Objects.equals(format, other.format)
&& Objects.equals(gapPolicy, other.gapPolicy);
}
@Override

View File

@ -199,15 +199,20 @@ public class BucketSelectorPipelineAggregationBuilder extends AbstractPipelineAg
}
@Override
protected int doHashCode() {
return Objects.hash(bucketsPathsMap, script, gapPolicy);
public int hashCode() {
return Objects.hash(super.hashCode(), bucketsPathsMap, script, gapPolicy);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
BucketSelectorPipelineAggregationBuilder other = (BucketSelectorPipelineAggregationBuilder) obj;
return Objects.equals(bucketsPathsMap, other.bucketsPathsMap) && Objects.equals(script, other.script)
&& Objects.equals(gapPolicy, other.gapPolicy);
return Objects.equals(bucketsPathsMap, other.bucketsPathsMap)
&& Objects.equals(script, other.script)
&& Objects.equals(gapPolicy, other.gapPolicy);
}
@Override

View File

@ -174,12 +174,15 @@ public class BucketSortPipelineAggregationBuilder extends AbstractPipelineAggreg
}
@Override
protected int doHashCode() {
return Objects.hash(sorts, from, size, gapPolicy);
public int hashCode() {
return Objects.hash(super.hashCode(), sorts, from, size, gapPolicy);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
BucketSortPipelineAggregationBuilder other = (BucketSortPipelineAggregationBuilder) obj;
return Objects.equals(sorts, other.sorts)
&& Objects.equals(from, other.from)

View File

@ -162,12 +162,15 @@ public class CumulativeSumPipelineAggregationBuilder extends AbstractPipelineAgg
}
@Override
protected int doHashCode() {
return Objects.hash(format);
public int hashCode() {
return Objects.hash(super.hashCode(), format);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
CumulativeSumPipelineAggregationBuilder other = (CumulativeSumPipelineAggregationBuilder) obj;
return Objects.equals(format, other.format);
}

View File

@ -238,23 +238,19 @@ public class DerivativePipelineAggregationBuilder extends AbstractPipelineAggreg
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
DerivativePipelineAggregationBuilder other = (DerivativePipelineAggregationBuilder) obj;
if (!Objects.equals(format, other.format)) {
return false;
}
if (!Objects.equals(gapPolicy, other.gapPolicy)) {
return false;
}
if (!Objects.equals(units, other.units)) {
return false;
}
return true;
return Objects.equals(format, other.format) &&
gapPolicy == other.gapPolicy &&
Objects.equals(units, other.units);
}
@Override
protected int doHashCode() {
return Objects.hash(format, gapPolicy, units);
public int hashCode() {
return Objects.hash(super.hashCode(), format, gapPolicy, units);
}
@Override

View File

@ -97,12 +97,15 @@ public class ExtendedStatsBucketPipelineAggregationBuilder
}
@Override
protected int innerHashCode() {
return Objects.hash(sigma);
public int hashCode() {
return Objects.hash(super.hashCode(), sigma);
}
@Override
protected boolean innerEquals(BucketMetricsPipelineAggregationBuilder<ExtendedStatsBucketPipelineAggregationBuilder> obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
ExtendedStatsBucketPipelineAggregationBuilder other = (ExtendedStatsBucketPipelineAggregationBuilder) obj;
return Objects.equals(sigma, other.sigma);
}

View File

@ -118,12 +118,15 @@ public class InternalBucketMetricValue extends InternalNumericMetricsAggregation
}
@Override
protected int doHashCode() {
return Objects.hash(value, Arrays.hashCode(keys));
public int hashCode() {
return Objects.hash(super.hashCode(), value, Arrays.hashCode(keys));
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalBucketMetricValue other = (InternalBucketMetricValue) obj;
return Objects.equals(value, other.value)
&& Arrays.equals(keys, other.keys);

View File

@ -98,12 +98,15 @@ public class InternalDerivative extends InternalSimpleValue implements Derivativ
}
@Override
protected int doHashCode() {
return Objects.hash(normalizationFactor, value);
public int hashCode() {
return Objects.hash(super.hashCode(), normalizationFactor, value);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalDerivative other = (InternalDerivative) obj;
return Objects.equals(value, other.value)
&& Objects.equals(normalizationFactor, other.normalizationFactor);

View File

@ -163,14 +163,18 @@ public class InternalPercentilesBucket extends InternalNumericMetricsAggregation
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalPercentilesBucket that = (InternalPercentilesBucket) obj;
return Arrays.equals(percents, that.percents) && Arrays.equals(percentiles, that.percentiles);
}
@Override
protected int doHashCode() {
return Objects.hash(Arrays.hashCode(percents), Arrays.hashCode(percentiles));
public int hashCode() {
return Objects.hash(super.hashCode(), Arrays.hashCode(percents), Arrays.hashCode(percentiles));
}
public static class Iter implements Iterator<Percentile> {

View File

@ -91,12 +91,15 @@ public class InternalSimpleValue extends InternalNumericMetricsAggregation.Singl
}
@Override
protected int doHashCode() {
return Objects.hash(value);
public int hashCode() {
return Objects.hash(super.hashCode(), value);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
InternalSimpleValue other = (InternalSimpleValue) obj;
return Objects.equals(value, other.value);
}

View File

@ -63,16 +63,6 @@ public class MaxBucketPipelineAggregationBuilder extends BucketMetricsPipelineAg
}
};
@Override
protected int innerHashCode() {
return 0;
}
@Override
protected boolean innerEquals(BucketMetricsPipelineAggregationBuilder<MaxBucketPipelineAggregationBuilder> other) {
return true;
}
@Override
public String getWriteableName() {
return NAME;

View File

@ -63,16 +63,6 @@ public class MinBucketPipelineAggregationBuilder extends BucketMetricsPipelineAg
}
};
@Override
protected int innerHashCode() {
return 0;
}
@Override
protected boolean innerEquals(BucketMetricsPipelineAggregationBuilder<MinBucketPipelineAggregationBuilder> other) {
return true;
}
@Override
public String getWriteableName() {
return NAME;

View File

@ -410,12 +410,15 @@ public class MovAvgPipelineAggregationBuilder extends AbstractPipelineAggregatio
}
@Override
protected int doHashCode() {
return Objects.hash(format, gapPolicy, window, model, predict, minimize);
public int hashCode() {
return Objects.hash(super.hashCode(), format, gapPolicy, window, model, predict, minimize);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
MovAvgPipelineAggregationBuilder other = (MovAvgPipelineAggregationBuilder) obj;
return Objects.equals(format, other.format)
&& Objects.equals(gapPolicy, other.gapPolicy)

View File

@ -224,12 +224,15 @@ public class MovFnPipelineAggregationBuilder extends AbstractPipelineAggregation
}
@Override
protected int doHashCode() {
return Objects.hash(bucketsPathString, script, format, gapPolicy, window);
public int hashCode() {
return Objects.hash(super.hashCode(), bucketsPathString, script, format, gapPolicy, window);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
MovFnPipelineAggregationBuilder other = (MovFnPipelineAggregationBuilder) obj;
return Objects.equals(bucketsPathString, other.bucketsPathString)
&& Objects.equals(script, other.script)

View File

@ -180,14 +180,18 @@ public class PercentilesBucketPipelineAggregationBuilder
};
@Override
protected int innerHashCode() {
return Objects.hash(Arrays.hashCode(percents), keyed);
public int hashCode() {
return Objects.hash(super.hashCode(), Arrays.hashCode(percents), keyed);
}
@Override
protected boolean innerEquals(BucketMetricsPipelineAggregationBuilder<PercentilesBucketPipelineAggregationBuilder> obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
PercentilesBucketPipelineAggregationBuilder other = (PercentilesBucketPipelineAggregationBuilder) obj;
return Objects.deepEquals(percents, other.percents) && Objects.equals(keyed, other.keyed);
return Objects.deepEquals(percents, other.percents)
&& Objects.equals(keyed, other.keyed);
}
@Override

View File

@ -228,11 +228,15 @@ public class SerialDiffPipelineAggregationBuilder extends AbstractPipelineAggreg
}
@Override
protected int doHashCode() {
return Objects.hash(format, gapPolicy, lag);
public int hashCode() {
return Objects.hash(super.hashCode(), format, gapPolicy, lag);
}
@Override
protected boolean doEquals(Object obj) {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
if (super.equals(obj) == false) return false;
SerialDiffPipelineAggregationBuilder other = (SerialDiffPipelineAggregationBuilder) obj;
return Objects.equals(format, other.format)
&& Objects.equals(gapPolicy, other.gapPolicy)

View File

@ -64,16 +64,6 @@ public class StatsBucketPipelineAggregationBuilder extends BucketMetricsPipeline
}
};
@Override
protected int innerHashCode() {
return 0;
}
@Override
protected boolean innerEquals(BucketMetricsPipelineAggregationBuilder<StatsBucketPipelineAggregationBuilder> other) {
return true;
}
@Override
public String getWriteableName() {
return NAME;

View File

@ -63,16 +63,6 @@ public class SumBucketPipelineAggregationBuilder extends BucketMetricsPipelineAg
}
};
@Override
protected int innerHashCode() {
return 0;
}
@Override
protected boolean innerEquals(BucketMetricsPipelineAggregationBuilder<SumBucketPipelineAggregationBuilder> other) {
return true;
}
@Override
public String getWriteableName() {
return NAME;

Some files were not shown because too many files have changed in this diff Show More