Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 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 com.amazonaws.services.cloudwatch.model;
 

The Datapoint data type encapsulates the statistical data that Amazon CloudWatch computes from metric data.

 
 public class Datapoint implements SerializableCloneable {

    
The time stamp used for the datapoint.
 
     private java.util.Date timestamp;

    
The number of metric values that contributed to the aggregate value of this datapoint.
 
     private Double sampleCount;

    
The average of metric values that correspond to the datapoint.
 
     private Double average;

    
The sum of metric values used for the datapoint.
 
     private Double sum;

    
The minimum metric value used for the datapoint.
 
     private Double minimum;

    
The maximum of the metric value used for the datapoint.
 
     private Double maximum;

    
The standard unit used for the datapoint.

Constraints:
Allowed Values: Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, None

 
     private String unit;

    
The time stamp used for the datapoint.

Returns:
The time stamp used for the datapoint.
 
     public java.util.Date getTimestamp() {
         return ;
     }
    
    
The time stamp used for the datapoint.

Parameters:
timestamp The time stamp used for the datapoint.
 
     public void setTimestamp(java.util.Date timestamp) {
         this. = timestamp;
     }
    
    
The time stamp used for the datapoint.

Returns a reference to this object so that method calls can be chained together.

Parameters:
timestamp The time stamp used for the datapoint.
Returns:
A reference to this updated object so that method calls can be chained together.
 
     public Datapoint withTimestamp(java.util.Date timestamp) {
         this. = timestamp;
         return this;
     }

    
The number of metric values that contributed to the aggregate value of this datapoint.

Returns:
The number of metric values that contributed to the aggregate value of this datapoint.
    public Double getSampleCount() {
        return ;
    }
    
    
The number of metric values that contributed to the aggregate value of this datapoint.

Parameters:
sampleCount The number of metric values that contributed to the aggregate value of this datapoint.
    public void setSampleCount(Double sampleCount) {
        this. = sampleCount;
    }
    
    
The number of metric values that contributed to the aggregate value of this datapoint.

Returns a reference to this object so that method calls can be chained together.

Parameters:
sampleCount The number of metric values that contributed to the aggregate value of this datapoint.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Datapoint withSampleCount(Double sampleCount) {
        this. = sampleCount;
        return this;
    }

    
The average of metric values that correspond to the datapoint.

Returns:
The average of metric values that correspond to the datapoint.
    public Double getAverage() {
        return ;
    }
    
    
The average of metric values that correspond to the datapoint.

Parameters:
average The average of metric values that correspond to the datapoint.
    public void setAverage(Double average) {
        this. = average;
    }
    
    
The average of metric values that correspond to the datapoint.

Returns a reference to this object so that method calls can be chained together.

Parameters:
average The average of metric values that correspond to the datapoint.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Datapoint withAverage(Double average) {
        this. = average;
        return this;
    }

    
The sum of metric values used for the datapoint.

Returns:
The sum of metric values used for the datapoint.
    public Double getSum() {
        return ;
    }
    
    
The sum of metric values used for the datapoint.

Parameters:
sum The sum of metric values used for the datapoint.
    public void setSum(Double sum) {
        this. = sum;
    }
    
    
The sum of metric values used for the datapoint.

Returns a reference to this object so that method calls can be chained together.

Parameters:
sum The sum of metric values used for the datapoint.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Datapoint withSum(Double sum) {
        this. = sum;
        return this;
    }

    
The minimum metric value used for the datapoint.

Returns:
The minimum metric value used for the datapoint.
    public Double getMinimum() {
        return ;
    }
    
    
The minimum metric value used for the datapoint.

Parameters:
minimum The minimum metric value used for the datapoint.
    public void setMinimum(Double minimum) {
        this. = minimum;
    }
    
    
The minimum metric value used for the datapoint.

Returns a reference to this object so that method calls can be chained together.

Parameters:
minimum The minimum metric value used for the datapoint.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Datapoint withMinimum(Double minimum) {
        this. = minimum;
        return this;
    }

    
The maximum of the metric value used for the datapoint.

Returns:
The maximum of the metric value used for the datapoint.
    public Double getMaximum() {
        return ;
    }
    
    
The maximum of the metric value used for the datapoint.

Parameters:
maximum The maximum of the metric value used for the datapoint.
    public void setMaximum(Double maximum) {
        this. = maximum;
    }
    
    
The maximum of the metric value used for the datapoint.

Returns a reference to this object so that method calls can be chained together.

Parameters:
maximum The maximum of the metric value used for the datapoint.
Returns:
A reference to this updated object so that method calls can be chained together.
    public Datapoint withMaximum(Double maximum) {
        this. = maximum;
        return this;
    }

    
The standard unit used for the datapoint.

Constraints:
Allowed Values: Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, None

Returns:
The standard unit used for the datapoint.
See also:
StandardUnit
    public String getUnit() {
        return ;
    }
    
    
The standard unit used for the datapoint.

Constraints:
Allowed Values: Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, None

Parameters:
unit The standard unit used for the datapoint.
See also:
StandardUnit
    public void setUnit(String unit) {
        this. = unit;
    }
    
    
The standard unit used for the datapoint.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Allowed Values: Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, None

Parameters:
unit The standard unit used for the datapoint.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
StandardUnit
    public Datapoint withUnit(String unit) {
        this. = unit;
        return this;
    }

    
The standard unit used for the datapoint.

Constraints:
Allowed Values: Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, None

Parameters:
unit The standard unit used for the datapoint.
See also:
StandardUnit
    public void setUnit(StandardUnit unit) {
        this. = unit.toString();
    }
    
    
The standard unit used for the datapoint.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Allowed Values: Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, None

Parameters:
unit The standard unit used for the datapoint.
Returns:
A reference to this updated object so that method calls can be chained together.
See also:
StandardUnit
    public Datapoint withUnit(StandardUnit unit) {
        this. = unit.toString();
        return this;
    }

    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getTimestamp() != nullsb.append("Timestamp: " + getTimestamp() + ",");
        if (getSampleCount() != nullsb.append("SampleCount: " + getSampleCount() + ",");
        if (getAverage() != nullsb.append("Average: " + getAverage() + ",");
        if (getSum() != nullsb.append("Sum: " + getSum() + ",");
        if (getMinimum() != nullsb.append("Minimum: " + getMinimum() + ",");
        if (getMaximum() != nullsb.append("Maximum: " + getMaximum() + ",");
        if (getUnit() != nullsb.append("Unit: " + getUnit() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getTimestamp() == null) ? 0 : getTimestamp().hashCode()); 
        hashCode = prime * hashCode + ((getSampleCount() == null) ? 0 : getSampleCount().hashCode()); 
        hashCode = prime * hashCode + ((getAverage() == null) ? 0 : getAverage().hashCode()); 
        hashCode = prime * hashCode + ((getSum() == null) ? 0 : getSum().hashCode()); 
        hashCode = prime * hashCode + ((getMinimum() == null) ? 0 : getMinimum().hashCode()); 
        hashCode = prime * hashCode + ((getMaximum() == null) ? 0 : getMaximum().hashCode()); 
        hashCode = prime * hashCode + ((getUnit() == null) ? 0 : getUnit().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof Datapoint == falsereturn false;
        Datapoint other = (Datapoint)obj;
        
        if (other.getTimestamp() == null ^ this.getTimestamp() == nullreturn false;
        if (other.getTimestamp() != null && other.getTimestamp().equals(this.getTimestamp()) == falsereturn false
        if (other.getSampleCount() == null ^ this.getSampleCount() == nullreturn false;
        if (other.getSampleCount() != null && other.getSampleCount().equals(this.getSampleCount()) == falsereturn false
        if (other.getAverage() == null ^ this.getAverage() == nullreturn false;
        if (other.getAverage() != null && other.getAverage().equals(this.getAverage()) == falsereturn false
        if (other.getSum() == null ^ this.getSum() == nullreturn false;
        if (other.getSum() != null && other.getSum().equals(this.getSum()) == falsereturn false
        if (other.getMinimum() == null ^ this.getMinimum() == nullreturn false;
        if (other.getMinimum() != null && other.getMinimum().equals(this.getMinimum()) == falsereturn false
        if (other.getMaximum() == null ^ this.getMaximum() == nullreturn false;
        if (other.getMaximum() != null && other.getMaximum().equals(this.getMaximum()) == falsereturn false
        if (other.getUnit() == null ^ this.getUnit() == nullreturn false;
        if (other.getUnit() != null && other.getUnit().equals(this.getUnit()) == falsereturn false
        return true;
    }
    
    @Override
    public Datapoint clone() {
        try {
            return (Datapointsuper.clone();
        
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                    + "even though we're Cloneable!",
                    e);
        }
        
    }
}
    
New to GrepCode? Check out our FAQ X