nicolasgramlich/AndEngine — pull request #208 by flomin (2013-04-10 16:18:33+00:00)
Title: Modifiers improved to be able to use them in more general pools :

This patch improves the modifiers to be able to use them in pools:
- reset methods taking a IEaseFunction as parameter added in BaseDoubleValueSpanModifier and BaseSingleValueSpanModifier classes
- IModifier.clearModifierListeners method added to able to clear all modifier listeners when the modifier goes back in the pool
- IModifier.onUnregister event method added to be able to recycle the modifier back to the pool easily
- ModifierList.clear, remove and onUpdate method overridden from super class to call onUnregister event on modifiers

With this patch it's possible to create and use a pool of modifiers like this:
```java
new GenericPool mMoveModifierPool = new GenericPool() {
@Override
protected MoveModifier onAllocatePoolItem() {
final MoveModifier lRes = new MoveModifier(0, 0, 0, 0, 0) {
@Override
public void onUnregister(final IEntity pItem) {
recyclePoolItem(this);
}
};
lRes.setAutoUnregisterWhenFinished(true);
return lRes;
}

@Override
protected void onHandleObtainItem(final MoveModifier pItem) {
pItem.clearModifierListeners();
}
};

final MoveModifier lMoveModifier = mMoveModifierPool.obtainPoolItem();
lMoveModifier.reset(aDuration, fromX, toX, fromY, toY, EaseStrongIn.getInstance());
lMoveModifier.addModifierListener(new IModifierListener() {
@Override public void onModifierStarted(final IModifier pModifier, final IEntity pItem) { }

@Override
public void onModifierFinished(final IModifier pModifier, final IEntity pItem) {
// do something
}
});
aShape.registerEntityModifier(lMoveModifier);
```