// Comparable returns a comparable version of the node's reserved resources. The
// returned resources doesn't contain any network information. This conversion
// can be lossy so care must be taken when using it.
199817
func (n *NodeReservedResources) Comparable() *ComparableResources {
	if n == nil {
		return nil
	}

	c := &ComparableResources{
		Flattened: AllocatedTaskResources{
			Cpu: AllocatedCpuResources{
				CpuShares: n.Cpu.CpuShares,
			},
			Memory: AllocatedMemoryResources{
				MemoryMB: n.Memory.MemoryMB,
			},
		},
		Shared: AllocatedSharedResources{
			DiskMB: n.Disk.DiskMB,
		},
	}
	return c
}
352948
func Value(res *api.GenericResource) string {
	switch res := res.Resource.(type) {
	case *api.GenericResource_DiscreteResourceSpec:
		return discreteToString(res)
	case *api.GenericResource_NamedResourceSpec:
		return res.NamedResourceSpec.Value
	}

	return ""
}
1350895
func (r *ReindexSource) Sort(field string, ascending bool) *ReindexSource {
	r.request = r.request.Sort(field, ascending)
	return r
}
151941
func (c *ComparableResources) NetIndex(n *NetworkResource) int {
	return c.Flattened.Networks.NetIndex(n)
}
1065659
func isComparable(t reflect.Type) bool {
	switch t.Kind() {
	case reflect.Array:
		return isComparable(t.Elem())

	case reflect.Struct:
		for i := 0; i < t.NumField(); i++ {
			if !isComparable(t.Field(i).Type) {
				return false
			}
		}

		return true

	case reflect.Slice, reflect.Map, reflect.Func:
		return false
	}

	return true
}
1037565
func (lls *logLevelSetting) Compare(other gorivets.Comparable) int {
	return compare(lls, other.(*logLevelSetting))
}
370739
func (node ColIdent) Equal(in ColIdent) bool {
	return node.Lowered() == in.Lowered()
}
23784
func (p PgXLog) Compare(xlog1, xlog2 xlog.Position) (int, error) {
	p1, err := parse(xlog1)
	if err != nil {
		return 0, err
	}
	p2, err := parse(xlog2)
	if err != nil {
		return 0, err
	}

	if p1[0] == p2[0] && p1[1] == p2[1] {
		return 0, nil
	}
	if p1[0] > p2[0] || p1[0] == p2[0] && p1[1] > p2[1] {
		return 1, nil
	}
	return -1, nil
}
1197593
func (a APIObjectVersioner) CompareResourceVersion(lhs, rhs runtime.Object) int {
	lhsVersion, err := Versioner.ObjectResourceVersion(lhs)
	if err != nil {
		// coder error
		panic(err)
	}
	rhsVersion, err := Versioner.ObjectResourceVersion(rhs)
	if err != nil {
		// coder error
		panic(err)
	}

	if lhsVersion == rhsVersion {
		return 0
	}
	if lhsVersion < rhsVersion {
		return -1
	}

	return 1
}
1064375
func (n *Networks) Equals(o *Networks) bool {
	if n == o {
		return true
	}
	if n == nil || o == nil {
		return false
	}
	if len(*n) != len(*o) {
		return false
	}
SETEQUALS:
	for _, ne := range *n {
		for _, oe := range *o {
			if ne.Equals(oe) {
				continue SETEQUALS
			}
		}
		return false
	}
	return true
}
922389
func computeNodeTotalResources(node *api.Node) api.Resources {
	total := api.Resources{}

	r := node.Resources
	res := node.Reserved
	if res == nil {
		res = &api.Resources{}
	}
	total.CPU = helper.IntToPtr(*r.CPU - *res.CPU)
	total.MemoryMB = helper.IntToPtr(*r.MemoryMB - *res.MemoryMB)
	total.DiskMB = helper.IntToPtr(*r.DiskMB - *res.DiskMB)
	return total
}
511204
func (s *rowGrouper) compare(i, j, n int) int {
	ik := s.rowKey(i, 0, n)
	jk := s.rowKey(j, 0, n)
	return bytes.Compare(ik, jk)
}
1115857
func (o *LimitOption) Equal(o2 *LimitOption) bool {
	if o2 == nil {
		return o.value == 10
	}
	return o.value == o2.value
}
402744
func (d *DN) Equal(other *DN) bool {
	if len(d.RDNs) != len(other.RDNs) {
		return false
	}
	for i := range d.RDNs {
		if !d.RDNs[i].Equal(other.RDNs[i]) {
			return false
		}
	}
	return true
}
875993
func (o *ForwardToReplicasOption) Equal(o2 *ForwardToReplicasOption) bool {
	if o2 == nil {
		return o.value == false
	}
	return o.value == o2.value
}
246680
func nodesEqual(a, b *api.Node) bool {
	a, b = a.Copy(), b.Copy()

	a.Status, b.Status = api.NodeStatus{}, api.NodeStatus{}
	a.Meta, b.Meta = api.Meta{}, api.Meta{}

	return reflect.DeepEqual(a, b)
}
244716
func Kind(res *api.GenericResource) string {
	switch r := res.Resource.(type) {
	case *api.GenericResource_DiscreteResourceSpec:
		return r.DiscreteResourceSpec.Kind
	case *api.GenericResource_NamedResourceSpec:
		return r.NamedResourceSpec.Kind
	}

	return ""
}