org.jsmpp.util
Class SimpleCapacityPolicy

java.lang.Object
  extended by org.jsmpp.util.SimpleCapacityPolicy
All Implemented Interfaces:
CapacityPolicy

public class SimpleCapacityPolicy
extends java.lang.Object
implements CapacityPolicy

Simple implementation of CapacityPolicy.

The calculation looks like int newCapcity = (currentCapacity * 3) / 2 + 1 and it's only apply if currentCapacity is not greater or equals than requiredCapacity.

Author:
uudashr

Constructor Summary
SimpleCapacityPolicy()
           
 
Method Summary
 int ensureCapacity(int requiredCapacity, int currentCapacity)
          Ensuring the currentCapacity is save to accommodate new items that totally defined as requiredCapacity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleCapacityPolicy

public SimpleCapacityPolicy()
Method Detail

ensureCapacity

public int ensureCapacity(int requiredCapacity,
                          int currentCapacity)
Description copied from interface: CapacityPolicy
Ensuring the currentCapacity is save to accommodate new items that totally defined as requiredCapacity.

Specified by:
ensureCapacity in interface CapacityPolicy
Parameters:
requiredCapacity - is the required capacity.
currentCapacity - is the current capacity.
Returns:
the new save capacity.