|
6 | 6 | * compatible open source license. |
7 | 7 | */ |
8 | 8 |
|
| 9 | +/* |
| 10 | + * Licensed to Elasticsearch under one or more contributor |
| 11 | + * license agreements. See the NOTICE file distributed with |
| 12 | + * this work for additional information regarding copyright |
| 13 | + * ownership. Elasticsearch licenses this file to you under |
| 14 | + * the Apache License, Version 2.0 (the "License"); you may |
| 15 | + * not use this file except in compliance with the License. |
| 16 | + * You may obtain a copy of the License at |
| 17 | + * |
| 18 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 19 | + * |
| 20 | + * Unless required by applicable law or agreed to in writing, |
| 21 | + * software distributed under the License is distributed on an |
| 22 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 23 | + * KIND, either express or implied. See the License for the |
| 24 | + * specific language governing permissions and limitations |
| 25 | + * under the License. |
| 26 | + */ |
| 27 | + |
| 28 | +/* |
| 29 | + * Modifications Copyright OpenSearch Contributors. See |
| 30 | + * GitHub history for details. |
| 31 | + */ |
| 32 | + |
9 | 33 | package org.opensearch.search.aggregations.metrics; |
10 | 34 |
|
11 | 35 | import org.opensearch.core.common.io.stream.StreamInput; |
|
14 | 38 |
|
15 | 39 | import java.io.IOException; |
16 | 40 |
|
| 41 | +/** |
| 42 | + * Represents a scripted average calculation containing a sum and count. |
| 43 | + * |
| 44 | + * @opensearch.internal |
| 45 | + */ |
17 | 46 | public class ScriptedAvg implements Writeable { |
18 | 47 | private double sum; |
19 | 48 | private long count; |
20 | 49 |
|
| 50 | + /** |
| 51 | + * Constructor for ScriptedAvg |
| 52 | + * |
| 53 | + * @param sum The sum of values |
| 54 | + * @param count The count of values |
| 55 | + */ |
21 | 56 | public ScriptedAvg(double sum, long count) { |
22 | 57 | this.sum = sum; |
23 | 58 | this.count = count; |
24 | 59 | } |
25 | 60 |
|
| 61 | + /** |
| 62 | + * Read from a stream. |
| 63 | + */ |
26 | 64 | public ScriptedAvg(StreamInput in) throws IOException { |
27 | 65 | this.sum = in.readDouble(); |
28 | 66 | this.count = in.readLong(); |
|
0 commit comments