Skip to content
Snippets Groups Projects
Commit 6a7d9731 authored by Antoine Kryus's avatar Antoine Kryus
Browse files

mov files

parent a7e66d75
No related branches found
No related tags found
No related merge requests found
package comsoc
import("errors")
func TieBreakFactory(tieBreakAlts []Alternative) (func ([]Alternative) (Alternative, err error)) {
return func(alts []Alternative) (Alternative, err error) {
if len(alts) == 0 || alts == nil {
return -1, errors.New("002: NullAlternatives")
}
for _,alt := range(alts) {
for _,tieBreakAlt := range(tieBreakAlts) {
if alt == tieBreakAlt {
return alt, nil
}
}
}
return -1, errors.New("002: NoTieBreakAlternativeFound")
}
}
func SWFFactory(swf1 func (Profile) (Count, error), tieBreak func ([]Alternative) (Alternative, error)) (swf2 func(Profile) (alts []Alternative, err error)) {
return func(p Profile) (alts Alternative, err error) {
// alts, _ := maxCount(swf1(p))
// alt, _ := tieBreak(alts)
// return alt, nil
// il faut trifouiller le count
}
}
func SCFFactory(scf1 func (Profile) ([]Alternative, error), tieBreak func ([]Alternative) (Alternative, error)) (scf2 func(Profile) (alt Alternative, err error)) {
return func(p Profile) (alt Alternative, err error) {
alts, _ := scf1(p)
alt, _ := tieBreak(alts)
return alt, nil
}
}
// func TieBreak(a []Alternative) (Alternative, err error) {
// // if len(a) == 0 || a == nil {
// // return _, errors.New("002: NullAlternatives")
// // }
// // for _,alt := range a {
// //
// // } // 0-votes alternatives are not included
// // return nil, nil
// }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment