Class QuantitySummaryStatistics<Q extends javax.measure.Quantity<Q>>

  • Type Parameters:
    Q -

    public class QuantitySummaryStatistics<Q extends javax.measure.Quantity<Q>>
    extends java.lang.Object
    Since:
    1.0
    Version:
    1.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private javax.measure.Quantity<Q> average  
      private long count  
      private javax.measure.Quantity<Q> empty  
      private javax.measure.Quantity<Q> max  
      private java.util.function.BinaryOperator<javax.measure.Quantity<Q>> maxFunctions  
      private javax.measure.Quantity<Q> min  
      private java.util.function.BinaryOperator<javax.measure.Quantity<Q>> minFunctions  
      private javax.measure.Quantity<Q> sum  
    • Constructor Summary

      Constructors 
      Constructor Description
      QuantitySummaryStatistics​(javax.measure.Unit<Q> unit)
      Creates a new instance, targeting the given Unit.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void accept​(javax.measure.Quantity<Q> quantity)
      Records another value into the summary information.
      QuantitySummaryStatistics<Q> combine​(QuantitySummaryStatistics<Q> quantitySummary)
      Combines the state of another QuantitySummaryStatistics into this one.
      private void doSummary​(javax.measure.Quantity<Q> moneraty)  
      boolean equals​(java.lang.Object obj)
      will equals when the unit were equals
      javax.measure.Quantity<Q> getAverage()
      Get the quantity average of all amounts added.
      javax.measure.Quantity<Q> getAverage​(javax.measure.Unit<Q> unit)
      Get the quantity average of all amounts added converted to unit
      long getCount()
      Get the number of items added to this summary instance.
      javax.measure.Quantity<Q> getMax()
      Get the maximal amount found within this summary.
      javax.measure.Quantity<Q> getMax​(javax.measure.Unit<Q> unit)
      Get the maximal amount found within this summary converted to unit
      javax.measure.Quantity<Q> getMin()
      Get the minimal quantity found within this summary.
      javax.measure.Quantity<Q> getMin​(javax.measure.Unit<Q> unit)
      Get the minimal quantity found within this summary converted to unit
      javax.measure.Quantity<Q> getSum()
      Get the sum of all amounts within this summary.
      javax.measure.Quantity<Q> getSum​(javax.measure.Unit<Q> unit)
      Get the sum of all amounts within this summary converted to unit
      int hashCode()  
      private boolean isEmpty()  
      private void setQuantity​(javax.measure.Quantity<Q> quantity)  
      QuantitySummaryStatistics<Q> to​(javax.measure.Unit<Q> unit)
      convert the summary to this unit measure
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • empty

        private final javax.measure.Quantity<Q extends javax.measure.Quantity<Q>> empty
      • count

        private long count
      • min

        private javax.measure.Quantity<Q extends javax.measure.Quantity<Q>> min
      • max

        private javax.measure.Quantity<Q extends javax.measure.Quantity<Q>> max
      • sum

        private javax.measure.Quantity<Q extends javax.measure.Quantity<Q>> sum
      • average

        private javax.measure.Quantity<Q extends javax.measure.Quantity<Q>> average
      • minFunctions

        private final java.util.function.BinaryOperator<javax.measure.Quantity<Q extends javax.measure.Quantity<Q>>> minFunctions
      • maxFunctions

        private final java.util.function.BinaryOperator<javax.measure.Quantity<Q extends javax.measure.Quantity<Q>>> maxFunctions
    • Constructor Detail

      • QuantitySummaryStatistics

        QuantitySummaryStatistics​(javax.measure.Unit<Q> unit)
        Creates a new instance, targeting the given Unit.
        Parameters:
        unit - the target unit, not null.
    • Method Detail

      • accept

        public void accept​(javax.measure.Quantity<Q> quantity)
        Records another value into the summary information.
        Parameters:
        quantity - the input quantity value to be added, not null.
      • doSummary

        private void doSummary​(javax.measure.Quantity<Q> moneraty)
      • isEmpty

        private boolean isEmpty()
      • setQuantity

        private void setQuantity​(javax.measure.Quantity<Q> quantity)
      • getCount

        public long getCount()
        Get the number of items added to this summary instance.
        Returns:
        the number of summarized items, >= 0.
      • getMin

        public javax.measure.Quantity<Q> getMin()
        Get the minimal quantity found within this summary.
        Returns:
        the minimal quantity
      • getMin

        public javax.measure.Quantity<Q> getMin​(javax.measure.Unit<Q> unit)
        Get the minimal quantity found within this summary converted to unit
        Parameters:
        unit - to convert
        Returns:
        the minimal quantity converted to this unit
      • getMax

        public javax.measure.Quantity<Q> getMax()
        Get the maximal amount found within this summary.
        Returns:
        the maximal quantity
      • getMax

        public javax.measure.Quantity<Q> getMax​(javax.measure.Unit<Q> unit)
        Get the maximal amount found within this summary converted to unit
        Parameters:
        unit - to convert
        Returns:
        the maximal quantity converted to this unit
      • getSum

        public javax.measure.Quantity<Q> getSum()
        Get the sum of all amounts within this summary.
        Returns:
        the total amount
      • getSum

        public javax.measure.Quantity<Q> getSum​(javax.measure.Unit<Q> unit)
        Get the sum of all amounts within this summary converted to unit
        Parameters:
        unit - to convert
        Returns:
        the total amount converted to this unit
      • getAverage

        public javax.measure.Quantity<Q> getAverage()
        Get the quantity average of all amounts added.
        Returns:
        the quantity average quantity
      • getAverage

        public javax.measure.Quantity<Q> getAverage​(javax.measure.Unit<Q> unit)
        Get the quantity average of all amounts added converted to unit
        Parameters:
        unit - to convert
        Returns:
        the average quantity converted to this unit
      • to

        public QuantitySummaryStatistics<Q> to​(javax.measure.Unit<Q> unit)
        convert the summary to this unit measure
        Parameters:
        unit - to convert the summary
        Returns:
        the summary converted to this unit
      • equals

        public boolean equals​(java.lang.Object obj)
        will equals when the unit were equals
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object