Suppliers Static sorting -> Weight sorting

This commit is contained in:
DanB
2017-11-26 18:36:03 +01:00
parent 4dcd47577e
commit e1ac556b3d
2 changed files with 5 additions and 5 deletions

View File

@@ -27,7 +27,7 @@ import (
// NewSupplierSortDispatcher constructs SupplierSortDispatcher
func NewSupplierSortDispatcher(lcrS *LCRService) (ssd SupplierSortDispatcher, err error) {
ssd = make(map[string]SuppliersSorting)
ssd[utils.MetaStatic] = new(StaticStrategy)
ssd[utils.MetaWeight] = new(WeightStrategy)
ssd[utils.MetaLeastCost] = NewLeastCostStrategy(lcrS)
return
}
@@ -62,11 +62,11 @@ func (lcs *LeastCostStrategy) SortSuppliers(suppls LCRSuppliers) (err error) {
return
}
// StaticStrategy orders suppliers based on their weight, no cost involved
type StaticStrategy struct {
// WeightStrategy orders suppliers based on their weight, no cost involved
type WeightStrategy struct {
}
func (ss *StaticStrategy) SortSuppliers(suppls LCRSuppliers) (err error) {
func (ss *WeightStrategy) SortSuppliers(suppls LCRSuppliers) (err error) {
suppls.Sort()
return
}

View File

@@ -584,7 +584,7 @@ const (
SMGenericV1UpdateSession = "SMGenericV1.UpdateSession"
SMGenericV1InitiateSession = "SMGenericV1.InitiateSession"
LCRs = "LCRs"
MetaStatic = "*static"
MetaWeight = "*weight"
MetaLeastCost = "*least_cost"
)