code: private void addGroupSet(AggregateResult aggResult, GroupSetEntry groupSetEntry, boolean compound) {
          AggregateResult.AggGroupSet aggGroupSet = aggResult.addGroupSet();
          if (compound) { // set grouping-param, metric-param, or groupset-value for compound aggregates only
              if (m_metricPaths.length > 1) // set metric-param for multi-metrics aggregates only
                  aggGroupSet.setMetricParam(groupSetEntry.m_metricPath.metric.sourceText);
              if (groupSetEntry.m_groupPathsParam != null) {
                  aggGroupSet.setGroupingParam(groupSetEntry.m_groupPathsParam);
              }
              aggGroupSet.setGroupsetValue(groupSetEntry.m_totalGroup.getMetricValue()); // "value" or "summary"
          }
          
          if (groupSetEntry.m_totalGroup.m_subgroups != null) {
              for (Group group : groupSetEntry.m_totalGroup.subgroups(groupSetEntry.m_groupPaths[0].groupOutputParameters)) {
                  addGroup(aggGroupSet, group, groupSetEntry, 0);
              }
              if (groupSetEntry.m_isComposite && groupSetEntry.m_compositeGroup.m_subgroups != null) {
                  addCompositeGroup(aggGroupSet, groupSetEntry.m_compositeGroup, groupSetEntry, groupSetEntry.m_groupPaths[0].path, groupSetEntry.m_groupPaths.length - 1);
              }
          }
          if (groupSetEntry.m_totalGroup.m_subgroups != null && groupSetEntry.m_groupPaths[0].groupOutputParameters.count != 0) {
              aggGroupSet.setTotalGroups(groupSetEntry.m_totalGroup.m_subgroups.size());
          }
      }
docs: toDoc