APIs for merging costs

To merge two rate-scalable cost data objects together, use the mergeIfCostEqual method. If two cost data objects are adjacent in effective time and equal, then this method sets the expiration of the earlier cost to the expiration date of the later cost. The caller discards the later cost. Costs are equal if the isCostEqual method returns true. It checks that the two costs have the same basis, rates, and term amounts, along with a few other things.

To merge two basis-scalable cost data objects together, use the mergeAsBasisScalableIfCostEqual method. This method is similar to mergeIfCostEqual, but handles basis-scalable costs. However, this method is more complicated because merging basis-scalable costs requires adding together the basis and amount properties. Also, the criteria for equality are slightly looser, and defined by isBasisScalableCostEqual.