This repository has been archived on 2024-04-10. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
elektron/pcp/victim.go
2016-12-22 22:59:02 -05:00

20 lines
332 B
Go

package pcp
type Victim struct {
Watts float64
Host string
}
type VictimSorter []Victim
func (slice VictimSorter) Len() int {
return len(slice)
}
func (slice VictimSorter) Less(i, j int) bool {
return slice[i].Watts >= slice[j].Watts
}
func (slice VictimSorter) Swap(i, j int) {
slice[i], slice[j] = slice[j], slice[i]
}