// Codes returns the airline codes.
342428
func (airline *Airline) Codes() []string {
	if airline.Iata == airline.Icao {
		if airline.Iata == "" {
			return []string{}
		}
		return []string{airline.Iata}
	}
	if airline.Iata == "" {
		return []string{airline.Icao}
	}
	if airline.Icao == "" {
		return []string{airline.Iata}
	}
	return []string{airline.Iata, airline.Icao}
}
504094
func Coded(code int32, msg string, detail ...string) *CodedError {
	e := &CodedError{
		Code:    code,
		Message: msg,
	}
	if len(detail) > 0 {
		e.Detail = detail[0]
	}
	return e
}
417487
func (w *writer) stringCode(str []rune) int {
	if w.counting {
		return 0
	}

	hash := string(str)
	i, ok := w.stringhash[hash]
	if !ok {
		i = len(w.stringhash)
		w.stringhash[hash] = i
		w.stringtable = append(w.stringtable, str)
	}

	return i
}
1369166
func (c *CodeStore) GetRoutes(airline string, source string, dest string) ([]*Route, error) {
	var airlineRoutes []*Route
	var sourceAirportRoutes []*Route
	var destinationAirportRoutes []*Route
	if airline != "" {
		airlineRoutes = c.AirlineToRoutes[strings.ToLower(airline)]
	}
	if source != "" {
		sourceAirportRoutes = c.SourceAirportToRoutes[strings.ToLower(source)]
	}
	if dest != "" {
		destinationAirportRoutes = c.DestinationAirportToRoutes[strings.ToLower(dest)]
	}
	return routesIntersection(airlineRoutes, sourceAirportRoutes, destinationAirportRoutes), nil
}
880749
func (q *QRCode) encode(numTerminatorBits int) {
	q.addTerminatorBits(numTerminatorBits)
	q.addPadding()

	encoded := q.encodeBlocks()

	const numMasks int = 8
	penalty := 0

	for mask := 0; mask < numMasks; mask++ {
		var s *symbol
		var err error

		s, err = buildRegularSymbol(q.version, mask, encoded)

		if err != nil {
			log.Panic(err.Error())
		}

		numEmptyModules := s.numEmptyModules()
		if numEmptyModules != 0 {
			log.Panicf("bug: numEmptyModules is %d (expected 0) (version=%d)",
				numEmptyModules, q.VersionNumber)
		}

		p := s.penaltyScore()

		//log.Printf("mask=%d p=%3d p1=%3d p2=%3d p3=%3d p4=%d\n", mask, p, s.penalty1(), s.penalty2(), s.penalty3(), s.penalty4())

		if q.symbol == nil || p < penalty {
			q.symbol = s
			q.mask = mask
			penalty = p
		}
	}
}
1218745
func (h *Item) CurrencyCode(currencyCode string) *Item {
	h.currencyCode = currencyCode
	h.currencyCodeSet = true
	return h
}
612586
func (h *Item) Code(code string) *Item {
	h.code = code
	h.codeSet = true
	return h
}
1075534
func (f *Finalizer) Code(att *design.AttributeDefinition, target string, depth int) string {
	buf := f.recurse(att, att, target, depth)
	return buf.String()
}
126275
func (s *ImportSpec) Code() string {
	if len(s.Name) > 0 {
		return fmt.Sprintf(`%s "%s"`, s.Name, s.Path)
	}
	return fmt.Sprintf(`"%s"`, s.Path)
}
282320
func statusCode(code int) string {
	if code >= 100 {
		switch {
		case code < 200:
			return statusCodeWithTable(code-100, statusCode100[:])
		case code < 300:
			return statusCodeWithTable(code-200, statusCode200[:])
		case code < 400:
			return statusCodeWithTable(code-300, statusCode300[:])
		case code < 500:
			return statusCodeWithTable(code-400, statusCode400[:])
		case code < 600:
			return statusCodeWithTable(code-500, statusCode500[:])
		}
	}
	return strconv.Itoa(code)
}
875940
func CodeEntries(m *module.Module) ([]*module.CodeEntry, error) {

	entries := make([]*module.CodeEntry, len(m.Code.Segments))

	for i, s := range m.Code.Segments {
		buf := bytes.NewBuffer(s.Code)
		entry, err := ReadCodeEntry(buf)
		if err != nil {
			return nil, err
		}
		entries[i] = entry
	}

	return entries, nil
}
1251216
func (g *SearchService) Code(uri *Hyperlink, uriParams M) (codeSearchResults *CodeSearchResults, result *Result) {
	url, err := ExpandWithDefault(uri, &CodeSearchURL, uriParams)
	if err != nil {
		return nil, &Result{Err: err}
	}

	result = g.client.get(url, &codeSearchResults)
	return
}
1055626
func (s *DeviceStatusDetail) SetCode(v string) *DeviceStatusDetail {
	s.Code = &v
	return s
}
238644
func (c *Constant) HashCode() []byte {
	var bytes []byte
	bytes, _ = codec.EncodeValue(bytes, c.Value)
	return bytes
}
850287
func ErrCode(err error) string {
	type ErrorCoder interface {
		ErrorCode() string
	}
	switch err := errors.Cause(err).(type) {
	case ErrorCoder:
		return err.ErrorCode()
	default:
		return ""
	}
}
764093
func (s ISO88595) Encode() []byte {
	e := charmap.ISO8859_5.NewEncoder()
	es, _, err := transform.Bytes(e, s)
	if err != nil {
		return s
	}
	return es
}
294657
func encode(s string) string {
	r := s
	for _, tr := range codecValues {
		if strings.Index(r, tr.decoded) >= 0 {
			r = strings.Replace(r, tr.decoded, tr.encoded, -1)
		}
	}
	return r
}