示例#1
0
文件: resource.go 项目: zn8nz/units
// Min sets a new minimum balance. Returns true for success, false for incompatible unit
// or in case the min is more than the current balance.
func (h *Resource) Min(min us.Quantity) bool {
	if !us.AreCompatible(h.balance, min) || us.More(min, h.balance) {
		return false
	}
	h.min = min
	return true
}
示例#2
0
文件: resource.go 项目: zn8nz/units
func (h *Resource) outOfBounds(q us.Quantity) bool {
	return us.Less(q, h.min) || us.More(q, h.max)
}