software.amazon.awssdk.services.forecast.model.Statistics Maven / Gradle / Ivy
Show all versions of forecast Show documentation
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.forecast.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Provides statistics for each data field imported into to an Amazon Forecast dataset with the CreateDatasetImportJob
* operation.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Statistics implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER).memberName("Count")
.getter(getter(Statistics::count)).setter(setter(Builder::count))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Count").build()).build();
private static final SdkField COUNT_DISTINCT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("CountDistinct").getter(getter(Statistics::countDistinct)).setter(setter(Builder::countDistinct))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CountDistinct").build()).build();
private static final SdkField COUNT_NULL_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("CountNull").getter(getter(Statistics::countNull)).setter(setter(Builder::countNull))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CountNull").build()).build();
private static final SdkField COUNT_NAN_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("CountNan").getter(getter(Statistics::countNan)).setter(setter(Builder::countNan))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CountNan").build()).build();
private static final SdkField MIN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Min")
.getter(getter(Statistics::min)).setter(setter(Builder::min))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Min").build()).build();
private static final SdkField MAX_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Max")
.getter(getter(Statistics::max)).setter(setter(Builder::max))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Max").build()).build();
private static final SdkField AVG_FIELD = SdkField. builder(MarshallingType.DOUBLE).memberName("Avg")
.getter(getter(Statistics::avg)).setter(setter(Builder::avg))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Avg").build()).build();
private static final SdkField STDDEV_FIELD = SdkField. builder(MarshallingType.DOUBLE).memberName("Stddev")
.getter(getter(Statistics::stddev)).setter(setter(Builder::stddev))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Stddev").build()).build();
private static final SdkField COUNT_LONG_FIELD = SdkField. builder(MarshallingType.LONG).memberName("CountLong")
.getter(getter(Statistics::countLong)).setter(setter(Builder::countLong))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CountLong").build()).build();
private static final SdkField COUNT_DISTINCT_LONG_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("CountDistinctLong").getter(getter(Statistics::countDistinctLong))
.setter(setter(Builder::countDistinctLong))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CountDistinctLong").build()).build();
private static final SdkField COUNT_NULL_LONG_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("CountNullLong").getter(getter(Statistics::countNullLong)).setter(setter(Builder::countNullLong))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CountNullLong").build()).build();
private static final SdkField COUNT_NAN_LONG_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("CountNanLong").getter(getter(Statistics::countNanLong)).setter(setter(Builder::countNanLong))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CountNanLong").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(COUNT_FIELD,
COUNT_DISTINCT_FIELD, COUNT_NULL_FIELD, COUNT_NAN_FIELD, MIN_FIELD, MAX_FIELD, AVG_FIELD, STDDEV_FIELD,
COUNT_LONG_FIELD, COUNT_DISTINCT_LONG_FIELD, COUNT_NULL_LONG_FIELD, COUNT_NAN_LONG_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("Count", COUNT_FIELD);
put("CountDistinct", COUNT_DISTINCT_FIELD);
put("CountNull", COUNT_NULL_FIELD);
put("CountNan", COUNT_NAN_FIELD);
put("Min", MIN_FIELD);
put("Max", MAX_FIELD);
put("Avg", AVG_FIELD);
put("Stddev", STDDEV_FIELD);
put("CountLong", COUNT_LONG_FIELD);
put("CountDistinctLong", COUNT_DISTINCT_LONG_FIELD);
put("CountNullLong", COUNT_NULL_LONG_FIELD);
put("CountNanLong", COUNT_NAN_LONG_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final Integer count;
private final Integer countDistinct;
private final Integer countNull;
private final Integer countNan;
private final String min;
private final String max;
private final Double avg;
private final Double stddev;
private final Long countLong;
private final Long countDistinctLong;
private final Long countNullLong;
private final Long countNanLong;
private Statistics(BuilderImpl builder) {
this.count = builder.count;
this.countDistinct = builder.countDistinct;
this.countNull = builder.countNull;
this.countNan = builder.countNan;
this.min = builder.min;
this.max = builder.max;
this.avg = builder.avg;
this.stddev = builder.stddev;
this.countLong = builder.countLong;
this.countDistinctLong = builder.countDistinctLong;
this.countNullLong = builder.countNullLong;
this.countNanLong = builder.countNanLong;
}
/**
*
* The number of values in the field. If the response value is -1, refer to CountLong
.
*
*
* @return The number of values in the field. If the response value is -1, refer to CountLong
.
*/
public final Integer count() {
return count;
}
/**
*
* The number of distinct values in the field. If the response value is -1, refer to CountDistinctLong
.
*
*
* @return The number of distinct values in the field. If the response value is -1, refer to
* CountDistinctLong
.
*/
public final Integer countDistinct() {
return countDistinct;
}
/**
*
* The number of null values in the field. If the response value is -1, refer to CountNullLong
.
*
*
* @return The number of null values in the field. If the response value is -1, refer to CountNullLong
.
*/
public final Integer countNull() {
return countNull;
}
/**
*
* The number of NAN (not a number) values in the field. If the response value is -1, refer to
* CountNanLong
.
*
*
* @return The number of NAN (not a number) values in the field. If the response value is -1, refer to
* CountNanLong
.
*/
public final Integer countNan() {
return countNan;
}
/**
*
* For a numeric field, the minimum value in the field.
*
*
* @return For a numeric field, the minimum value in the field.
*/
public final String min() {
return min;
}
/**
*
* For a numeric field, the maximum value in the field.
*
*
* @return For a numeric field, the maximum value in the field.
*/
public final String max() {
return max;
}
/**
*
* For a numeric field, the average value in the field.
*
*
* @return For a numeric field, the average value in the field.
*/
public final Double avg() {
return avg;
}
/**
*
* For a numeric field, the standard deviation.
*
*
* @return For a numeric field, the standard deviation.
*/
public final Double stddev() {
return stddev;
}
/**
*
* The number of values in the field. CountLong
is used instead of Count
if the value is
* greater than 2,147,483,647.
*
*
* @return The number of values in the field. CountLong
is used instead of Count
if the
* value is greater than 2,147,483,647.
*/
public final Long countLong() {
return countLong;
}
/**
*
* The number of distinct values in the field. CountDistinctLong
is used instead of
* CountDistinct
if the value is greater than 2,147,483,647.
*
*
* @return The number of distinct values in the field. CountDistinctLong
is used instead of
* CountDistinct
if the value is greater than 2,147,483,647.
*/
public final Long countDistinctLong() {
return countDistinctLong;
}
/**
*
* The number of null values in the field. CountNullLong
is used instead of CountNull
if
* the value is greater than 2,147,483,647.
*
*
* @return The number of null values in the field. CountNullLong
is used instead of
* CountNull
if the value is greater than 2,147,483,647.
*/
public final Long countNullLong() {
return countNullLong;
}
/**
*
* The number of NAN (not a number) values in the field. CountNanLong
is used instead of
* CountNan
if the value is greater than 2,147,483,647.
*
*
* @return The number of NAN (not a number) values in the field. CountNanLong
is used instead of
* CountNan
if the value is greater than 2,147,483,647.
*/
public final Long countNanLong() {
return countNanLong;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(count());
hashCode = 31 * hashCode + Objects.hashCode(countDistinct());
hashCode = 31 * hashCode + Objects.hashCode(countNull());
hashCode = 31 * hashCode + Objects.hashCode(countNan());
hashCode = 31 * hashCode + Objects.hashCode(min());
hashCode = 31 * hashCode + Objects.hashCode(max());
hashCode = 31 * hashCode + Objects.hashCode(avg());
hashCode = 31 * hashCode + Objects.hashCode(stddev());
hashCode = 31 * hashCode + Objects.hashCode(countLong());
hashCode = 31 * hashCode + Objects.hashCode(countDistinctLong());
hashCode = 31 * hashCode + Objects.hashCode(countNullLong());
hashCode = 31 * hashCode + Objects.hashCode(countNanLong());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof Statistics)) {
return false;
}
Statistics other = (Statistics) obj;
return Objects.equals(count(), other.count()) && Objects.equals(countDistinct(), other.countDistinct())
&& Objects.equals(countNull(), other.countNull()) && Objects.equals(countNan(), other.countNan())
&& Objects.equals(min(), other.min()) && Objects.equals(max(), other.max()) && Objects.equals(avg(), other.avg())
&& Objects.equals(stddev(), other.stddev()) && Objects.equals(countLong(), other.countLong())
&& Objects.equals(countDistinctLong(), other.countDistinctLong())
&& Objects.equals(countNullLong(), other.countNullLong()) && Objects.equals(countNanLong(), other.countNanLong());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("Statistics").add("Count", count()).add("CountDistinct", countDistinct())
.add("CountNull", countNull()).add("CountNan", countNan()).add("Min", min()).add("Max", max()).add("Avg", avg())
.add("Stddev", stddev()).add("CountLong", countLong()).add("CountDistinctLong", countDistinctLong())
.add("CountNullLong", countNullLong()).add("CountNanLong", countNanLong()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Count":
return Optional.ofNullable(clazz.cast(count()));
case "CountDistinct":
return Optional.ofNullable(clazz.cast(countDistinct()));
case "CountNull":
return Optional.ofNullable(clazz.cast(countNull()));
case "CountNan":
return Optional.ofNullable(clazz.cast(countNan()));
case "Min":
return Optional.ofNullable(clazz.cast(min()));
case "Max":
return Optional.ofNullable(clazz.cast(max()));
case "Avg":
return Optional.ofNullable(clazz.cast(avg()));
case "Stddev":
return Optional.ofNullable(clazz.cast(stddev()));
case "CountLong":
return Optional.ofNullable(clazz.cast(countLong()));
case "CountDistinctLong":
return Optional.ofNullable(clazz.cast(countDistinctLong()));
case "CountNullLong":
return Optional.ofNullable(clazz.cast(countNullLong()));
case "CountNanLong":
return Optional.ofNullable(clazz.cast(countNanLong()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Function