public static GeoTimeSerie fromGTSWrapperToGTS(GTSWrapper wrapper){
  Metadata metadata=wrapper.getMetadata();
  GeoTimeSerie gts=null;
  if (null != wrapper.getEncoded()) {
    byte[] bytes=null;
    if (wrapper.isCompressed()) {
      bytes=unwrapEncoded(wrapper);
    }
 else {
      bytes=wrapper.getEncoded();
    }
    ByteBuffer bb=ByteBuffer.wrap(bytes);
    GTSDecoder decoder=new GTSDecoder(wrapper.getBase(),bb);
    decoder.setCount(0 != wrapper.getCount() ? wrapper.getCount() : bytes.length / 10);
    gts=decoder.decode();
  }
 else {
    gts=new GeoTimeSerie();
  }
  if (null == metadata) {
    metadata=new Metadata();
  }
  if (wrapper.isSetBucketcount()) {
    gts.bucketcount=(int)wrapper.getBucketcount();
  }
  if (wrapper.isSetBucketspan()) {
    gts.bucketspan=wrapper.getBucketspan();
  }
  if (wrapper.isSetLastbucket()) {
    gts.lastbucket=wrapper.getLastbucket();
  }
  gts.setMetadata(metadata);
  return gts;
}

public static GeoTimeSerie fromGTSWrapperToGTS ( GTSWrapper wrapper ) { Metadata metadata = wrapper . getMetadata ( ) ; GeoTimeSerie gts = null ; if ( null != wrapper . getEncoded ( ) ) { byte [ ] bytes = null ; if ( wrapper . isCompressed ( ) ) { bytes = unwrapEncoded ( wrapper ) ; } else { bytes = wrapper . getEncoded ( ) ; } ByteBuffer bb = ByteBuffer . wrap ( bytes ) ; GTSDecoder decoder = new GTSDecoder ( wrapper . getBase ( ) , bb ) ; decoder . setCount ( 0 != wrapper . getCount ( ) ? wrapper . getCount ( ) : bytes . length / 10 ) ; gts = decoder . decode ( ) ; } else { gts = new GeoTimeSerie ( ) ; } if ( null == metadata ) { metadata = new Metadata ( ) ; } if ( wrapper . isSetBucketcount ( ) ) { gts . bucketcount = ( int ) wrapper . getBucketcount ( ) ; } if ( wrapper . isSetBucketspan ( ) ) { gts . bucketspan = wrapper . getBucketspan ( ) ; } if ( wrapper . isSetLastbucket ( ) ) { gts . lastbucket = wrapper . getLastbucket ( ) ; } gts . setMetadata ( metadata ) ; return gts ; }
convert a gtswrapper into geotimeserie
