All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.forecast.model.Statistics Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Forecast module holds the client classes that are used for communicating with Forecast.

There is a newer version: 2.30.1
Show newest version
/*
 * 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 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 getter(Function g) { return obj -> g.apply((Statistics) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The number of values in the field. *

* * @param count * The number of values in the field. * @return Returns a reference to this object so that method calls can be chained together. */ Builder count(Integer count); /** *

* The number of distinct values in the field. *

* * @param countDistinct * The number of distinct values in the field. * @return Returns a reference to this object so that method calls can be chained together. */ Builder countDistinct(Integer countDistinct); /** *

* The number of null values in the field. *

* * @param countNull * The number of null values in the field. * @return Returns a reference to this object so that method calls can be chained together. */ Builder countNull(Integer countNull); /** *

* The number of NAN (not a number) values in the field. *

* * @param countNan * The number of NAN (not a number) values in the field. * @return Returns a reference to this object so that method calls can be chained together. */ Builder countNan(Integer countNan); /** *

* For a numeric field, the minimum value in the field. *

* * @param min * For a numeric field, the minimum value in the field. * @return Returns a reference to this object so that method calls can be chained together. */ Builder min(String min); /** *

* For a numeric field, the maximum value in the field. *

* * @param max * For a numeric field, the maximum value in the field. * @return Returns a reference to this object so that method calls can be chained together. */ Builder max(String max); /** *

* For a numeric field, the average value in the field. *

* * @param avg * For a numeric field, the average value in the field. * @return Returns a reference to this object so that method calls can be chained together. */ Builder avg(Double avg); /** *

* For a numeric field, the standard deviation. *

* * @param stddev * For a numeric field, the standard deviation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder stddev(Double stddev); } static final class BuilderImpl implements Builder { private Integer count; private Integer countDistinct; private Integer countNull; private Integer countNan; private String min; private String max; private Double avg; private Double stddev; private BuilderImpl() { } private BuilderImpl(Statistics model) { count(model.count); countDistinct(model.countDistinct); countNull(model.countNull); countNan(model.countNan); min(model.min); max(model.max); avg(model.avg); stddev(model.stddev); } public final Integer getCount() { return count; } @Override public final Builder count(Integer count) { this.count = count; return this; } public final void setCount(Integer count) { this.count = count; } public final Integer getCountDistinct() { return countDistinct; } @Override public final Builder countDistinct(Integer countDistinct) { this.countDistinct = countDistinct; return this; } public final void setCountDistinct(Integer countDistinct) { this.countDistinct = countDistinct; } public final Integer getCountNull() { return countNull; } @Override public final Builder countNull(Integer countNull) { this.countNull = countNull; return this; } public final void setCountNull(Integer countNull) { this.countNull = countNull; } public final Integer getCountNan() { return countNan; } @Override public final Builder countNan(Integer countNan) { this.countNan = countNan; return this; } public final void setCountNan(Integer countNan) { this.countNan = countNan; } public final String getMin() { return min; } @Override public final Builder min(String min) { this.min = min; return this; } public final void setMin(String min) { this.min = min; } public final String getMax() { return max; } @Override public final Builder max(String max) { this.max = max; return this; } public final void setMax(String max) { this.max = max; } public final Double getAvg() { return avg; } @Override public final Builder avg(Double avg) { this.avg = avg; return this; } public final void setAvg(Double avg) { this.avg = avg; } public final Double getStddev() { return stddev; } @Override public final Builder stddev(Double stddev) { this.stddev = stddev; return this; } public final void setStddev(Double stddev) { this.stddev = stddev; } @Override public Statistics build() { return new Statistics(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy