Gather the sum of all possible value combinations of the partial
crosstabs

@param valueCombMapList
@param partialCrosstab
961635
public void addValueCombinationsCrosstabDimension(final Map<ValueCombination<Number>, Number> valueCombMapList,
            final Crosstab<Number> partialCrosstab) {

        final CrosstabNavigator<Number> nav = new CrosstabNavigator<>(partialCrosstab);
        final CrosstabDimension columnDimension = partialCrosstab.getDimension(BooleanAnalyzer.DIMENSION_COLUMN);
        final CrosstabDimension measureDimension = partialCrosstab.getDimension(BooleanAnalyzer.DIMENSION_MEASURE);

        final List<String> columnDimCategories = columnDimension.getCategories();
        final List<String> measureCategories = measureDimension.getCategories();

        for (final String measureCategory : measureCategories) {
            final Number[] values = new Number[columnDimCategories.size() - 1];
            for (int i = 0; i < columnDimCategories.size() - 1; i++) {
                nav.where(columnDimension, columnDimCategories.get(i));
                final CrosstabNavigator<Number> where = nav.where(measureDimension, measureCategory);
                final Number value = where.safeGet(null);
                if (!columnDimCategories.get(0).equals(BooleanAnalyzer.VALUE_COMBINATION_COLUMN_FREQUENCY)) {
                    values[i] = value;
                }
            }

            final CrosstabNavigator<Number> where =
                    nav.where(columnDimension, BooleanAnalyzer.VALUE_COMBINATION_COLUMN_FREQUENCY);
            final Number frequency = where.safeGet(null);
            final Number frequencyVal = frequency != null ? frequency : 0;
            final ValueCombination<Number> valComb = new ValueCombination<>(values);
            final Number combination = valueCombMapList.get(valComb);
            if (combination == null) {
                valueCombMapList.put(valComb, frequencyVal);
            } else {
                final Number newValue = CrosstabReducerHelper.sum(combination, frequencyVal);
                valueCombMapList.put(valComb, newValue);
            }
        }
    }
507260
public static <K, V> void forEachKeyValue(
            Map<K, V> map,
            Procedure2<? super K, ? super V> procedure,
            Executor executor)
    {
        ParallelMapIterate.forEachKeyValue(map, procedure, 2, map.size(), executor);
    }
1266446
private static int mergeSameBuckets(double[] values, double[] weights, int nextIndex)
    {
        sort(values, weights, nextIndex);

        int current = 0;
        for (int i = 1; i < nextIndex; i++) {
            if (values[current] == values[i]) {
                weights[current] += weights[i];
            }
            else {
                current++;
                values[current] = values[i];
                weights[current] = weights[i];
            }
        }
        return current + 1;
    }
227706
def sum_combined_sp_values(self, other):
        
        if self.values is None:
            ret = IdValues()
        else:
            ret = IdValues({'0': sum(int(x) for x in
                                     {k: int(v) * int(other.values[k]) for k, v
                                      in self.values.items()}.values())})
        return ret
364321
public static <K, V> MutableMap<K, V> selectMapOnValue(Map<K, V> map, final Predicate<? super V> predicate)
    {
        MutableMap<K, V> resultMap = UnifiedMap.newMap();
        final Procedure2<K, V> mapTransferProcedure = new MapPutProcedure<K, V>(resultMap);
        Procedure2<K, V> procedure = new Procedure2<K, V>()
        {
            public void value(K key, V value)
            {
                if (predicate.accept(value))
                {
                    mapTransferProcedure.value(key, value);
                }
            }
        };
        MapIterate.forEachKeyValue(map, procedure);
        return resultMap;
    }
328993
public static <K, V> UnifiedSetMultimap<V, K> flip(SetMultimap<K, V> setMultimap)
    {
        final UnifiedSetMultimap<V, K> result = new UnifiedSetMultimap<V, K>();
        setMultimap.forEachKeyMultiValues(new Procedure2<K, Iterable<V>>()
        {
            public void value(final K key, Iterable<V> values)
            {
                Iterate.forEach(values, new Procedure<V>()
                {
                    public void value(V value)
                    {
                        result.put(value, key);
                    }
                });
            }
        });
        return result;
    }
971433
public static void mergeInto(Map<String, Accumulator<?, ?>> target, Map<String, Accumulator<?, ?>> toMerge) {
		for (Map.Entry<String, Accumulator<?, ?>> otherEntry : toMerge.entrySet()) {
			Accumulator<?, ?> ownAccumulator = target.get(otherEntry.getKey());
			if (ownAccumulator == null) {
				// Take over counter from chained task
				target.put(otherEntry.getKey(), otherEntry.getValue());
			} else {
				// Both should have the same type
				AccumulatorHelper.compareAccumulatorTypes(otherEntry.getKey(),
						ownAccumulator.getClass(), otherEntry.getValue().getClass());
				// Merge counter from chained task into counter from stub
				mergeSingle(ownAccumulator, otherEntry.getValue());
			}
		}
	}
95096
private void checkAmbiguousValues(Option o, Map<String, String> data) throws RequiredParametersException{
		if (data.containsKey(o.getAlt()) && !Objects.equals(data.get(o.getAlt()), ParameterTool.NO_VALUE_KEY)) {
			throw new RequiredParametersException("Value passed for parameter " + o.getName() +
					" is ambiguous. Value passed for short and long name.");
		}
	}
625559
private void appendMap(MapTile other, int offsetX, int offsetY)
    {
        for (int v = 0; v < other.getInTileHeight(); v++)
        {
            final int ty = offsetY + v;
            for (int h = 0; h < other.getInTileWidth(); h++)
            {
                final int tx = offsetX + h;
                final Tile tile = other.getTile(h, v);
                if (tile != null)
                {
                    final double x = tx * (double) map.getTileWidth();
                    final double y = ty * (double) map.getTileHeight();
                    map.setTile(map.createTile(tile.getSheet(), tile.getNumber(), x, y));
                }
            }
        }
    }
64524
public static Map.Entry<Object, Object> selectMinKeyValue(AssociativeArray keyValueMap) {
        Double minValue=Double.POSITIVE_INFINITY;
        Object minValueKey = null;
        
        for(Map.Entry<Object, Object> entry : keyValueMap.entrySet()) {
            Double value = TypeInference.toDouble(entry.getValue());
            if(value!=null && value<minValue) {
                minValue=value;
                minValueKey=entry.getKey();
            }
        }
        
        return new AbstractMap.SimpleEntry<>(minValueKey, keyValueMap.get(minValueKey));
    }
117568
public void mergeWith(UnconditionalValueDerefSet fact, @CheckForNull ValueNumber skipMe, ValueNumberFactory valueNumberFactory) {
        if (UnconditionalValueDerefAnalysis.DEBUG) {
            System.out.println("merge update of # " + System.identityHashCode(this) + " from " + System.identityHashCode(fact));
            System.out.println("update " + this);
            System.out.println("with " + fact);

        }
        boolean resultForSkippedValue = false;
        if (skipMe != null) {
            resultForSkippedValue = valueNumbersUnconditionallyDereferenced.get(skipMe.getNumber());
        }
        // Compute the intersection of the unconditionally dereferenced value
        // sets
        valueNumbersUnconditionallyDereferenced.and(fact.valueNumbersUnconditionallyDereferenced);
        if (skipMe != null) {
            valueNumbersUnconditionallyDereferenced.set(skipMe.getNumber(), resultForSkippedValue);
        }

        // For each unconditionally dereferenced value...
        for (int i = 0; i < numValueNumbersInMethod; i++) {
            ValueNumber vn = valueNumberFactory.forNumber(i);
            if (vn.equals(skipMe)) {
                continue;
            }
            Set<Location> factDerefLocationSet = fact.derefLocationSetMap.get(vn);
            if (valueNumbersUnconditionallyDereferenced.get(i)) {
                if (factDerefLocationSet != null && !factDerefLocationSet.isEmpty()) {
                    // Compute the union of the dereference locations for
                    // this value number.
                    Set<Location> derefLocationSet = derefLocationSetMap.get(vn);
                    if (derefLocationSet == null) {
                        derefLocationSet = new HashSet<>();
                        derefLocationSetMap.put(vn, derefLocationSet);
                    }
                    derefLocationSet.addAll(fact.derefLocationSetMap.get(vn));
                }
            } else {
                Set<Location> removed = derefLocationSetMap.remove(vn);
                // The value number is not in the fact:
                // remove its location set
                if (removed != null) {
                    if (UnconditionalValueDerefAnalysis.DEBUG) {
                        System.out.println("Goodbye: " + removed);
                    }
                }
            }
        }
    }
662665
private void setExpressionForPrecalculatedTotalValue(
			DJCrosstabColumn[] auxCols, DJCrosstabRow[] auxRows, JRDesignExpression measureExp, DJCrosstabMeasure djmeasure,
			DJCrosstabColumn crosstabColumn, DJCrosstabRow crosstabRow, String meausrePrefix) {

		String rowValuesExp = "new Object[]{";
		String rowPropsExp = "new String[]{";
		for (int i = 0; i < auxRows.length; i++) {
			if (auxRows[i].getProperty()== null)
				continue;
			rowValuesExp += "$V{" + auxRows[i].getProperty().getProperty() +"}";
			rowPropsExp += "\"" + auxRows[i].getProperty().getProperty() +"\"";
			if (i+1<auxRows.length && auxRows[i+1].getProperty()!= null){
				rowValuesExp += ", ";
				rowPropsExp += ", ";
			}
		}
		rowValuesExp += "}";
		rowPropsExp += "}";

		String colValuesExp = "new Object[]{";
		String colPropsExp = "new String[]{";
		for (int i = 0; i < auxCols.length; i++) {
			if (auxCols[i].getProperty()== null)
				continue;
			colValuesExp += "$V{" + auxCols[i].getProperty().getProperty() +"}";
			colPropsExp += "\"" + auxCols[i].getProperty().getProperty() +"\"";
			if (i+1<auxCols.length && auxCols[i+1].getProperty()!= null){
				colValuesExp += ", ";
				colPropsExp += ", ";
			}
		}
		colValuesExp += "}";
		colPropsExp += "}";

		String measureProperty = meausrePrefix + djmeasure.getProperty().getProperty();
		String expText = "((("+DJCRosstabMeasurePrecalculatedTotalProvider.class.getName()+")$P{crosstab-measure__"+measureProperty+"_totalProvider}).getValueFor( "
		+ colPropsExp +", "
		+ colValuesExp +", "
		+ rowPropsExp
		+ ", "
		+ rowValuesExp
		+" ))";

		if (djmeasure.getValueFormatter() != null){

			String fieldsMap = ExpressionUtils.getTextForFieldsFromScriptlet();
			String parametersMap = ExpressionUtils.getTextForParametersFromScriptlet();
			String variablesMap = ExpressionUtils.getTextForVariablesFromScriptlet();

			String stringExpression = "((("+DJValueFormatter.class.getName()+")$P{crosstab-measure__"+measureProperty+"_vf}).evaluate( "
				+ "("+expText+"), " + fieldsMap +", " + variablesMap + ", " + parametersMap +" ))";

			measureExp.setText(stringExpression);
			measureExp.setValueClassName(djmeasure.getValueFormatter().getClassName());
		} else {

//			String expText = "((("+DJCRosstabMeasurePrecalculatedTotalProvider.class.getName()+")$P{crosstab-measure__"+djmeasure.getProperty().getProperty()+"_totalProvider}).getValueFor( "
//			+ colPropsExp +", "
//			+ colValuesExp +", "
//			+ rowPropsExp
//			+ ", "
//			+ rowValuesExp
//			+" ))";
//
			log.debug("text for crosstab total provider is: " + expText);

			measureExp.setText(expText);
//			measureExp.setValueClassName(djmeasure.getValueFormatter().getClassName());
			String valueClassNameForOperation = ExpressionUtils.getValueClassNameForOperation(djmeasure.getOperation(),djmeasure.getProperty());
			measureExp.setValueClassName(valueClassNameForOperation);
		}

	}
1169935
private void mergeMappings(TypeMap<?, ?> destinationMap) {
    for (Mapping mapping : destinationMap.getMappings()) {
      InternalMapping internalMapping = (InternalMapping) mapping;
      mergedMappings.add(internalMapping.createMergedCopy(
          propertyNameInfo.getSourceProperties(), propertyNameInfo.getDestinationProperties()));
    }
  }
866271
private void convertMapToMap(Map<?, ?> srcMap, Map<Object, Object> targetMap) {
		final ConverterRegistry convert = ConverterRegistry.getInstance();
		Object key;
		Object value;
		for (Entry<?, ?> entry : srcMap.entrySet()) {
			key = TypeUtil.isUnknow(this.keyType) ? entry.getKey() : convert.convert(this.keyType, entry.getKey());
			value = TypeUtil.isUnknow(this.valueType) ? entry.getValue() : convert.convert(this.valueType, entry.getValue());
			targetMap.put(key, value);
		}
	}
901457
@Override
	public void setValueMap(Map<java.util.Locale, String> valueMap) {
		_cpDefinitionSpecificationOptionValue.setValueMap(valueMap);
	}
432363
public void setCurrenciesSubjectToCrossCcyForT1(final Map<String, Set<String>> currenciesSubjectToCrossCcyForT1) {
        final Map<String, Set<String>> copy = new HashMap<>();
        if (currenciesSubjectToCrossCcyForT1 != null) {
            copy.putAll(currenciesSubjectToCrossCcyForT1);
        }
        this.currenciesSubjectToCrossCcyForT1 = copy;
    }
730130
public static <I, O> void crossProduct(List<I> left, List<I> right, Function<I, List<O>> transformer, BiConsumer<Pair<Integer, Integer>, List<O>> rowConsumer) {
        final int SIZE = left.size() * right.size();

        for (int i = 0; i < SIZE; i++) {
            List<O> newRowValues = new ArrayList<>();
            int j = 1;
            List<Integer> currentIndexes = new ArrayList<>();
            for (List<I> rowsList : new ArrayList<List<I>>() {
                {
                    add(left);
                    add(right);
                }
            }) {
                final int index = ( i / j ) % rowsList.size();
                currentIndexes.add(index);
                I row = rowsList.get(index);
                List<O> rowPart = transformer.apply(row);
                newRowValues.addAll(rowPart);
                j *= rowsList.size();
            }
            if (currentIndexes.size() == 2) {
                rowConsumer.accept(new Pair<>(currentIndexes.get(0), currentIndexes.get(1)), newRowValues);
            }
        }
    }