software.amazon.awssdk.services.forecast.model.Statistics Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of forecast Show documentation
Show all versions of forecast Show documentation
The AWS Java SDK for Forecast module holds the client classes that are used for
communicating with Forecast.
/*
* Copyright 2014-2019 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.List;
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 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)
.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)
.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)
.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)
.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)
.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)
.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)
.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)
.getter(getter(Statistics::stddev)).setter(setter(Builder::stddev))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Stddev").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));
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 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;
}
/**
*
* The number of values in the field.
*
*
* @return The number of values in the field.
*/
public Integer count() {
return count;
}
/**
*
* The number of distinct values in the field.
*
*
* @return The number of distinct values in the field.
*/
public Integer countDistinct() {
return countDistinct;
}
/**
*
* The number of null values in the field.
*
*
* @return The number of null values in the field.
*/
public Integer countNull() {
return countNull;
}
/**
*
* The number of NAN (not a number) values in the field.
*
*
* @return The number of NAN (not a number) values in the field.
*/
public 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 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 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 Double avg() {
return avg;
}
/**
*
* For a numeric field, the standard deviation.
*
*
* @return For a numeric field, the standard deviation.
*/
public Double stddev() {
return stddev;
}
@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 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());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public 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());
}
/**
* 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 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()).build();
}
public 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()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy