io.quarkus.redis.datasource.timeseries.Sample Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-redis-client Show documentation
Show all versions of quarkus-redis-client Show documentation
Connect to Redis in either imperative or reactive style
package io.quarkus.redis.datasource.timeseries;
import static io.smallrye.mutiny.helpers.ParameterValidation.positiveOrZero;
import java.util.Objects;
/**
* Represents a sample from a time series
*/
public class Sample {
public final long timestamp;
public final double value;
public Sample(long timestamp, double value) {
this.timestamp = positiveOrZero(timestamp, "timestamp");
this.value = value;
}
public long timestamp() {
return timestamp;
}
public double value() {
return value;
}
@Override
public String toString() {
return "Sample{" +
"timestamp=" + timestamp +
", value=" + value +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
Sample sample = (Sample) o;
return timestamp == sample.timestamp && Double.compare(sample.value, value) == 0;
}
@Override
public int hashCode() {
return Objects.hash(timestamp, value);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy