// NonZero checks whether UsageStat has accumulated any usage info
556464
func (u *UsageStat) NonZero() bool {
	for i := UsageType(0); i < NumUsage; i++ {
		if u.Bytes[i] != 0 {
			return true
		}
	}
	return false
}
775288
func afterOrZero(t1, t2 *metav1.Time) bool {
	if t1.Time.IsZero() || t2.Time.IsZero() {
		return t1.Time.IsZero()
	}
	return t1.After(t2.Time)
}
692895
func isZeros(a Address) bool {
	for i := 0; i < len(a); i++ {
		if a[i] != 0 {
			return false
		}
	}
	return true
}
615446
func (file *DataFile) overwriteWithZero(from int, size int) (err error) {
	if _, err = file.Fh.Seek(int64(from), os.SEEK_SET); err != nil {
		return
	}
	zeroSize := 1048576 * 8 // Fill 8 MB at a time
	zero := make([]byte, zeroSize)
	for i := 0; i < size; i += zeroSize {
		var zeroSlice []byte
		if i+zeroSize > size {
			zeroSlice = zero[0 : size-i]
		} else {
			zeroSlice = zero
		}
		if _, err = file.Fh.Write(zeroSlice); err != nil {
			return
		}
	}
	return file.Fh.Sync()
}
651157
func (t *PEP425Tag) IsZero() bool {
	return t == nil || (t.Python == "" && t.Abi == "" && t.Platform == "")
}
504104
func isZero(rv reflect.Value) bool {
	zero := true
	switch rv.Kind() {
	case reflect.Bool:
		zero = !rv.Bool()
	case reflect.Float32, reflect.Float64:
		zero = rv.Float() == 0
	case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
		zero = rv.Int() == 0
	case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice:
		zero = rv.IsNil()
	case reflect.String:
		zero = rv.String() == ""
	case reflect.Uint, reflect.Uintptr, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
		zero = rv.Uint() == 0
	}

	return zero
}
549360
func (ns *NonceService) Nonce() (string, error) {
	ns.mu.Lock()
	ns.latest++
	latest := ns.latest
	ns.mu.Unlock()
	defer ns.stats.Inc("Generated", 1)
	return ns.encrypt(latest)
}
451428
func (s *FieldSchema) DefaultOrZero() interface{} {
	if s.Default != nil {
		switch s.Type {
		case TypeDurationSecond:
			var result int
			switch inp := s.Default.(type) {
			case nil:
				return s.Type.Zero()
			case int:
				result = inp
			case int64:
				result = int(inp)
			case float32:
				result = int(inp)
			case float64:
				result = int(inp)
			case string:
				dur, err := parseutil.ParseDurationSecond(inp)
				if err != nil {
					return s.Type.Zero()
				}
				result = int(dur.Seconds())
			case json.Number:
				valInt64, err := inp.Int64()
				if err != nil {
					return s.Type.Zero()
				}
				result = int(valInt64)
			default:
				return s.Type.Zero()
			}
			return result

		default:
			return s.Default
		}
	}

	return s.Type.Zero()
}
426851
func (hg *Histogram) AvgCountPerNotNullValue(totalCount int64) float64 {
	factor := hg.GetIncreaseFactor(totalCount)
	totalNotNull := hg.notNullCount() * factor
	curNDV := float64(hg.NDV) * factor
	if curNDV == 0 {
		curNDV = 1
	}
	return totalNotNull / curNDV
}
1308026
func (q *Quantity) IsZero() bool {
	if q.d.Dec != nil {
		return q.d.Dec.Sign() == 0
	}
	return q.i.value == 0
}
936002
func (scope *Scope) PrimaryKeyZero() bool {
	field := scope.PrimaryField()
	return field == nil || field.IsBlank
}
367129
func (t *Time3339) IsAnyZero() bool {
	return t == nil || time.Time(*t).IsZero() || time.Time(*t).Unix() == 0
}
1348029
func LookupNonZeroFieldsValues(v reflect.Value, skipUnexported bool) (bindValues []reflect.Value) {
	elem := IndirectValue(v)
	fields := lookupFields(IndirectType(v.Type()), skipUnexported, nil)

	for _, f := range fields {
		if fieldVal := elem.FieldByIndex(f.Index); /*f.Type.Kind() == reflect.Ptr &&*/
		!IsZero(fieldVal) {
			bindValues = append(bindValues, fieldVal)
		}
	}

	return
}
217089
func (f *Field) IsZero() bool {
	zero := reflect.Zero(f.value.Type()).Interface()
	current := f.Value()

	return reflect.DeepEqual(current, zero)
}
1121279
func (f *Function) zeroReg(r *register) string {
	ctx := context{f, nil}
	return ZeroReg(ctx, r)
}
422605
func IsZero(v reflect.Value) bool {
	switch v.Kind() {
	case reflect.Struct:
		zero := true
		for i := 0; i < v.NumField(); i++ {
			zero = zero && IsZero(v.Field(i))
		}

		if typ := v.Type(); typ != nil && v.IsValid() {
			f, ok := typ.MethodByName("IsZero")
			// if not found
			// if has input arguments (1 is for the value receiver, so > 1 for the actual input args)
			// if output argument is not boolean
			// then skip this IsZero user-defined function.
			if !ok || f.Type.NumIn() > 1 || f.Type.NumOut() != 1 && f.Type.Out(0).Kind() != reflect.Bool {
				return zero
			}

			method := v.Method(f.Index)
			// no needed check but:
			if method.IsValid() && !method.IsNil() {
				// it shouldn't panic here.
				zero = method.Call(EmptyIn)[0].Interface().(bool)
			}
		}

		return zero
	case reflect.Func, reflect.Map, reflect.Slice:
		return v.IsNil()
	case reflect.Array:
		zero := true
		for i := 0; i < v.Len(); i++ {
			zero = zero && IsZero(v.Index(i))
		}
		return zero
	}
	// if not any special type then use the reflect's .Zero
	// usually for fields, but remember if it's boolean and it's false
	// then it's zero, even if set-ed.

	if !v.CanInterface() {
		// if can't interface, i.e return value from unexported field or method then return false
		return false
	}

	zero := reflect.Zero(v.Type())
	return v.Interface() == zero.Interface()
}
764479
func validateNonZero(v interface{}, name string) error {
	if v == nil {
		return nil
	}

	if d, ok := v.(time.Duration); ok {
		if d == 0 {
			return ErrZeroValue
		}
		return nil
	}

	val := reflect.ValueOf(v)
	switch val.Kind() {
	case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
		if val.Int() != 0 {
			return nil
		}
	case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
		if val.Uint() != 0 {
			return nil
		}
	case reflect.Float32, reflect.Float64:
		if val.Float() != 0 {
			return nil
		}
	default:
		return validateNonEmpty(v, name)
	}

	return ErrZeroValue
}