// Features returns contents of a token.
330210
func (t Token) Features() []string {
	switch lattice.NodeClass(t.Class) {
	case lattice.DUMMY:
		return nil
	case lattice.KNOWN:
		var c int
		if t.dic.Contents != nil {
			c = len(t.dic.Contents[t.ID])
		}
		features := make([]string, 0, len(t.dic.POSTable.POSs[t.ID])+c)
		for _, id := range t.dic.POSTable.POSs[t.ID] {
			features = append(features, t.dic.POSTable.NameList[id])
		}
		if t.dic.Contents != nil {
			features = append(features, t.dic.Contents[t.ID]...)
		}
		return features
	case lattice.UNKNOWN:
		features := make([]string, len(t.dic.UnkContents[t.ID]))
		for i := range t.dic.UnkContents[t.ID] {
			features[i] = t.dic.UnkContents[t.ID][i]
		}
		return features
	case lattice.USER:
		pos := t.udic.Contents[t.ID].Pos
		tokens := strings.Join(t.udic.Contents[t.ID].Tokens, "/")
		yomi := strings.Join(t.udic.Contents[t.ID].Yomi, "/")
		return []string{pos, tokens, yomi}
	}
	return nil
}
109603
func (s *Schema_Set) Has(token string) bool {
	for _, tok := range s.Entry {
		if tok.Token == token {
			return true
		}
	}
	return false
}
243032
func (k *Keyspace) Includes(hash uint64) bool {
	if k == nil {
		return false
	}
	a := hash
	s := k.Start
	e := k.End
	return s <= a && a < e || a < e && e < s || e < s && s <= a
}
45222
func (l *lexer) token(type_ TokenType, word []rune, e Error) (*Token, Error) {
	// if we have an error, then we return a BAD token
	if e != nil {
		type_ = BAD
	}

	// extract the lexer position
	//      - the column is taken from the current column position
	//        minus the length of the consumed "word"
	_word := len(word)
	_column := l._column - _word
	_offset := l._offset - _word
	position := Position{"", l._line, _column, _offset}

	// if this is a newline token, we adjust the line & column counts
	if type_ == EOL {
		l.newline()
	}

	// return the Token
	return NewToken(type_, word, position), e
}
947858
func (s *StartDeviceSyncInput) SetFeatures(v []*string) *StartDeviceSyncInput {
	s.Features = v
	return s
}
1345049
func (d *Detections) Features() []*vision.Feature {
	list := []int{}
	if d.face {
		list = append(list, pigeon.FaceDetection)
	}
	if d.landmark {
		list = append(list, pigeon.LandmarkDetection)
	}
	if d.logo {
		list = append(list, pigeon.LogoDetection)
	}
	if d.label {
		list = append(list, pigeon.LabelDetection)
	}
	if d.text {
		list = append(list, pigeon.TextDetection)
	}
	if d.safeSearch {
		list = append(list, pigeon.SafeSearchDetection)
	}
	if d.imageProperties {
		list = append(list, pigeon.ImageProperties)
	}

	if len(list) == 0 {
		list = append(list, defaultDetection)
	}

	features := make([]*vision.Feature, len(list))
	for i := 0; i < len(list); i++ {
		features[i] = pigeon.NewFeature(list[i])
	}
	return features
}
363790
func (t *TokenSource) Token() (*oauth2.Token, error) {
	token := &oauth2.Token{
		AccessToken: t.AccessToken,
	}
	return token, nil
}
349277
func (list *TokenList) Find(id string) *Token {
	for _, item := range list.Data {
		if item.ID == id {
			return item
		}
	}

	return nil
}
35209
func (c *Client) Features(iso2code string) ([]*models.Feature, error) {
	var err error
	var result []*models.Feature

	if len(iso2code) != 2 {
		return nil, errors.New("Invalid iso2code")
	}

	uri := fmt.Sprintf("%s%s.zip", geonamesURL, strings.ToUpper(iso2code))
	zipped, err := httpGet(uri)
	if err != nil {
		return nil, err
	}

	f, err := unzip(zipped)
	if err != nil {
		return nil, err
	}

	data, err := getZipData(f, strings.ToUpper(iso2code)+".txt")
	if err != nil {
		return nil, err
	}

	parse(data, 0, func(raw [][]byte) bool {
		if len(raw) != 19 {
			return true
		}

		geonameID, _ := strconv.Atoi(string(raw[0]))

		alternateNames := strings.Split(string(raw[3]), ",")
		for i := range alternateNames {
			alternateNames[i] = strings.TrimSpace(alternateNames[i])
			if alternateNames[i] == "" {
				alternateNames = append(alternateNames[:i], alternateNames[i+1:]...)
			}
		}

		latitude, _ := strconv.ParseFloat(string(raw[4]), 64)
		longitude, _ := strconv.ParseFloat(string(raw[5]), 64)

		var population *int
		if string(raw[14]) != "" {
			populationInt, err := strconv.Atoi(string(raw[14]))
			if err == nil {
				population = &populationInt
			}
		}

		var elevation *int
		if string(raw[15]) != "" {
			elevationInt, err := strconv.Atoi(string(raw[15]))
			if err == nil {
				elevation = &elevationInt
			}
		}

		dem, _ := strconv.Atoi(string(raw[16]))
		modificationDate, _ := time.Parse("2006-02-01", string(raw[18]))

		result = append(result, &models.Feature{
			GeonameID:        geonameID,
			Name:             string(raw[1]),
			ASCIIName:        string(raw[2]),
			AlternateNames:   alternateNames,
			Latitude:         latitude,
			Longitude:        longitude,
			Class:            string(raw[6]),
			Code:             string(raw[7]),
			CountryCode:      string(raw[8]),
			Cc2:              string(raw[9]),
			Admin1Code:       string(raw[10]),
			Admin2Code:       string(raw[11]),
			Admin3Code:       string(raw[12]),
			Admin4Code:       string(raw[13]),
			Population:       population,
			Elevation:        elevation,
			Dem:              dem,
			TimeZone:         string(raw[17]),
			ModificationDate: modificationDate,
		})

		return true
	})

	return result, nil
}
1370852
func (client *Client) GetFeatureFlags() ([]FeatureFlag, Warnings, error) {
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.GetFeatureFlagsRequest,
	})

	if err != nil {
		return nil, nil, err
	}

	var fullFeatureFlagList []FeatureFlag
	warnings, err := client.paginate(request, FeatureFlag{}, func(item interface{}) error {
		if featureFlag, ok := item.(FeatureFlag); ok {
			fullFeatureFlagList = append(fullFeatureFlagList, featureFlag)
		} else {
			return ccerror.UnknownObjectInListError{
				Expected:   FeatureFlag{},
				Unexpected: item,
			}
		}
		return nil
	})

	return fullFeatureFlagList, warnings, err

}
172668
func (t Term) Includes(args ...interface{}) Term {
	return constructMethodTerm(t, "Includes", p.Term_INCLUDES, args, map[string]interface{}{})
}
1243967
func (s *RemoteApplication) Token() (string, error) {
	r := s.st.RemoteEntities()
	return r.GetToken(s.Tag())
}
1021940
func (f Features) ConciseString() string {
	noneEmptyPos := []bool{f.EnableTrace, f.Latency != 0, f.Kbps != 0, f.Mtu != 0, true, true, true, f.ModeCompressor != "off", f.EnableChannelz, f.EnablePreloader}
	return PartialPrintString(noneEmptyPos, f, false)
}
764507
func ParseFlags(f string) {
	f = strings.TrimSpace(f)
	for _, s := range strings.Split(f, ",") {
		s = strings.TrimSpace(s)
		if s == "" {
			continue
		}
		enabled := true
		var ff *FeatureFlag
		if s[0] == '+' || s[0] == '-' {
			ff = New(s[1:], nil)
			if s[0] == '-' {
				enabled = false
			}
		} else {
			ff = New(s, nil)
		}
		glog.Infof("FeatureFlag %q=%v", ff.Key, enabled)
		ff.enabled = &enabled
	}
}
1289537
func Token(r *http.Request) string {
	if val, err := contextGet(r, tokenKey); err == nil {
		if maskedToken, ok := val.(string); ok {
			return maskedToken
		}
	}

	return ""
}
34790
func (fc *FeatureCollection) Map() map[string]interface{} {
	result := make(map[string]interface{})
	result["type"] = fc.Type
	features := make([]interface{}, len(fc.Features))
	for inx, feature := range fc.Features {
		features[inx] = feature.Map()
	}

	result[FEATURES] = features
	result[BBOX] = fc.Bbox
	return result
}
1120726
func includes(a []string, s string) bool {
	for _, as := range a {
		if as == s {
			return true
		}
	}
	return false
}