// IsEmpty checks if a value is empty or not.
// A value is considered empty if
// - integer, float: zero
// - bool: false
// - string, array: len() == 0
// - slice, map: nil or len() == 0
// - interface, pointer: nil or the referenced value is empty
348881
func IsEmpty(value interface{}) bool {
	v := reflect.ValueOf(value)
	switch v.Kind() {
	case reflect.String, reflect.Array, reflect.Map, reflect.Slice:
		return v.Len() == 0
	case reflect.Bool:
		return !v.Bool()
	case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
		return v.Int() == 0
	case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
		return v.Uint() == 0
	case reflect.Float32, reflect.Float64:
		return v.Float() == 0
	case reflect.Invalid:
		return true
	case reflect.Interface, reflect.Ptr:
		if v.IsNil() {
			return true
		}
		return IsEmpty(v.Elem().Interface())
	case reflect.Struct:
		v, ok := value.(time.Time)
		if ok && v.IsZero() {
			return true
		}
	}

	return false
}
737587
func RemoveEmpty(items []string) []string {
	if len(items) == 0 {
		return items
	}
	itemsSlice := make([]string, 0, len(items))
	for _, item := range items {
		if item == "" {
			continue
		}
		itemsSlice = append(itemsSlice, item)
	}
	return itemsSlice
}
1054441
func (s *Stack) Empty() bool {
	s.l.Lock()
	defer s.l.Unlock()
	return len(s.s) == 0
}
784041
func (l *Layer) RemoveEmpty(lineLimit, areaLimit float64) {
	count := 0
	for i := 0; i < len(l.Features); i++ {
		f := l.Features[i]
		if f.Geometry == nil {
			continue
		}

		switch f.Geometry.Dimensions() {
		case 0: // point geometry
			l.Features[count] = f
			count++
		case 1: // line geometry
			length := planar.Length(f.Geometry)
			if length >= lineLimit {
				l.Features[count] = f
				count++
			}
		case 2:
			area := planar.Area(f.Geometry)
			if area >= areaLimit {
				l.Features[count] = f
				count++
			}
		}
	}

	l.Features = l.Features[:count]
}
498351
func (fs *FullStatus) IsEmpty() bool {
	return len(fs.Applications) == 0 &&
		len(fs.Machines) == 0 &&
		len(fs.Offers) == 0 &&
		len(fs.RemoteApplications) == 0 &&
		len(fs.Relations) == 0
}
309397
func GetEmptyValuesByType(types []FieldType) []interface{} {
	values := make([]interface{}, len(types))
	for i, t := range types {
		switch t {
		case BYTE:
			values[i] = byte(0)
		case STRING:
			values[i] = ""
		case INT:
			values[i] = 0
		case UINT:
			values[i] = uint(0)
		case INT64:
			values[i] = int64(0)
		case UINT64:
			values[i] = uint64(0)
		case DATE:
			values[i] = Date{}
		case TIME:
			values[i] = time.Time{}
		case BOOL:
			values[i] = false
		case FLOAT64:
			values[i] = 0.0
		default:
			panic(fmt.Sprintf("unsupported type: %d on index %d, configure error?", t, i))
		}
	}
	return values
}
1165182
func IsNameEmpty(n Name) bool {
	empty := func(s string) bool { return strings.TrimSpace(s) == "" }

	if empty(n.C) && empty(n.ST) && empty(n.L) && empty(n.O) && empty(n.OU) {
		return true
	}
	return false
}
1200964
func deleteEmpty(s ...string) []string {
	var r []string
	for _, str := range s {
		if str != "" {
			r = append(r, str)
		}
	}
	return r
}
220054
func (f *Files) IsEmpty() bool {
	f.lk.Lock()
	defer f.lk.Unlock()
	return len(f.file) == 0
}
857366
func FilterEmpty(stringSlice []string) []string {
	var result []string
	for _, str := range stringSlice {
		if str != "" {
			result = append(result, str)
		}
	}
	return result
}
789693
func IsEmpty(path string, fs afero.Fs) (bool, error) {
	return afero.IsEmpty(fs, path)
}
1351458
func (id FlexID) IsEmpty() bool {
	if id.ID() == "" {
		// Just checking the ID portion should be sufficient
		// This will allow for Empty Domains, and Classes, though they would still
		//  be invalid, this is not designed to check validity
		return true
	}
	// We also need to check if it's a Manifold ID because it will have a ID
	//  consisting of 0s, and not be empty string
	if id.Domain() == ManifoldDomain {
		mid, err := id.AsManifoldID()
		if err == nil {
			return mid.IsEmpty()
		}
	}
	return false
}
1070984
func (self *Commands) Empty(value interface{}) error {
	if typeutil.IsEmpty(value) {
		return nil
	} else {
		return fmt.Errorf("Expected empty value")
	}
}
574845
func LooksEmpty(buf gommap.MMap) bool {
	upTo := 1024
	if upTo >= len(buf) {
		upTo = len(buf) - 1
	}
	for i := 0; i < upTo; i++ {
		if buf[i] != 0 {
			return false
		}
	}
	return true
}
1335153
func (b *Bound) Empty() bool {
	return b.sw.X() >= b.ne.X() || b.sw.Y() >= b.ne.Y()
}
192222
func isEmptyValue(v reflect.Value, tinfos *TypeInfos, deref, checkStruct bool) bool {
	urv := (*unsafeReflectValue)(unsafe.Pointer(&v))
	if urv.flag == 0 {
		return true
	}
	switch v.Kind() {
	case reflect.Invalid:
		return true
	case reflect.String:
		return (*unsafeString)(urv.ptr).Len == 0
	case reflect.Slice:
		return (*unsafeSlice)(urv.ptr).Len == 0
	case reflect.Bool:
		return !*(*bool)(urv.ptr)
	case reflect.Int:
		return *(*int)(urv.ptr) == 0
	case reflect.Int8:
		return *(*int8)(urv.ptr) == 0
	case reflect.Int16:
		return *(*int16)(urv.ptr) == 0
	case reflect.Int32:
		return *(*int32)(urv.ptr) == 0
	case reflect.Int64:
		return *(*int64)(urv.ptr) == 0
	case reflect.Uint:
		return *(*uint)(urv.ptr) == 0
	case reflect.Uint8:
		return *(*uint8)(urv.ptr) == 0
	case reflect.Uint16:
		return *(*uint16)(urv.ptr) == 0
	case reflect.Uint32:
		return *(*uint32)(urv.ptr) == 0
	case reflect.Uint64:
		return *(*uint64)(urv.ptr) == 0
	case reflect.Uintptr:
		return *(*uintptr)(urv.ptr) == 0
	case reflect.Float32:
		return *(*float32)(urv.ptr) == 0
	case reflect.Float64:
		return *(*float64)(urv.ptr) == 0
	case reflect.Interface:
		isnil := urv.ptr == nil || *(*unsafe.Pointer)(urv.ptr) == nil
		if deref {
			if isnil {
				return true
			}
			return isEmptyValue(v.Elem(), tinfos, deref, checkStruct)
		}
		return isnil
	case reflect.Ptr:
		// isnil := urv.ptr == nil (not sufficient, as a pointer value encodes the type)
		isnil := urv.ptr == nil || *(*unsafe.Pointer)(urv.ptr) == nil
		if deref {
			if isnil {
				return true
			}
			return isEmptyValue(v.Elem(), tinfos, deref, checkStruct)
		}
		return isnil
	case reflect.Struct:
		return isEmptyStruct(v, tinfos, deref, checkStruct)
	case reflect.Map, reflect.Array, reflect.Chan:
		return v.Len() == 0
	}
	return false
}
598034
func (t Term) IsEmpty(args ...interface{}) Term {
	return constructMethodTerm(t, "IsEmpty", p.Term_IS_EMPTY, args, map[string]interface{}{})
}