Class DerivativeGauge<F,​T>

  • Type Parameters:
    F - the base gauge's value type
    T - the derivative type
    All Implemented Interfaces:
    Gauge<T>, Metric

    public abstract class DerivativeGauge<F,​T>
    extends java.lang.Object
    implements Gauge<T>
    A gauge whose value is derived from the value of another gauge.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Gauge<F> base  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected DerivativeGauge​(Gauge<F> base)
      Creates a new derivative with the given base gauge.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      T getValue()
      Returns the metric's current value.
      protected abstract T transform​(F value)
      Transforms the value of the base gauge to the value of this gauge.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • base

        private final Gauge<F> base
    • Constructor Detail

      • DerivativeGauge

        protected DerivativeGauge​(Gauge<F> base)
        Creates a new derivative with the given base gauge.
        Parameters:
        base - the gauge from which to derive this gauge's value
    • Method Detail

      • getValue

        public T getValue()
        Description copied from interface: Gauge
        Returns the metric's current value.
        Specified by:
        getValue in interface Gauge<F>
        Returns:
        the metric's current value
      • transform

        protected abstract T transform​(F value)
        Transforms the value of the base gauge to the value of this gauge.
        Parameters:
        value - the value of the base gauge
        Returns:
        this gauge's value