public static float getFractionalResourceFromStores( StoreFlowRateControllable pDefinition, float amountNeeded,
public float getFractionalResourceFromStores(float amountNeeded,
    public static float getFractionalResourceFromStores(            StoreFlowRateControllable pDefinition, float amountNeeded,            float fraction) {        if (pDefinition.getStores() == null)            return 0f;        if (amountNeeded <= 0){        	Arrays.fill(pDefinition.getActualFlowRates(), 0f);        	return 0f;        }        float gatheredResource = 0f;        for (int i = 0; (i < pDefinition.getStores().length)                && (gatheredResource < amountNeeded); i++) {            float resourceToGatherFirst = Math.min(amountNeeded, pDefinition                    .getMaxFlowRate(i)                    * fraction);            float resourceToGatherFinal = Math.min(resourceToGatherFirst,                    pDefinition.getDesiredFlowRate(i) * fraction);            float grabbed = pDefinition.getStores()[i]                    .take(resourceToGatherFinal);            pDefinition.getActualFlowRates()[i] += grabbed;            gatheredResource += grabbed;        }        return gatheredResource;    }