public PercentileSample( PercentileCalculator percentileCalculator, PercentileBucket[] stats, DateTime? firstValueAt, DateTime? lastValueAt )
 {
     PercentileCalculator = percentileCalculator;
     Stats = stats;
     FirstValueAt = firstValueAt;
     LastValueAt = lastValueAt;
 }
 public PercentileBucket FindBucketForPercentile( int value, PercentileBucket[] buckets )
 {
     return (from b in buckets where b.Percentile >= value orderby b.Percentile ascending select b).FirstOrDefault();
 }
 public int FindBoundForPercentile( int value, PercentileBucket[] buckets )
 {
     var bucket = FindBucketForPercentile( value, buckets );
     return bucket != null ? bucket.Bound : -1;
 }