Prepares a precomputed matrix - map of maps of maps: rowTag -> boxTag -> project -> placement label -> TechUsageStatSum.

@param appBeingSummarized Sum the statistics only for this project.
541859
public TechStatsMatrix getTechStatsMap(ProjectModel appBeingSummarized)
    {

        Map<String, Map<String, Map<Long, Map<String, TechUsageStatSum>>>> map = new HashMap<>();

        final Iterable<TechnologyUsageStatisticsModel> statModels = graphContext.service(TechnologyUsageStatisticsModel.class).findAll();
        for (TechnologyUsageStatisticsModel stat : statModels)
        {
            //If a stat doesn't apply to this project we move on to the next stat without further processing
            if (appBeingSummarized != null)
            {
                boolean appIsContainedInStatProject = stat.getProjectModel().getApplications().contains(appBeingSummarized);
                boolean appIsASharedLibrary = appBeingSummarized.getName().toLowerCase().contains("shared");
                boolean statAppliesToSeveralApps = stat.getProjectModel().getApplications().size() > 1;
                if(!appIsContainedInStatProject || (statAppliesToSeveralApps && !appIsASharedLibrary))
                {
                    LOG.fine("\t\tThis stat is not for this project, skipping.");
                    continue;
                }
            }

            final Set<String> placementTags = TechReportService.getPlacementTags(graphContext, stat.getTags());
            TechReportService.TechReportPlacement placement = TechReportService.processPlaceLabels(graphContext, placementTags);
            if (placement.box == null || placement.row == null)
            {
                LOG.severe(String.format("\tPlacement labels not recognized, placement incomplete: %s; stat: %s", placement, stat));
                continue;
            }

            placement = TechReportService.normalizePlacement(graphContext, placement);

            if (placement.box == null || placement.row == null)
            {
                LOG.severe(String.format("\tPlacement labels not recognized, placement incomplete: %s; stat: %s", placement, stat));
                continue;
            }

            // For boxes report - show each tech in sector, row, box. A sum for all projects.
            mergeToTheRightCell(map, placement.row.getName(), placement.box.getName(), 0L, stat.getName(), stat, false);
            // For the punch card report - maximum count for each box.
            mergeToTheRightCell(map, "", placement.box.getName(), 0L, "", stat, true);

            List<Long> appsToCountTowards;
            if (appBeingSummarized == null)
            {
                appsToCountTowards = StreamSupport.stream(stat.getProjectModel().getApplications().spliterator(), false)
                            .map(ProjectModel::getElement)
                            .map(Vertex::id)
                            .map(Long.class::cast)
                            .collect(toList());
            }
            else
            {
                appsToCountTowards = Collections.singletonList(appBeingSummarized.getId());
            }

            boolean isSharedApp = appsToCountTowards.size() > 1;
            List<ProjectModel> apps = stat.getProjectModel().getApplications();
            List<ProjectModel>sharedApps = apps.stream().filter(app -> app.getName().toLowerCase().contains("shared")).collect(toList());


            for (Long appToCountTowards : appsToCountTowards)
            {
                if(isSharedApp)
                {
                    if(!sharedApps.stream().anyMatch(app -> app.getElement().id().equals(appToCountTowards)))
                    {
                        continue;
                    }
                }

                // For boxes report - show each tech in sector, row, box. For individual projects.
                mergeToTheRightCell(map, placement.row.getName(), placement.box.getName(), appToCountTowards, stat.getName(), stat, false);

                // For the punch card report - roll up rows and individual techs.
                mergeToTheRightCell(map, "", placement.box.getName(), appToCountTowards, "", stat, false);
            }
        }

        return new TechStatsMatrix(map);
    }
151322
public CrosstabBuilder useMainReportDatasource(boolean preSorted) {
		DJDataSource datasource = new DJDataSource("ds",DJConstants.DATA_SOURCE_ORIGIN_REPORT_DATASOURCE,DJConstants.DATA_SOURCE_TYPE_JRDATASOURCE);
		datasource.setPreSorted(preSorted);
		crosstab.setDatasource(datasource);
		return this;
	}
850977
private void buildInheritedSummary(MemberSummaryWriter writer,
            VisibleMemberMap visibleMemberMap, LinkedList<Content> summaryTreeList) {
        for (TypeElement inhclass : visibleMemberMap.getVisibleClasses()) {
            if (!(utils.isPublic(inhclass) || utils.isLinkable(inhclass))) {
                continue;
            }
            if (inhclass == typeElement) {
                continue;
            }
            SortedSet<Element> inhmembers = asSortedSet(visibleMemberMap.getMembers(inhclass));
            if (!inhmembers.isEmpty()) {
                Content inheritedTree = writer.getInheritedSummaryHeader(inhclass);
                Content linksTree = writer.getInheritedSummaryLinksTree();
                for (Element member : inhmembers) {
                    TypeElement t= inhclass;
                    if (utils.isPackagePrivate(inhclass) && !utils.isLinkable(inhclass)) {
                        t = typeElement;
                    }
                    writer.addInheritedMemberSummary(t, member, inhmembers.first() == member,
                            inhmembers.last() == member, linksTree);
                }
                inheritedTree.addContent(linksTree);
                summaryTreeList.add(writer.getMemberTree(inheritedTree));
            }
        }
    }
281243
protected void notifyServiceSummaryUpdate(ServiceSummary serviceSummary) throws ActivityException {
        WorkflowServices wfs = ServiceLocator.getWorkflowServices();
        try {
            wfs.notify("service-summary-update-" + getMasterRequestId(), null, 2);
        } catch (ServiceException e) {
            throw new ActivityException("Cannot publish Service Summary update event", e);
        }
    }
1131607
private synchronized void buildMaps() {
    if (loggedTaskMap == null) {
      loggedTaskMap = new HashMap<TaskID, LoggedTask>();
      loggedTaskAttemptMap = new HashMap<TaskAttemptID, LoggedTaskAttempt>();
      
      for (LoggedTask map : job.getMapTasks()) {
        map = sanitizeLoggedTask(map);
        if (map != null) {
          loggedTaskMap.put(maskTaskID(TaskID.forName(map.taskID)), map);

          for (LoggedTaskAttempt mapAttempt : map.getAttempts()) {
            mapAttempt = sanitizeLoggedTaskAttempt(mapAttempt);
            if (mapAttempt != null) {
              TaskAttemptID id = TaskAttemptID.forName(mapAttempt
                  .getAttemptID());
              loggedTaskAttemptMap.put(maskAttemptID(id), mapAttempt);
            }
          }
        }
      }
      for (LoggedTask reduce : job.getReduceTasks()) {
        reduce = sanitizeLoggedTask(reduce);
        if (reduce != null) {
          loggedTaskMap.put(maskTaskID(TaskID.forName(reduce.taskID)), reduce);

          for (LoggedTaskAttempt reduceAttempt : reduce.getAttempts()) {
            reduceAttempt = sanitizeLoggedTaskAttempt(reduceAttempt);
            if (reduceAttempt != null) {
              TaskAttemptID id = TaskAttemptID.forName(reduceAttempt
                  .getAttemptID());
              loggedTaskAttemptMap.put(maskAttemptID(id), reduceAttempt);
            }
          }
        }
      }

      // TODO: do not care about "other" tasks, "setup" or "clean"
    }
  }
628681
public void setApplicationSummaries(java.util.Collection<ApplicationSummary> applicationSummaries) {
        if (applicationSummaries == null) {
            this.applicationSummaries = null;
            return;
        }

        this.applicationSummaries = new java.util.ArrayList<ApplicationSummary>(applicationSummaries);
    }
400984
public void setSummary( final CharSequence summary) {
		if ( summary != null) format.getHeader().createEntry( SUMMARY, summary);
	}
947617
@Override
    public Map<Object, Object> getSwappableData() {
        if (mSwappableData == null) {
            mSwappableData = new ConcurrentHashMap<Object, Object>();
            if (isNew()) {
                //if this is a new session, then we have the updated app data
                populatedAppData = true;
            }
        }
        return mSwappableData;
    }
1289256
public void buildAllStatistics() {
		for (Map<String,?> map : daoService.getAppsAndCountsToTreat()) {
			// get the date of older SMS for this app and account
			final Application application = (Application) map.get(Sms.PROP_APP);
			final Account account = (Account) map.get(Sms.PROP_ACC);
			final Date olderSmsDate = daoService.getDateOfOlderSmsByApplicationAndAccount(application, account);
			// if there is not at least 1 sms in db for the specified app / account, the 
			// previous method returns null, so we have to check it.
			if (olderSmsDate != null) {
				// get the list of month where stats was not computed since the date of the older SMS in DB
				for (Date monthToComputeStats : getListOfMarkerDateForNonComputedStats(application, account, olderSmsDate)) {
					// compute the stats for this specific app, account and month
					buildStatisticForAMonth(application, account, monthToComputeStats);
				}
			}

		}
	}
726858
public void buildPackageHeader(XMLNode node, Content summariesTree) {
        PackageElement abbrevPkg = configuration.workArounds.getAbbreviatedPackageElement(currentPackage);
        if (!printedPackageHeaders.contains(abbrevPkg)) {
            writer.addPackageName(currentPackage, summariesTree, first);
            printedPackageHeaders.add(abbrevPkg);
        }
    }
1370803
protected void showSummary(MavenProject mp, Dependency[] dependencies) {
        if (showSummary) {
            DependencyCheckScanAgent.showSummary(mp.getName(), dependencies);
        }
    }
312169
public void buildSummary(XMLNode node, Content packageContentTree) {
        Content summaryContentTree = packageWriter.getSummaryHeader();
        buildChildren(node, summaryContentTree);
        packageContentTree.addContent(summaryContentTree);
    }
968556
public static StatisticsMatrix wrap( DMatrixRMaj m ) {
        StatisticsMatrix ret = new StatisticsMatrix();
        ret.setMatrix( m );

        return ret;
    }
200503
public static IntSummary of(final IntSummaryStatistics statistics) {
		return new IntSummary(
			statistics.getCount(),
			statistics.getMin(),
			statistics.getMax(),
			statistics.getSum(),
			statistics.getAverage()
		);
	}
106470
function AggregateByKey(sc, dependencies, reducer, combiner, init, args) {
  Dataset.call(this, sc, dependencies);
  this.combiner = combiner;
  this.reducer = reducer;
  this.init = init;
  this.args = args;
  this.shuffling = true;
  this.executed = false;
  this.buffer = {};
  this.type = 'AggregateByKey';
}
84117
public void buildInterfaceSummary(XMLNode node, Content summaryContentTree) {
        String interfaceTableSummary =
                configuration.getText("doclet.Member_Table_Summary",
                configuration.getText("doclet.Interface_Summary"),
                configuration.getText("doclet.interfaces"));
        List<String> interfaceTableHeader = Arrays.asList(configuration.getText("doclet.Interface"),
        configuration.getText("doclet.Description"));

        SortedSet<TypeElement> ilist = utils.isSpecified(packageElement)
                        ? utils.getTypeElementsAsSortedSet(utils.getInterfaces(packageElement))
                        : configuration.typeElementCatalog.interfaces(packageElement);
        SortedSet<TypeElement> interfaces = utils.filterOutPrivateClasses(ilist, configuration.javafx);
        if (!interfaces.isEmpty()) {
            packageWriter.addClassesSummary(interfaces,
                    configuration.getText("doclet.Interface_Summary"),
                    interfaceTableSummary, interfaceTableHeader, summaryContentTree);
        }
    }
401947
public static Map<String, Object> getAppstatsDataFor(String appstatsId, Integer maxStackFrames)
  {
    Map<String, Object> appstatsMap = null;
    MemcacheWriter writer = new MemcacheWriter(null, MemcacheServiceFactory.getMemcacheService("__appstats__"));
    StatsProtos.RequestStatProto appstats;
    try
    {
      appstats = writer.getFull(Long.parseLong(appstatsId));
    } catch (NumberFormatException e)
    {
      return appstatsMap;
    }
    if (appstats != null)
    {
      appstatsMap = new HashMap<String, Object>();
      appstatsMap.put("totalTime", appstats.getDurationMilliseconds());

      Map<String, Map<String, Object>> rpcInfoMap = new LinkedHashMap<String, Map<String, Object>>();
      for (AggregateRpcStatsProto rpcStat : appstats.getRpcStatsList())
      {
        Map<String, Object> rpcInfo = rpcInfoMap.get(rpcStat.getServiceCallName());
        if (rpcInfo == null)
        {
          rpcInfo = new LinkedHashMap<String, Object>();
          rpcInfoMap.put(rpcStat.getServiceCallName(), rpcInfo);
        }

        rpcInfo.put("totalCalls", rpcStat.getTotalAmountOfCalls());
        rpcInfo.put("totalTime", Long.valueOf(0));
      }

      List<Map<String, Object>> callInfoMap = new ArrayList<Map<String, Object>>();
      for (IndividualRpcStatsProto rpcStat : appstats.getIndividualStatsList())
      {
        // Update the total time for the RPC method
        Map<String, Object> rpcInfo = rpcInfoMap.get(rpcStat.getServiceCallName());
        rpcInfo.put("totalTime", ((Long) rpcInfo.get("totalTime")) + rpcStat.getDurationMilliseconds());

        // Get info about this specific call
        Map<String, Object> callInfo = new LinkedHashMap<String, Object>();
        callInfoMap.add(callInfo);
        callInfo.put("serviceCallName", rpcStat.getServiceCallName());
        callInfo.put("totalTime", rpcStat.getDurationMilliseconds());
        callInfo.put("startOffset", rpcStat.getStartOffsetMilliseconds());
        callInfo.put("request", truncate(rpcStat.getRequestDataSummary(), 100));
        callInfo.put("response", truncate(rpcStat.getResponseDataSummary(), 100));
        // Get the stack trace
        List<String> callStack = new ArrayList<String>();
        int i = 0;
        for (StackFrameProto frame : rpcStat.getCallStackList())
        {
          if (maxStackFrames != null && i == maxStackFrames)
          {
            break;
          }
          callStack.add(String.format("%s.%s:%d", frame.getClassOrFileName(), frame.getFunctionName(), frame.getLineNumber()));
          i++;
        }
        callInfo.put("callStack", callStack);
      }
      appstatsMap.put("rpcStats", !rpcInfoMap.isEmpty() ? rpcInfoMap : null);
      appstatsMap.put("rpcCalls", !callInfoMap.isEmpty() ? callInfoMap : null);
    }
    return appstatsMap;
  }