public static GeoTimeSerie detect(GeoTimeSerie gts,int alphabetSize,int wordLen,int windowLen,Collection<String> patterns,boolean standardizePAA) throws WarpScriptException {
  GeoTimeSerie gtsPatterns=GTSHelper.bSAX(gts,alphabetSize,wordLen,windowLen,standardizePAA);
  GTSHelper.sort(gtsPatterns);
  GeoTimeSerie detected=new GeoTimeSerie(gts.lastbucket,gts.bucketcount,gts.bucketspan,16);
  detected.setMetadata(gts.getMetadata());
  int lastidx=-1;
  for (int i=0; i < gtsPatterns.values; i++) {
    if (!patterns.contains(gtsPatterns.stringValues[i])) {
      continue;
    }
    for (int j=0; j < windowLen; j++) {
      if (i + j > lastidx) {
        lastidx=i + j;
        GTSHelper.setValue(detected,GTSHelper.tickAtIndex(gts,lastidx),GTSHelper.locationAtIndex(gts,lastidx),GTSHelper.elevationAtIndex(gts,lastidx),GTSHelper.valueAtIndex(gts,lastidx),false);
      }
    }
  }
  return detected;
}

public static GeoTimeSerie detect ( GeoTimeSerie gts , int alphabetSize , int wordLen , int windowLen , Collection < String > patterns , boolean standardizePAA ) throws WarpScriptException { GeoTimeSerie gtsPatterns = GTSHelper . bSAX ( gts , alphabetSize , wordLen , windowLen , standardizePAA ) ; GTSHelper . sort ( gtsPatterns ) ; GeoTimeSerie detected = new GeoTimeSerie ( gts . lastbucket , gts . bucketcount , gts . bucketspan , 16 ) ; detected . setMetadata ( gts . getMetadata ( ) ) ; int lastidx = - 1 ; for ( int i = 0 ; i < gtsPatterns . values ; i ++ ) { if ( ! patterns . contains ( gtsPatterns . stringValues [ i ] ) ) { continue ; } for ( int j = 0 ; j < windowLen ; j ++ ) { if ( i + j > lastidx ) { lastidx = i + j ; GTSHelper . setValue ( detected , GTSHelper . tickAtIndex ( gts , lastidx ) , GTSHelper . locationAtIndex ( gts , lastidx ) , GTSHelper . elevationAtIndex ( gts , lastidx ) , GTSHelper . valueAtIndex ( gts , lastidx ) , false ) ; } } } return detected ; }
detect patterns in a geo time serie instance . return a modified version of the original gts instance where only the values which are part of one of the provided patterns are kept .
