@SafeVarargs public static <T, U, V> MapMap<T, U, V> ofEntries( Map.Entry<T, Map<U, V>>... entries ) { MapMap<T, U, V> map = new MapMap<>(); for ( Map.Entry<T, Map<U, V>> entry : entries ) { map.put( entry.getKey(), entry.getValue() ); } return map; } }
/** * Returns a mapping of permutations keys (org unit id or null) and mappings * of org unit group and counts, based on the given mapping of dimension option * keys and counts. */ public static Map<String, Map<String, Integer>> getPermutationOrgUnitGroupCountMap( Map<String, Double> orgUnitCountMap ) { MapMap<String, String, Integer> countMap = new MapMap<>(); for ( String key : orgUnitCountMap.keySet() ) { List<String> keys = Lists.newArrayList( key.split( DIMENSION_SEP ) ); // Org unit group always at last index, org unit potentially at first int ougInx = keys.size() - 1; String oug = keys.get( ougInx ); ListUtils.removeAll( keys, ougInx ); String permKey = StringUtils.trimToNull( StringUtils.join( keys, DIMENSION_SEP ) ); Integer count = orgUnitCountMap.get( key ).intValue(); countMap.putEntry( permKey, oug, count ); } return countMap; }
/** * Creates a mapping of permutation keys and mappings of data element operands * and values based on the given mapping of dimension option keys and * aggregated values. The data element dimension will be at index 0. * * @param aggregatedDataMap the aggregated data map. * @return a mapping of permutation keys and mappings of data element operands * and values. */ public static MapMap<String, DimensionalItemObject, Double> getPermutationDimensionalItemValueMap( Map<String, Double> aggregatedDataMap ) { MapMap<String, DimensionalItemObject, Double> permutationMap = new MapMap<>(); for ( String key : aggregatedDataMap.keySet() ) { List<String> keys = Lists.newArrayList( key.split( DIMENSION_SEP ) ); String dimItem = keys.get( DX_INDEX ); keys.remove( DX_INDEX ); BaseDimensionalItemObject dimItemObject = new BaseDimensionalItemObject( dimItem ); String permKey = StringUtils.join( keys, DIMENSION_SEP ); Double value = aggregatedDataMap.get( key ); permutationMap.putEntry( permKey, dimItemObject, value ); } return permutationMap; }
public MapMap<T, U, V> putEntry( S key1, T key2, U key3, V value ) { MapMap<T, U, V> map = this.get( key1 ); map = map == null ? new MapMap<>() : map; map.putEntry( key2, key3, value ); return this.put( key1, map ); }
public void putEntries( S key1, MapMap<T, U, V> m ) { MapMap<T, U, V> map = this.get( key1 ); map = map == null ? new MapMap<>() : map; map.putMap( m ); this.put( key1, map ); }
aocValues = new MapMap<>(); aocValues.putEntries( context.getDefaultAttributeCombo().getUid(), nonAocValues );
MapMap<Class<? extends IdentifiableObject>, String, IdentifiableObject> idMap = new MapMap<>();
nonAggregateDataMap.get( period ), new MapMap<>() );