Ocean/Tools/SchemeLanguage.go

26 lines
556 B
Go
Raw Normal View History

package Tools
2015-06-17 15:44:52 +00:00
// The data type for the language.
type Language struct {
Language string
Factor float32
}
2015-06-17 15:44:52 +00:00
// The data type for multiple languages.
type Languages []Language
2015-06-17 15:44:52 +00:00
// Ensure, that the languages are sortable.
func (lang Languages) Len() int {
return len(lang)
}
2015-06-17 15:44:52 +00:00
// Ensure, that the languages are sortable.
func (lang Languages) Less(i, j int) bool {
return lang[i].Factor > lang[j].Factor
}
2015-06-17 15:44:52 +00:00
// Ensure, that the languages are sortable.
func (lang Languages) Swap(i, j int) {
lang[i], lang[j] = lang[j], lang[i]
}