func (s *ImmutableSampleWindow) DidDrop() bool {
	return s.didDrop
}
DidDrop returns True if there was a timeout.
package measurements
import (
	"fmt"
	"math"
	"time"
)
type ImmutableSampleWindow struct {
	startTime   int64
	minRTT      int64
	maxInFlight int
	sampleCount int
	sum         int64
	didDrop     bool
}
func NewDefaultImmutableSampleWindow() *ImmutableSampleWindow {
	return NewImmutableSampleWindow(
		time.Now().UnixNano(),
		math.MaxInt64,
		0,
		0,
		0,
		false,
	)
}
func NewImmutableSampleWindow(
	startTime int64,
	minRTT int64,
	sum int64,
	maxInFlight int,
	sampleCount int,
	didDrop bool,
) *ImmutableSampleWindow {
	if minRTT == 0 {
		minRTT = math.MaxInt64
	}
	return &ImmutableSampleWindow{
		startTime:   startTime,
		minRTT:      minRTT,
		sum:         sum,
		maxInFlight: maxInFlight,
		sampleCount: sampleCount,
		didDrop:     didDrop,
	}
}
func (s *ImmutableSampleWindow) AddSample(startTime int64, rtt int64, maxInFlight int) *ImmutableSampleWindow {
	minRTT := s.minRTT
	if rtt < s.minRTT {
		minRTT = rtt
	}
	if maxInFlight < s.maxInFlight {
		maxInFlight = s.maxInFlight
	}
	if startTime < 0 {
		startTime = time.Now().UnixNano()
	}
	return NewImmutableSampleWindow(startTime, minRTT, s.sum+rtt, maxInFlight, s.sampleCount+1, s.didDrop)
}
func (s *ImmutableSampleWindow) AddDroppedSample(startTime int64, maxInFlight int) *ImmutableSampleWindow {
	if maxInFlight < s.maxInFlight {
		maxInFlight = s.maxInFlight
	}
	if startTime < 0 {
		startTime = time.Now().UnixNano()
	}
	return NewImmutableSampleWindow(startTime, s.minRTT, s.sum, maxInFlight, s.sampleCount, true)
}
func (s *ImmutableSampleWindow) StartTimeNanoseconds() int64 {
	return s.startTime
}
func (s *ImmutableSampleWindow) CandidateRTTNanoseconds() int64 {
	return s.minRTT
}
func (s *ImmutableSampleWindow) AverageRTTNanoseconds() int64 {
	if s.sampleCount == 0 {
		return 0
	}
	return s.sum / int64(s.sampleCount)
}
func (s *ImmutableSampleWindow) MaxInFlight() int {
	return s.maxInFlight
}
func (s *ImmutableSampleWindow) SampleCount() int {
	return s.sampleCount
}