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

io.hyperfoil.api.statistics.LongValue Maven / Gradle / Ivy

There is a newer version: 0.27
Show newest version
package io.hyperfoil.api.statistics;

public class LongValue implements CustomValue {
   private long value;

   public void add(int increment) {
      value += increment;
   }

   @Override
   public void add(CustomValue other) {
      value += val(other);
   }

   @Override
   public void substract(CustomValue other) {
      value -= val(other);
   }

   @Override
   public void reset() {
      value = 0;
   }

   @Override
   public CustomValue clone() {
      LongValue clone = new LongValue();
      clone.value = value;
      return clone;
   }

   private long val(CustomValue other) {
      if (other instanceof LongValue) {
         return ((LongValue) other).value;
      } else {
         throw new IllegalArgumentException(String.valueOf(other));
      }
   }

   public long value() {
      return value;
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy