func (l virtualDeviceListSorter) Less(i, j int) bool {
	li := l.Sort[i]
	lj := l.Sort[j]
	liCtlr := l.DeviceList.FindByKey(li.GetVirtualDevice().ControllerKey)
	ljCtlr := l.DeviceList.FindByKey(lj.GetVirtualDevice().ControllerKey)
	if liCtlr == nil || ljCtlr == nil {
		panic(errors.New("virtualDeviceListSorter cannot be used with devices that are not assigned to a controller"))
	}
	if liCtlr.(types.BaseVirtualController).GetVirtualController().BusNumber < liCtlr.(types.BaseVirtualController).GetVirtualController().BusNumber {
		return true
	}
	liUnit := li.GetVirtualDevice().UnitNumber
	ljUnit := lj.GetVirtualDevice().UnitNumber
	if liUnit == nil || ljUnit == nil {
		panic(errors.New("virtualDeviceListSorter cannot be used with devices that do not have unit numbers set"))
	}
	return *liUnit < *ljUnit
}
func (l virtualDeviceListSorter) Less(i, j int) bool {
	li := l.Sort[i]
	lj := l.Sort[j]
	liCtlr := l.DeviceList.FindByKey(li.GetVirtualDevice().ControllerKey)
	ljCtlr := l.DeviceList.FindByKey(lj.GetVirtualDevice().ControllerKey)
	if liCtlr == nil || ljCtlr == nil {
		panic(errors.New("virtualDeviceListSorter cannot be used with devices that are not assigned to a controller"))
	}
	if liCtlr.(types.BaseVirtualController).GetVirtualController().BusNumber < liCtlr.(types.BaseVirtualController).GetVirtualController().BusNumber {
		return true
	}
	liUnit := li.GetVirtualDevice().UnitNumber
	ljUnit := lj.GetVirtualDevice().UnitNumber
	if liUnit == nil || ljUnit == nil {
		panic(errors.New("virtualDeviceListSorter cannot be used with devices that do not have unit numbers set"))
	}
	return *liUnit < *ljUnit
}
func ( l virtualDeviceListSorter ) Less ( i , j int ) bool { li := l . Sort [ i ] lj := l . Sort [ j ] liCtlr := l . DeviceList . FindByKey ( li . GetVirtualDevice ( ) . ControllerKey ) ljCtlr := l . DeviceList . FindByKey ( lj . GetVirtualDevice ( ) . ControllerKey ) if liCtlr == nil || ljCtlr == nil { panic ( errors . New ( " " ) ) } if liCtlr . ( types . BaseVirtualController ) . GetVirtualController ( ) . BusNumber < liCtlr . ( types . BaseVirtualController ) . GetVirtualController ( ) . BusNumber { return true } liUnit := li . GetVirtualDevice ( ) . UnitNumber ljUnit := lj . GetVirtualDevice ( ) . UnitNumber if liUnit == nil || ljUnit == nil { panic ( errors . New ( " " ) ) } return * liUnit < * ljUnit }
// Less helps implement sort.Interface for virtualDeviceListSorter. A
// BaseVirtualDevice is "less" than another device if its controller's bus
// number and unit number combination are earlier in the order than the other.
Less helps implement sort . Interface for virtualDeviceListSorter . A BaseVirtualDevice is less than another device if its controller s bus number and unit number combination are earlier in the order than the other .