コード例 #1
0
 /**
  * @param t the timed value
  * @return the partitions IDs, or null if the element either 1) does not satisfy the "condition"
  *     2) is not part of any one of the partitions.
  */
 public List<Integer> evalPartitionsOn(Timed<T> t) {
   // check condition
   if (!condition.apply(t.getValue())) return null;
   // finds ids for each partition
   ArrayList<Integer> ids = new ArrayList<Integer>();
   for (Named<Partition<Timed<T>>> p : partitions) {
     int id = p.getValue().toID(t);
     if (id == Partition.INVALID_ID) return null;
     ids.add(id);
   }
   return ids;
 }