Class TopoUtils.ValueLabel

  • Enclosing class:

    public static class TopoUtils.ValueLabel
    extends Object
    Encapsulates a value to be used as a label.
    • Constructor Detail

      • ValueLabel

        public ValueLabel​(long value,
                          String unit)
        Creates a value label with the given base value and unit. For example:
         ValueLabel bits = new ValueLabel(2_050, "b");
         ValueLabel bytesPs = new ValueLabel(3_000_000, "B").perSec();
        Generating labels:
           bits.toString()     ...  "2.00 Kb"
           bytesPs.toString()  ...  "2.86 MBps"
        value - the base value
        unit - the value unit
    • Method Detail

      • perSec

        public TopoUtils.ValueLabel perSec()
        Mark this value to be expressed as a rate. That is, "ps" (per sec) will be appended in the string representation.
        self, for chaining
      • clipG

        public TopoUtils.ValueLabel clipG​(double threshold)
        Clips the (adjusted) value to the given threshold expressed in Giga units. That is, if the adjusted value exceeds the threshold, it will be set to the threshold value and the clipped flag will be set. For example,
         ValueLabel tooMuch = new ValueLabel(12_000_000_000, "b")
         tooMuch.toString()    ...  "10.00 Gbps"
         tooMuch.clipped()     ...  true
        threshold - the clip threshold (Giga)
        self, for chaining
      • clipped

        public boolean clipped()
        Returns true if this value was clipped to a maximum threshold.
        true if value was clipped
      • magnitude

        public TopoUtils.Magnitude magnitude()
        Returns the magnitude value.
        the magnitude