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 ) ; } } }
Gather the sum of all possible value combinations of the partial crosstabs