com.hazelcast.jet.accumulator

## Class LinTrendAccumulator

- java.lang.Object
- - com.hazelcast.jet.accumulator.LinTrendAccumulator

-     public final class LinTrendAccumulator
      extends Object

  Maintains the components needed to compute the linear regression on a set of `(long, long)` pairs. The intermediate results are held in the form of `BigInteger` and the finished value is a `double`-valued linear coefficient.
  Since:
    3.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LinTrendAccumulator()` Constructs a new accumulator with all components at zero.
    `LinTrendAccumulator(long n, BigInteger sumX, BigInteger sumY, BigInteger sumXY, BigInteger sumX2)` Creates a new accumulator with the given components.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `LinTrendAccumulator` | `accumulate(long x, long y)` Accumulates a new sample.
    `LinTrendAccumulator` | `combine(LinTrendAccumulator that)` Combines this accumulator with the supplied one.
    `LinTrendAccumulator` | `deduct(LinTrendAccumulator that)` Deducts the supplied accumulator from this one.
    `boolean` | `equals(Object obj)`
    `double` | `export()` Computes the linear coefficient of the linear regression of the accumulated samples.
    `int` | `hashCode()`
    `void` | `writeObject(ObjectDataOutput out)` Serializes this accumulator.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LinTrendAccumulator

          public LinTrendAccumulator()

      Constructs a new accumulator with all components at zero.

    - #### LinTrendAccumulator

          public LinTrendAccumulator(long n,
                                     BigInteger sumX,
                                     BigInteger sumY,
                                     BigInteger sumXY,
                                     BigInteger sumX2)

      Creates a new accumulator with the given components. Intended only for testing and deserialization.

  - ### Method Detail

    - #### accumulate

          public LinTrendAccumulator accumulate(long x,
                                                long y)

      Accumulates a new sample.

    - #### combine

          public LinTrendAccumulator combine(LinTrendAccumulator that)

      Combines this accumulator with the supplied one.

    - #### deduct

          public LinTrendAccumulator deduct(LinTrendAccumulator that)

      Deducts the supplied accumulator from this one.

    - #### export

          public double export()

      Computes the linear coefficient of the linear regression of the accumulated samples.

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### writeObject

          public void writeObject(ObjectDataOutput out)
                           throws IOException

      Serializes this accumulator.
      Throws:
        `IOException`

Copyright © 2020. All rights reserved.