Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3b667443c2 | ||
![]() |
7fbc4041a3 |
7
maX.go
7
maX.go
@ -136,13 +136,12 @@ func (mxl *MaXList) RPush(sm *MaX) (Sample, error) {
|
||||
mxl.List = append(mxl.List, sm)
|
||||
return nil, nil
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// 冒泡排序
|
||||
func (mxl *MaXList) RecursiveBubbleS(length int, ctype string) error {
|
||||
if length == 0 {
|
||||
return nil
|
||||
return errors.New("length is zero")
|
||||
}
|
||||
realLength := len(mxl.List)
|
||||
//FIXME:在对这个List进行排序时,List中途长度变了,就会报错:
|
||||
@ -166,6 +165,6 @@ func (mxl *MaXList) RecursiveBubbleS(length int, ctype string) error {
|
||||
}
|
||||
}
|
||||
length--
|
||||
mxl.RecursiveBubbleS(length, ctype)
|
||||
return nil
|
||||
err := mxl.RecursiveBubbleS(length, ctype)
|
||||
return err
|
||||
}
|
||||
|
9
plate.go
9
plate.go
@ -113,19 +113,22 @@ func (pl *Plate) MakeCoaster(cr *Core, period string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
cdl.RecursiveBubbleS(len(cdl.List), "asc")
|
||||
err = cdl.RecursiveBubbleS(len(cdl.List), "asc")
|
||||
setName7 := "ma7|" + setName
|
||||
setName30 := "ma30|" + setName
|
||||
mxl7, err := cr.GetRangeMaXSortedSet(setName7, pl.Count, lastTime)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
mxl7.RecursiveBubbleS(len(mxl7.List), "asc")
|
||||
err = mxl7.RecursiveBubbleS(len(mxl7.List), "asc")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
mxl30, err := cr.GetRangeMaXSortedSet(setName30, pl.Count, lastTime)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
mxl30.RecursiveBubbleS(len(mxl30.List), "asc")
|
||||
err = mxl30.RecursiveBubbleS(len(mxl30.List), "asc")
|
||||
coaster := Coaster{
|
||||
InstID: pl.InstID,
|
||||
Period: period,
|
||||
|
Loading…
x
Reference in New Issue
Block a user