Beispiel #1
0
 @Override
 public Pair<ExpandingArrayList<Long>, Long> treeReduce(
     Pair<ExpandingArrayList<Long>, Long> lhs, Pair<ExpandingArrayList<Long>, Long> rhs) {
   ExpandingArrayList<Long> nt = new ExpandingArrayList<Long>();
   nt.addAll(lhs.first);
   int index = 0;
   for (Long l : rhs.first) {
     if (nt.get(index) == null) nt.add(l);
     else nt.set(index, nt.get(index) + l);
     index++;
   }
   return new Pair<ExpandingArrayList<Long>, Long>(nt, lhs.second + rhs.second);
 }
Beispiel #2
0
 private void updateCounts(ExpandingArrayList<Long> counts, long nRods, long nObs) {
   if (nRods >= 0) {
     long prev = counts.get((int) nRods) == null ? 0l : counts.get((int) nRods);
     counts.set((int) nRods, nObs + prev);
   }
 }