Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • VALUE_1 - number of units inside bundle
  • VALUE_2 - number of units used
  • VALUE_3 - number of units, that can be rolled over
  • VALUE_4 - number of used rollover units

Updating

...

SubscriptionBundle

Standard update

The used units are accumulated on VALUE_2. When VALUE_2 is greater than VALUE_1 - VALUE_3, then VALUE_4 gets a new value calculated in the following way VALUE_2 - (VALUE_1 - VALUE_3). If VALUE_4 is greater than VALUE_3 then VALUE_3 is set.

Update through rollover

The usage is aggregated on both VALUE_1 and VALUE_4 until the maximum, defined by VALUE_3 is reached.

Bundle

If a bundle is supposed to be a rollover bundle, it is a requirement for it to implement RolloverBundle interface. The interface has five methods and two enumeration types:

...

One thing is worth to point out: a new method, for calculating the amount of free units on a SubscriptionBundle, has been introduced on the Bundle_ class . It is called getFreeUnits. This has happened, because the classical VALUE_1 - VALUE_2 is no longer valid, when surplus is used.

SurplusContainer

SurplusContainer is a wrapper object, that encapsulates a list of RolloverSurplus objects. It has two methods:

  • getSurplusValue returns sum of surplus for the whole period,
  • updateSurplus updates the whole surplus, through looping through the list of RolloverSurplus; returns the remainder from the last RolloverSurplus.updateSurplus.
    The class doesn't have a default constructor and can be only constructed by SurplusContainter(List<RolloverSurplus> surplusList). The list can be contructed with a helper class SurplusContainerFetcher.

Configuration

It is not enough for a bundle to juest implement the RolloverBundle interface to work. There should also be defined three aditional parameters: