// GoTypeElem returns the Go type for the Shape. If the shape type is a pointer just
// the type will be returned minus the pointer *.
517535
func (ref *ShapeRef) GoTypeElem() string {
	if ref.Shape == nil {
		panic(fmt.Errorf("missing shape definition on reference for %#v", ref))
	}

	return ref.Shape.GoTypeElem()
}
1118216
func (v Vec3) Elem() (x, y, z float64) {
	return v[0], v[1], v[2]
}
1361984
func typeSelector(tag string) Selector {
	tag = toLowerASCII(tag)
	return func(n *html.Node) bool {
		return n.Type == html.ElementNode && n.Data == tag
	}
}
1202758
func (sensor *Sensor) GetType() (typ SensorType) {
	typ = SensorType(C.SDL_SensorGetType((*C.SDL_Sensor)(sensor)))
	return
}
437103
func (at AnyType) GoType(pkg string, d Domain) string {
	switch at.getType() {
	case "any":
		return "json.RawMessage"
	case "boolean":
		return "bool"
	case "string":
		return "string"
	case "number":
		return "float64"
	case "integer":
		return "int"
	case "object":
		return "struct"
	case "array":
		return "[]" + at.Items.GoType(pkg, d)
	case "reference":
		return at.refType(d)
	case "time":
		return "time.Time"
	case "enum":
		// Enums are handled specially.
		return "enum"
	case "base64":
		// By using a []byte here, Base64-encoded images are
		// automatically decoded by json.Unmarshal.
		return "[]byte"
	case "raw":
		// Special []byte, without bas64 decoding.
		return "RawMessage"
	default:
		log.Panicf("unhandled type: %#v", at)
	}

	panic("unreachable")
}
197754
func (p *Decoder) typeForElement(val reflect.Value, start *StartElement) reflect.Type {
	t := ""
	for i, a := range start.Attr {
		if a.Name == xmlSchemaInstance || a.Name == xsiType {
			t = a.Value
			// HACK: ensure xsi:type is last in the list to avoid using that value for
			// a "type" attribute, such as ManagedObjectReference.Type for example.
			// Note that xsi:type is already the last attribute in VC/ESX responses.
			// This is only an issue with govmomi simulator generated responses.
			// Proper fix will require finding a few needles in this xml package haystack.
			// Note: govmomi uses xmlSchemaInstance, other clients (e.g. rbvmomi) use xsiType.
			// They are the same thing to XML parsers, but not to this hack here.
			x := len(start.Attr) - 1
			if i != x {
				start.Attr[i] = start.Attr[x]
				start.Attr[x] = a
			}
			break
		}
	}

	if t == "" {
		// No type attribute; fall back to looking up type by interface name.
		t = val.Type().Name()
	}

	// Maybe the type is a basic xsd:* type.
	typ := stringToType(t)
	if typ != nil {
		return typ
	}

	// Maybe the type is a custom type.
	if p.TypeFunc != nil {
		if typ, ok := p.TypeFunc(t); ok {
			return typ
		}
	}

	return nil
}
1368359
func sliceElementType(slices ...[]interface{}) (reflect.Type, error) {
	var prevType reflect.Type
	for _, s := range slices {
		// Go through elements of all given slices and make sure they are all the same type.
		for _, v := range s {
			currentType := reflect.TypeOf(v)
			if prevType == nil {
				prevType = currentType
				// We don't support lists of lists yet.
				if prevType.Kind() == reflect.Slice {
					return nil, mergepatch.ErrNoListOfLists
				}
			} else {
				if prevType != currentType {
					return nil, fmt.Errorf("list element types are not identical: %v", fmt.Sprint(slices))
				}
				prevType = currentType
			}
		}
	}

	if prevType == nil {
		return nil, fmt.Errorf("no elements in any of the given slices")
	}

	return prevType, nil
}
369752
func (g *GistFile) GetType() string {
	if g == nil || g.Type == nil {
		return ""
	}
	return *g.Type
}
1021672
func GoTypeTransformName(source, target *design.UserTypeDefinition, suffix string) string {
	return fmt.Sprintf("%sTo%s%s", Goify(source.TypeName, true), Goify(target.TypeName, true), Goify(suffix, true))
}
902962
func (engine *Engine) UnMapType(t reflect.Type) {
	engine.mutex.Lock()
	defer engine.mutex.Unlock()
	delete(engine.Tables, t)
}
549241
func (f *FieldSetType) Elements(elems ...FormElement) *FieldSetType {
	for _, e := range elems {
		t := reflect.TypeOf(e)
		switch {
		case t.Implements(reflect.TypeOf((*fields.FieldInterface)(nil)).Elem()):
			f.addField(e.(fields.FieldInterface))
		}
	}
	return f
}
446029
func (t *Tab) getElement(nodeId int) (*Element, bool) {
	t.eleMutex.RLock()
	defer t.eleMutex.RUnlock()
	ele, ok := t.elements[nodeId]
	return ele, ok
}
748756
func getType(args ...interface{}) (reflect.Type, error) {
	var last interface{}
	for _, next := range args {
		// Skip nil values
		if next == nil {
			continue
		}

		// Set the first non-nil value we find and continue
		if last == nil {
			last = next
			continue
		}

		// Verify the types of the values match
		if reflect.TypeOf(last).Kind() != reflect.TypeOf(next).Kind() {
			return nil, fmt.Errorf("missmatching non-nil types for the same field: %T %T", last, next)
		}
	}

	return reflect.TypeOf(last), nil
}
1142968
func GetType(tname string) (reflect.Type, error) {
	t, found := typemap[tname]
	if !found {
		return nil, errors.New("type not found: " + tname)
	}
	return t, nil

}
1190565
func (e *Element) GetNodeType() (int, error) {
	e.lock.RLock()
	defer e.lock.RUnlock()

	if !e.ready {
		return -1, &ElementNotReadyErr{}
	}
	return e.nodeType, nil
}
43047
func copyElement(source reflect.Value) reflect.Value {
	Type := source.Type()
	elem := reflect.Indirect(reflect.New(Type))

	switch Type.Kind() {
	case reflect.Struct:
		for j := 0; j < Type.NumField(); j++ {
			elem.Field(j).Set(source.Field(j))
		}
	default:
		elem.Set(source)
	}

	return elem
}
158243
func GetElementType(js json.RawMessage) (string, error) {
	tmp := map[string]interface{}{}
	types := []string{"tee", "encoder", "decoder", "input", "output"}
	if err := json.Unmarshal(js, &tmp); err != nil {
		return "", err
	}
	for _, t := range types {
		if _, ok := tmp[t]; ok {
			return t, nil
		}
	}
	return "", ErrUnknowElementType
}