public static List<GeoTimeSerie> timesplit(GeoTimeSerie gts,long quietperiod,int minvalues,String labelname){
  List<GeoTimeSerie> series=new ArrayList<GeoTimeSerie>();
  if (0 == gts.values || gts.hasLabel(labelname)) {
    series.add(gts.clone());
    return series;
  }
  sort(gts,false);
  long lasttick=gts.ticks[0];
  int idx=0;
  int gtsid=1;
  GeoTimeSerie serie=new GeoTimeSerie(gts.lastbucket,gts.bucketcount,gts.bucketspan,4);
  serie.setName(gts.getName());
  Map<String,String> labels=new HashMap<String,String>();
  labels.putAll(gts.getLabels());
  labels.put(labelname,Integer.toString(gtsid));
  serie.setLabels(labels);
  while (idx < gts.values) {
    if (gts.ticks[idx] - lasttick >= quietperiod) {
      if (serie.values > 0 && serie.values >= minvalues) {
        series.add(serie);
      }
      serie=new GeoTimeSerie(gts.lastbucket,gts.bucketcount,gts.bucketspan,4);
      serie.setName(gts.getName());
      labels=new HashMap<String,String>();
      labels.putAll(gts.getLabels());
      gtsid++;
      labels.put(labelname,Integer.toString(gtsid));
      serie.setLabels(labels);
    }
    Object value=GTSHelper.valueAtIndex(gts,idx);
    GTSHelper.setValue(serie,gts.ticks[idx],null != gts.locations ? gts.locations[idx] : GeoTimeSerie.NO_LOCATION,null != gts.elevations ? gts.elevations[idx] : GeoTimeSerie.NO_ELEVATION,value,false);
    lasttick=gts.ticks[idx];
    idx++;
  }
  if (serie.values > 0 && serie.values >= minvalues) {
    series.add(serie);
  }
  return series;
}

public static List < GeoTimeSerie > timesplit ( GeoTimeSerie gts , long quietperiod , int minvalues , String labelname ) { List < GeoTimeSerie > series = new ArrayList < GeoTimeSerie > ( ) ; if ( 0 == gts . values || gts . hasLabel ( labelname ) ) { series . add ( gts . clone ( ) ) ; return series ; } sort ( gts , false ) ; long lasttick = gts . ticks [ 0 ] ; int idx = 0 ; int gtsid = 1 ; GeoTimeSerie serie = new GeoTimeSerie ( gts . lastbucket , gts . bucketcount , gts . bucketspan , 4 ) ; serie . setName ( gts . getName ( ) ) ; Map < String , String > labels = new HashMap < String , String > ( ) ; labels . putAll ( gts . getLabels ( ) ) ; labels . put ( labelname , Integer . toString ( gtsid ) ) ; serie . setLabels ( labels ) ; while ( idx < gts . values ) { if ( gts . ticks [ idx ] - lasttick >= quietperiod ) { if ( serie . values > 0 && serie . values >= minvalues ) { series . add ( serie ) ; } serie = new GeoTimeSerie ( gts . lastbucket , gts . bucketcount , gts . bucketspan , 4 ) ; serie . setName ( gts . getName ( ) ) ; labels = new HashMap < String , String > ( ) ; labels . putAll ( gts . getLabels ( ) ) ; gtsid ++ ; labels . put ( labelname , Integer . toString ( gtsid ) ) ; serie . setLabels ( labels ) ; } Object value = GTSHelper . valueAtIndex ( gts , idx ) ; GTSHelper . setValue ( serie , gts . ticks [ idx ] , null != gts . locations ? gts . locations [ idx ] : GeoTimeSerie . NO_LOCATION , null != gts . elevations ? gts . elevations [ idx ] : GeoTimeSerie . NO_ELEVATION , value , false ) ; lasttick = gts . ticks [ idx ] ; idx ++ ; } if ( serie . values > 0 && serie . values >= minvalues ) { series . add ( serie ) ; } return series ; }
split a gts into multiple gts by cutting in ' quiet zones ' , i . e . intervals of ' quietperiod ' or more during which there were no measurements . if ' gts ' has no values or if ' label ' is already part of the labels of ' gts ' , then the resulting list of gts will only contain a clone of ' gts ' .
