// Get returns for each category (string) its latest rates (up to X values
// where X is the configured number of samples of the Rates struct).
// Rates are ordered from least recent (index 0) to most recent (end of slice).
7478
func (rt *Rates) Get() (rateMap map[string][]float64) {
	rt.mu.Lock()
	defer rt.mu.Unlock()

	rateMap = make(map[string][]float64)
	timeStamps := rt.timeStamps.Values()
	if len(timeStamps) <= 1 {
		return
	}
	for k, v := range rt.counts {
		rateMap[k] = make([]float64, len(timeStamps)-1)
		values := v.Values()
		valueIndex := len(values) - 1
		for i := len(timeStamps) - 1; i > 0; i-- {
			if valueIndex <= 0 {
				rateMap[k][i-1] = 0
				continue
			}
			elapsed := float64((timeStamps[i] - timeStamps[i-1]) / 1e9)
			rateMap[k][i-1] = float64(values[valueIndex]-values[valueIndex-1]) / elapsed
			valueIndex--
		}
	}
	return
}
320884
func (store *Store) Get(ctx context.Context, key string, rate limiter.Rate) (limiter.Context, error) {
	key = fmt.Sprintf("%s:%s", store.Prefix, key)
	now := time.Now()

	lctx := limiter.Context{}
	onWatch := func(rtx *libredis.Tx) error {

		created, err := store.doSetValue(rtx, key, rate.Period)
		if err != nil {
			return err
		}

		if created {
			expiration := now.Add(rate.Period)
			lctx = common.GetContextFromState(now, rate, expiration, 1)
			return nil
		}

		count, ttl, err := store.doUpdateValue(rtx, key, rate.Period)
		if err != nil {
			return err
		}

		expiration := now.Add(rate.Period)
		if ttl > 0 {
			expiration = now.Add(ttl)
		}

		lctx = common.GetContextFromState(now, rate, expiration, count)
		return nil
	}

	err := store.client.Watch(onWatch, key)
	if err != nil {
		err = errors.Wrapf(err, "limiter: cannot get value for %s", key)
		return limiter.Context{}, err
	}

	return lctx, nil
}
1340354
func (c *Currency) get() *Currency {
	if curr, ok := currencies[c.Code]; ok {
		return curr
	}

	return c.getDefault()
}
672794
func (f *Request) Get(url string) *Request {
	f.Url(url).Method("GET")
	return f
}
889584
func (cd *Codec) Get(key string, object interface{}) error {
	return cd.get(nil, key, object)
}
1348784
func (c *Client) GetCategory(id string) (Category, error) {
	return c.GetCategoryOpt(id, "", "")
}
853329
func (s Slice) Get(attributePath ...string) (Slice, error) {
	result := s
	parent := s
	for _, a := range attributePath {
		var err error
		result, err = parent.get(a)
		if err != nil {
			return nil, WithStack(err)
		}
		if result.IsNone() {
			return result, nil
		}
		parent = result
	}
	return result, nil
}
1061017
func (c *Float) Get() float64 {
	return math.Float64frombits(atomic.LoadUint64(&c.currentVal))
}
679762
func (v *String) Get() string {
	v.mu.Lock()
	s := v.s
	v.mu.Unlock()
	return s
}
1107600
func (m *HashMap) Get(key []byte) interface{} {
	var now time.Time
	var sample bool
	if rand.Float64() < 0.1 {
		now = time.Now()
		sample = true
	}

	i := m.index(key)

	if sample {
		m.tracker.ObserveGet(time.Since(now))
	}

	if i == -1 {
		m.tracker.IncGetMiss()
		return nil
	}
	m.tracker.IncGetHit()
	return m.elems[i].value
}
1185560
func (v Uint16) Get(deflt uint16) uint16 {
	if !v.Defined {
		return deflt
	}
	return v.V
}
136296
func (v *StructA) GetS() (o string) {
	if v != nil {
		o = v.S
	}
	return
}
605909
func (s Slice) get(attribute string) (Slice, error) {
	if !s.IsObject() {
		return nil, InvalidTypeError{"Expecting Object"}
	}

	h := s.head()
	if h == 0x0a {
		// special case, empty object
		return nil, nil
	}

	if h == 0x14 {
		// compact Object
		value, err := s.getFromCompactObject(attribute)
		return value, WithStack(err)
	}

	offsetSize := indexEntrySize(h)
	vpackAssert(offsetSize > 0)
	end := ValueLength(readIntegerNonEmpty(s[1:], offsetSize))

	// read number of items
	var n ValueLength
	var ieBase ValueLength
	if offsetSize < 8 {
		n = ValueLength(readIntegerNonEmpty(s[1+offsetSize:], offsetSize))
		ieBase = end - n*ValueLength(offsetSize)
	} else {
		n = ValueLength(readIntegerNonEmpty(s[end-ValueLength(offsetSize):], offsetSize))
		ieBase = end - n*ValueLength(offsetSize) - ValueLength(offsetSize)
	}

	if n == 1 {
		// Just one attribute, there is no index table!
		key := Slice(s[s.findDataOffset(h):])

		if key.IsString() {
			if eq, err := key.IsEqualString(attribute); err != nil {
				return nil, WithStack(err)
			} else if eq {
				value, err := key.Next()
				return value, WithStack(err)
			}
			// fall through to returning None Slice below
		} else if key.IsSmallInt() || key.IsUInt() {
			// translate key
			if attributeTranslator == nil {
				return nil, WithStack(NeedAttributeTranslatorError)
			}
			if eq, err := key.translateUnchecked().IsEqualString(attribute); err != nil {
				return nil, WithStack(err)
			} else if eq {
				value, err := key.Next()
				return value, WithStack(err)
			}
		}

		// no match or invalid key type
		return nil, nil
	}

	// only use binary search for attributes if we have at least this many entries
	// otherwise we'll always use the linear search
	const SortedSearchEntriesThreshold = ValueLength(4)

	// bool const isSorted = (h >= 0x0b && h <= 0x0e);
	if n >= SortedSearchEntriesThreshold && (h >= 0x0b && h <= 0x0e) {
		// This means, we have to handle the special case n == 1 only
		// in the linear search!
		switch offsetSize {
		case 1:
			result, err := s.searchObjectKeyBinary(attribute, ieBase, n, 1)
			return result, WithStack(err)
		case 2:
			result, err := s.searchObjectKeyBinary(attribute, ieBase, n, 2)
			return result, WithStack(err)
		case 4:
			result, err := s.searchObjectKeyBinary(attribute, ieBase, n, 4)
			return result, WithStack(err)
		case 8:
			result, err := s.searchObjectKeyBinary(attribute, ieBase, n, 8)
			return result, WithStack(err)
		}
	}

	result, err := s.searchObjectKeyLinear(attribute, ieBase, ValueLength(offsetSize), n)
	return result, WithStack(err)
}
711643
func (s *Fake) Get(context.Context, types.Metric, time.Time, []interface{}) interface{} {
	return nil
}
453599
func (v Int16) Get(deflt int16) int16 {
	if !v.Defined {
		return deflt
	}
	return v.V
}
605186
func (md MD) Get(k string) []string {
	k = strings.ToLower(k)
	return md[k]
}
22825
func (s *Strings) Get(index int) (str string, _ error) {
	if index < 0 || index >= len(s.strs) {
		return "", errors.New("index out of bounds")
	}
	return s.strs[index], nil
}