class AnalyticsUtils {

    public static Number getRoundedValue( DataQueryParams params, Integer decimals, Double value )
    {
        if ( value == null )
        {
            return value;
        }
        else if ( params.isSkipRounding() )
        {
            return Precision.round( value, DECIMALS_NO_ROUNDING );
        }
        else if ( decimals != null && decimals > 0 )
        {
            return Precision.round( value, decimals );
        }
        else if ( decimals != null && decimals == 0 )
        {
            return Math.round( value );
        }
        else
        {
            return MathUtils.getRounded( value );
        }
    }

}