package com.atmob.gravity_engine;

import java.util.Map;

public class ParamsUtil {


    public static float getFloat(Map<String, Object> params, String param, float defaultValue) {
        if (params == null) {
            return defaultValue;
        }
        if (!params.containsKey(param)) {
            return defaultValue;
        }
        Object target = params.get(param);
        if (target == null) {
            return defaultValue;
        }
        if (target instanceof Float) {
            return (Float) target;
        }
        if (target instanceof Double) {
            return ((Double) target).floatValue();
        }
        return defaultValue;
    }
}
