Weight Computation

The weight calculation takes decay type into account, whether this decay is linear or half life.

Linear

This decay type is taken into account when quality declines linearly over a set period of time. For example, if decay is defined as ten months, in five months the weight becomes half of the initial quality. In ten months the weight becomes zero.

Example for the LINEAR decay type:
if ageOfDataInMillis > decayPeriodInMilliscomputedWeight = 0elsecomputedWeight = Math.round(given Weight * (1 - ((float) ageOfDataInMillis / (float) decayPeriodInMillis)))]
		

Half Life

With this decay type, the quality never becomes zero. It gets lower as more intervals expire. For example, if the decay has a half life of six months and the initial weight is 70, in six months the weight becomes 35. In another six months, the weight becomes 17, and so on.

Example for the HALFLIFE decay type:
[float n = ((float) ageOfDataInMillis / (float) decayPeriodInMillis);computedWeight = Math.round( (float)(given Weight / (Math.pow(2, n))))]

The following example shows how Precedence is applied:
  • If the old weight > the new weight, it reverts to the old data.
  • If the old weight <= the new weight, it continues with the new data.