// alternative constructor to init a new List from a slice
323565
func FromSlice(slice []string) List {
	list := New()
	for _, s := range slice {
		list.Push(s)
	}
	return list
}
1071986
func (row *Row) Init() {
	// Initial values
	row.insertColumnLength = len(row.PK) + len(row.Fields)
	row.updateColumnLength = len(row.PK) + len(row.Fields)
	row.pkColumns = make([]string, 0)
	row.pkValues = make([]interface{}, 0)
	row.insertColumns = make([]string, 0)
	row.updateColumns = make([]string, 0)
	row.insertValues = make([]interface{}, 0)
	row.updateValues = make([]interface{}, 0)

	// Get and sort map keys
	var i int
	pkKeys := make([]string, len(row.PK))
	i = 0
	for pkKey := range row.PK {
		pkKeys[i] = pkKey
		i++
	}
	sort.Strings(pkKeys)
	fieldKeys := make([]string, len(row.Fields))
	i = 0
	for fieldKey := range row.Fields {
		fieldKeys[i] = fieldKey
		i++
	}
	sort.Strings(fieldKeys)

	// Primary keys
	for _, pkKey := range pkKeys {
		row.pkColumns = append(row.pkColumns, pkKey)
		row.pkValues = append(row.pkValues, row.PK[pkKey])
		row.insertColumns = append(row.insertColumns, pkKey)
		row.updateColumns = append(row.updateColumns, pkKey)
		row.insertValues = append(row.insertValues, row.PK[pkKey])
		row.updateValues = append(row.updateValues, row.PK[pkKey])
	}

	// Rest of the fields
	for _, fieldKey := range fieldKeys {
		sv, ok := row.Fields[fieldKey].(string)
		if ok && sv == onInsertNow {
			row.insertColumns = append(row.insertColumns, fieldKey)
			row.insertValues = append(row.insertValues, time.Now())
			row.updateColumnLength--
			continue
		}
		if ok && sv == onUpdateNow {
			row.updateColumns = append(row.updateColumns, fieldKey)
			row.updateValues = append(row.updateValues, time.Now())
			row.insertColumnLength--
			continue
		}
		row.insertColumns = append(row.insertColumns, fieldKey)
		row.updateColumns = append(row.updateColumns, fieldKey)
		row.insertValues = append(row.insertValues, row.Fields[fieldKey])
		row.updateValues = append(row.updateValues, row.Fields[fieldKey])
	}
}
1120652
func (c *listCommand) Init(args []string) (err error) {
	c.modelName, err = cmd.ZeroOrOneArgs(args)
	if err != nil {
		return err
	}
	return err
}
1187384
func (g *Generator) init() {
	g.filedInit = []string{}
	g.imports = map[string]bool{}
	g.pooledObjects = map[string]string{}
	g.structTypes = map[string]string{}
	g.sliceTypes = map[string]string{}
	g.poolInit = map[string]string{}
	g.addImport(gojayPackage)
	// if we want pools, add the sync package right away
	if g.options.PoolObjects {
		g.addImport("sync")
	}
}
1187636
func (sl *SkipList) init(ifc interface{}) {
	switch ifc.(type) {
	case uint8:
		sl.maxLevel = 8
	case uint16:
		sl.maxLevel = 16
	case uint32:
		sl.maxLevel = 32
	case uint64, uint:
		sl.maxLevel = 64
	}
	sl.cache = make(nodes, sl.maxLevel)
	sl.posCache = make(widths, sl.maxLevel)
	sl.head = newNode(nil, sl.maxLevel)
}
601286
func InterfaceSlice(slice interface{}) []interface{} {
	s := reflect.ValueOf(slice)
	if s.Kind() != reflect.Slice {
		panic("InterfaceSlice() given a non-slice type")
	}

	ret := make([]interface{}, s.Len())

	for i := 0; i < s.Len(); i++ {
		ret[i] = s.Index(i).Interface()
	}

	return ret
}
708
func (t *StringTree) Init(flags byte) *StringTree {
	t.Tree.Init(stringCompare, flags)
	return t
}
214350
func TableFromStructs(structs Slice) *Table {
	s := reflectSlice(structs)
	st := s.Type()
	if st.Elem().Kind() != reflect.Struct {
		panic(&generic.TypeError{st, nil, "is not a slice of struct"})
	}

	var t Builder
	rows := s.Len()
	var rec func(reflect.Type, []int)
	rec = func(typ reflect.Type, index []int) {
		for fn := 0; fn < typ.NumField(); fn++ {
			field := typ.Field(fn)
			if field.PkgPath != "" {
				continue
			}
			oldIndexLen := len(index)
			index = append(index, field.Index...)
			if field.Anonymous {
				rec(field.Type, index)
			} else {
				col := reflect.MakeSlice(reflect.SliceOf(field.Type), rows, rows)
				for i := 0; i < rows; i++ {
					col.Index(i).Set(s.Index(i).FieldByIndex(index))
				}
				t.Add(field.Name, col.Interface())
			}
			index = index[:oldIndexLen]
		}
	}
	rec(st.Elem(), []int{})
	return t.Done()
}
389112
func (self *MapTypeDef) Init() *MapTypeDef {
	if self.Keys == "" {
		self.Keys = "String"
	}
	if self.Items == "" {
		self.Items = "Any"
	}
	return self
}
991675
func (s *Set) List() []interface{} {
	result := make([]interface{}, len(s.m))
	for i, k := range s.listCode() {
		result[i] = s.m[k]
	}

	return result
}
403898
func (s IntSet) List() []int {
	res := make([]int, 0, len(s))
	for key := range s {
		res = append(res, key)
	}
	sort.IntSlice(res).Sort()
	return res
}
1197198
func Init(l ...Logger) {
	for _, logger := range l {
		gl.loggers = append(gl.loggers, logger)
	}
}
772409
func (b *LRUCache) Init(capacity uint) {
	b.table = make(map[string]*entry, capacity)
	b.priorityQueue = make([]*entry, 0, capacity)
	b.lruList.Init()
	b.freeList.Init()
	heap.Init(&b.priorityQueue)

	// Reserve all the entries in one giant continous block of memory
	arrayOfEntries := make([]entry, capacity)
	for i := uint(0); i < capacity; i++ {
		e := &arrayOfEntries[i]
		e.element.Value = e
		e.index = -1
		b.freeList.PushElementBack(&e.element)
	}
}
132535
func (s Int) List() []int {
	res := make(sortableSliceOfInt, 0, len(s))
	for key := range s {
		res = append(res, key)
	}
	sort.Sort(res)
	return []int(res)
}
940186
func init() {
	numer := big.NewInt(0xffffff)
	numer.Lsh(numer, 127-23)
	maxFloat32Val = new(big.Rat).SetInt(numer)
	numer.SetInt64(0x1fffffffffffff)
	numer.Lsh(numer, 1023-52)
	maxFloat64Val = new(big.Rat).SetInt(numer)
	minFloat32Val = new(big.Rat).Neg(maxFloat32Val)
	minFloat64Val = new(big.Rat).Neg(maxFloat64Val)

	// To avoid portability issues all numeric types are distinct
	// except byte, which is an alias for uint8.

	// Make byte an alias for the named type uint8.  Type aliases
	// are otherwise impossible in Go, so just hack it here.
	universe.defs["byte"] = universe.defs["uint8"]

	// Built-in functions
	universe.DefineConst("append", universePos, appendType, nil)
	universe.DefineConst("cap", universePos, capType, nil)
	universe.DefineConst("close", universePos, closeType, nil)
	universe.DefineConst("closed", universePos, closedType, nil)
	universe.DefineConst("copy", universePos, copyType, nil)
	universe.DefineConst("len", universePos, lenType, nil)
	universe.DefineConst("make", universePos, makeType, nil)
	universe.DefineConst("new", universePos, newType, nil)
	universe.DefineConst("panic", universePos, panicType, nil)
	universe.DefineConst("print", universePos, printType, nil)
	universe.DefineConst("println", universePos, printlnType, nil)
}
365088
func (l *LanguageOpts) Init() {
	if !l.initialized {
		l.initialized = true
		l.reservedWordsSet = make(map[string]struct{})
		for _, rw := range l.ReservedWords {
			l.reservedWordsSet[rw] = struct{}{}
		}
	}
}
1275987
func Slice(slicePtr interface{}, less func(i, j int) bool) {
	v := reflect.ValueOf(slicePtr).Elem()
	if v.Len() <= 1 {
		return
	}
	sort.Slice(v.Interface(), less)

	i := 0
	for j := 1; j < v.Len(); j++ {
		if !less(i, j) {
			continue
		}
		i++
		v.Index(i).Set(v.Index(j))
	}
	i++
	v.SetLen(i)
}