/*
 * Copyright 2015 Timothy Brooks
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License 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 net.uncontended.precipice.metrics;

public class LatencySnapshot {

    public final long latencyMax;
    public final long latency50;
    public final long latency90;
    public final long latency99;
    public final long latency999;
    public final long latency9999;
    public final long latency99999;
    public final double latencyMean;

    public final long startTime;
    public final long endTime;

    public LatencySnapshot(long latency50, long latency90, long latency99, long latency999, long latency9999,
                           long latency99999, long latencyMax, double latencyMean, long startTime, long endTime) {
        this.latency50 = latency50;
        this.latency90 = latency90;
        this.latency99 = latency99;
        this.latency999 = latency999;
        this.latency9999 = latency9999;
        this.latency99999 = latency99999;
        this.latencyMax = latencyMax;
        this.latencyMean = latencyMean;
        this.startTime = startTime;
        this.endTime = endTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        LatencySnapshot that = (LatencySnapshot) o;

        if (latencyMax != that.latencyMax) return false;
        if (latency50 != that.latency50) return false;
        if (latency90 != that.latency90) return false;
        if (latency99 != that.latency99) return false;
        if (latency999 != that.latency999) return false;
        if (latency9999 != that.latency9999) return false;
        if (latency99999 != that.latency99999) return false;
        if (Double.compare(that.latencyMean, latencyMean) != 0) return false;
        if (startTime != that.startTime) return false;
        return endTime == that.endTime;

    }

    @Override
    public int hashCode() {
        int result;
        long temp;
        result = (int) (latencyMax ^ (latencyMax >>> 32));
        result = 31 * result + (int) (latency50 ^ (latency50 >>> 32));
        result = 31 * result + (int) (latency90 ^ (latency90 >>> 32));
        result = 31 * result + (int) (latency99 ^ (latency99 >>> 32));
        result = 31 * result + (int) (latency999 ^ (latency999 >>> 32));
        result = 31 * result + (int) (latency9999 ^ (latency9999 >>> 32));
        result = 31 * result + (int) (latency99999 ^ (latency99999 >>> 32));
        temp = Double.doubleToLongBits(latencyMean);
        result = 31 * result + (int) (temp ^ (temp >>> 32));
        result = 31 * result + (int) (startTime ^ (startTime >>> 32));
        result = 31 * result + (int) (endTime ^ (endTime >>> 32));
        return result;
    }

    @Override
    public String toString() {
        return "LatencySnapshot{" +
                "latencyMax=" + latencyMax +
                ", latency50=" + latency50 +
                ", latency90=" + latency90 +
                ", latency99=" + latency99 +
                ", latency999=" + latency999 +
                ", latency9999=" + latency9999 +
                ", latency99999=" + latency99999 +
                ", latencyMean=" + latencyMean +
                ", startTime=" + startTime +
                ", endTime=" + endTime +
                '}';
    }
}

@@ -2521,17 +2521,16 @@
 cyMax %5E 
-(
 latencyM
@@ -2531,33 +2531,32 @@
 tencyMax %3E%3E%3E 32)
-)
 ;%0A        result
@@ -2587,25 +2587,24 @@
 latency50 %5E 
-(
 latency50 %3E%3E
@@ -2600,33 +2600,32 @@
 atency50 %3E%3E%3E 32)
-)
 ;%0A        result
@@ -2660,17 +2660,16 @@
 ncy90 %5E 
-(
 latency9
@@ -2669,33 +2669,32 @@
 atency90 %3E%3E%3E 32)
-)
 ;%0A        result
@@ -2725,25 +2725,24 @@
 latency99 %5E 
-(
 latency99 %3E%3E
@@ -2738,33 +2738,32 @@
 atency99 %3E%3E%3E 32)
-)
 ;%0A        result
@@ -2795,25 +2795,24 @@
 atency999 %5E 
-(
 latency999 %3E
@@ -2809,33 +2809,32 @@
 tency999 %3E%3E%3E 32)
-)
 ;%0A        result
@@ -2867,25 +2867,24 @@
 tency9999 %5E 
-(
 latency9999 
@@ -2882,33 +2882,32 @@
 ency9999 %3E%3E%3E 32)
-)
 ;%0A        result
@@ -2945,17 +2945,16 @@
 99999 %5E 
-(
 latency9
@@ -2957,33 +2957,32 @@
 ncy99999 %3E%3E%3E 32)
-)
 ;%0A        temp =
@@ -3065,17 +3065,16 @@
 (temp %5E 
-(
 temp %3E%3E%3E
@@ -3069,33 +3069,32 @@
 p %5E temp %3E%3E%3E 32)
-)
 ;%0A        result
@@ -3129,17 +3129,16 @@
 tTime %5E 
-(
 startTim
@@ -3138,33 +3138,32 @@
 tartTime %3E%3E%3E 32)
-)
 ;%0A        result
@@ -3196,17 +3196,16 @@
 dTime %5E 
-(
 endTime 
@@ -3211,17 +3211,16 @@
  %3E%3E%3E 32)
-)
 ;%0A      

Update generated methods on LatencySnapshot