public static List<GeoTimeSerie> partitionAndApply(Object function,WarpScriptStack stack,Macro validator,Collection<String> bylabels,List<GeoTimeSerie>... series) throws WarpScriptException {
  Map<Map<String,String>,List<GeoTimeSerie>> unflattened=partitionAndApplyUnflattened(function,stack,validator,bylabels,series);
  List<GeoTimeSerie> results=new ArrayList<GeoTimeSerie>();
  for (  List<GeoTimeSerie> l : unflattened.values()) {
    results.addAll(l);
  }
  return results;
}

public static List < GeoTimeSerie > partitionAndApply ( Object function , WarpScriptStack stack , Macro validator , Collection < String > bylabels , List < GeoTimeSerie > ... series ) throws WarpScriptException { Map < Map < String , String > , List < GeoTimeSerie > > unflattened = partitionAndApplyUnflattened ( function , stack , validator , bylabels , series ) ; List < GeoTimeSerie > results = new ArrayList < GeoTimeSerie > ( ) ; for ( List < GeoTimeSerie > l : unflattened . values ( ) ) { results . addAll ( l ) ; } return results ; }
apply a function ( either a filter or n - ary op ) onto collections of gts instances . let ' s assume there are n collections in ' series ' . the gts instances from collections among those n that have more than 1 element will be partitioned . for each partition p , the function f will be called with arguments f ( labels , s ( ci , pi ) , s ( c1 , p2 ) , . . . s ( ci , pi ) , . . . . , s ( cn , pn ) ) where s ( ci , pi ) is either the collection ci if card ( ci ) = = 1 or only those series from pi which belong to ci . ' labels ' is the set of common labels in the partition .
