class AnalyticsUtils {

    public static <T> Map<String, T> convertDxToOperand( Map<String, T> valueMap, TotalType totalType )
    {
        Map<String, T> map = Maps.newHashMap();

        for ( Entry<String, T> entry : valueMap.entrySet() )
        {
            List<String> items = Lists.newArrayList( entry.getKey().split( DimensionalObject.DIMENSION_SEP ) );
            List<String> operands = Lists.newArrayList( items.subList( 0, totalType.getPropertyCount() + 1 ) );
            List<String> dimensions = Lists.newArrayList( items.subList( totalType.getPropertyCount() + 1, items.size() ) );

            // Add wild card in place of category option combination

            if ( TotalType.AOC_ONLY == totalType )
            {
                operands.add( 1, SYMBOL_WILDCARD );
            }

            String operand = StringUtils.join( operands, DimensionalObjectUtils.COMPOSITE_DIM_OBJECT_PLAIN_SEP );
            String dimension = StringUtils.join( dimensions, DimensionalObject.DIMENSION_SEP );
            dimension = !dimension.isEmpty() ? ( DimensionalObject.DIMENSION_SEP + dimension ) : StringUtils.EMPTY;
            String key = operand + dimension;

            map.put( key, entry.getValue() );
        }

        return map;
    }

}