/** * Serves up histogram data. * * @param type specifies which hourly data to fetch. * @return collection of 24 hourly histograms of the given type. */ public <T extends BaseEntry> Collection<IHistogramData> get(Class<T> type) { Collection<IHistogramData> data = Collections.EMPTY_LIST; if (type.equals(DcacheReadsHourly.class)) { data = deque.stream().map(HourlyAggregateData::getHourlyReads).collect(Collectors.toList()); } else if (type.equals(DcacheWritesHourly.class)) { data = deque.stream().map(HourlyAggregateData::getHourlyWrites).collect(Collectors.toList()); } else if (type.equals(PoolToPoolTransfersHourly.class)) { data = deque.stream().map(HourlyAggregateData::getHourlyP2ps).collect(Collectors.toList()); } else if (type.equals(DcacheTimeHourly.class)) { data = deque .stream() .map(HourlyAggregateData::getHourlyConnectionTime) .collect(Collectors.toList()); } else if (type.equals(HSMReadsHourly.class)) { data = deque.stream().map(HourlyAggregateData::getHourlyRestores).collect(Collectors.toList()); } else if (type.equals(HSMWritesHourly.class)) { data = deque.stream().map(HourlyAggregateData::getHourlyStores).collect(Collectors.toList()); } else if (type.equals(PoolHitsHourly.class)) { data = deque.stream().map(HourlyAggregateData::getPoolHits).collect(Collectors.toList()); } LOGGER.trace("get request, returning {}.", data); return data; }
@SuppressWarnings("unused") private List<Integer> getMostRecentTweetWithFolloweesByStream(Set<Integer> followees) { return tweets .stream() .filter(p -> followees.contains(p.getUserId())) .limit(10) .map(TweetPair::getTweetId) .collect(Collectors.toList()); }
/** Average the time estimates in our queue. */ private int estimateSecondsRemaining() { int sum = recentEndTimeEstimates.stream().mapToInt(i -> i).sum(); // Archivo.logger.debug("Sum = {}, size = {}", sum, recentEndTimeEstimates.size()); return sum / recentEndTimeEstimates.size(); }