Skip to content

Commit

Permalink
remove print func
Browse files Browse the repository at this point in the history
  • Loading branch information
werbenhu committed Dec 31, 2024
1 parent b0e74e0 commit 28b0bb4
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 17 deletions.
71 changes: 71 additions & 0 deletions coverage.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
mode: set
github.com/werbenhu/ranklist/ranklist.go:30.31,33.2 2 1
github.com/werbenhu/ranklist/ranklist.go:87.75,94.2 1 1
github.com/werbenhu/ranklist/ranklist.go:98.50,104.2 1 1
github.com/werbenhu/ranklist/ranklist.go:110.24,112.55 2 1
github.com/werbenhu/ranklist/ranklist.go:112.55,114.3 1 1
github.com/werbenhu/ranklist/ranklist.go:115.2,115.14 1 1
github.com/werbenhu/ranklist/ranklist.go:122.47,128.42 3 1
github.com/werbenhu/ranklist/ranklist.go:128.42,130.3 1 1
github.com/werbenhu/ranklist/ranklist.go:134.2,145.22 5 1
github.com/werbenhu/ranklist/ranklist.go:145.22,146.37 1 1
github.com/werbenhu/ranklist/ranklist.go:146.37,148.4 1 1
github.com/werbenhu/ranklist/ranklist.go:149.3,149.19 1 1
github.com/werbenhu/ranklist/ranklist.go:154.2,155.37 2 1
github.com/werbenhu/ranklist/ranklist.go:155.37,156.30 1 1
github.com/werbenhu/ranklist/ranklist.go:156.30,159.77 1 1
github.com/werbenhu/ranklist/ranklist.go:159.77,160.10 1 1
github.com/werbenhu/ranklist/ranklist.go:162.4,163.26 2 1
github.com/werbenhu/ranklist/ranklist.go:166.3,167.17 2 1
github.com/werbenhu/ranklist/ranklist.go:172.2,174.29 3 1
github.com/werbenhu/ranklist/ranklist.go:174.29,177.13 3 1
github.com/werbenhu/ranklist/ranklist.go:177.13,179.4 1 1
github.com/werbenhu/ranklist/ranklist.go:179.9,181.33 2 1
github.com/werbenhu/ranklist/ranklist.go:181.33,183.5 1 1
github.com/werbenhu/ranklist/ranklist.go:189.2,189.36 1 1
github.com/werbenhu/ranklist/ranklist.go:189.36,190.32 1 1
github.com/werbenhu/ranklist/ranklist.go:190.32,192.4 1 1
github.com/werbenhu/ranklist/ranklist.go:194.2,194.13 1 1
github.com/werbenhu/ranklist/ranklist.go:199.40,203.2 3 1
github.com/werbenhu/ranklist/ranklist.go:209.43,213.2 3 1
github.com/werbenhu/ranklist/ranklist.go:219.43,221.13 2 1
github.com/werbenhu/ranklist/ranklist.go:221.13,223.3 1 1
github.com/werbenhu/ranklist/ranklist.go:227.2,232.37 3 1
github.com/werbenhu/ranklist/ranklist.go:232.37,235.88 1 1
github.com/werbenhu/ranklist/ranklist.go:235.88,237.4 1 1
github.com/werbenhu/ranklist/ranklist.go:238.3,238.17 1 1
github.com/werbenhu/ranklist/ranklist.go:243.2,243.32 1 1
github.com/werbenhu/ranklist/ranklist.go:243.32,244.33 1 1
github.com/werbenhu/ranklist/ranklist.go:244.33,246.33 2 1
github.com/werbenhu/ranklist/ranklist.go:246.33,248.5 1 1
github.com/werbenhu/ranklist/ranklist.go:254.2,254.59 1 1
github.com/werbenhu/ranklist/ranklist.go:254.59,256.3 1 1
github.com/werbenhu/ranklist/ranklist.go:258.2,260.13 3 1
github.com/werbenhu/ranklist/ranklist.go:267.48,271.42 3 1
github.com/werbenhu/ranklist/ranklist.go:271.42,273.3 1 1
github.com/werbenhu/ranklist/ranklist.go:274.2,274.30 1 1
github.com/werbenhu/ranklist/ranklist.go:281.51,286.13 4 1
github.com/werbenhu/ranklist/ranklist.go:286.13,288.3 1 1
github.com/werbenhu/ranklist/ranklist.go:292.2,295.37 3 1
github.com/werbenhu/ranklist/ranklist.go:295.37,296.30 1 1
github.com/werbenhu/ranklist/ranklist.go:296.30,298.88 1 1
github.com/werbenhu/ranklist/ranklist.go:298.88,301.5 2 1
github.com/werbenhu/ranklist/ranklist.go:303.4,304.87 1 1
github.com/werbenhu/ranklist/ranklist.go:304.87,305.10 1 1
github.com/werbenhu/ranklist/ranklist.go:308.4,309.26 2 1
github.com/werbenhu/ranklist/ranklist.go:312.2,312.17 1 1
github.com/werbenhu/ranklist/ranklist.go:319.67,327.37 6 1
github.com/werbenhu/ranklist/ranklist.go:327.37,328.30 1 1
github.com/werbenhu/ranklist/ranklist.go:328.30,330.21 2 1
github.com/werbenhu/ranklist/ranklist.go:330.21,331.10 1 1
github.com/werbenhu/ranklist/ranklist.go:333.4,333.26 1 1
github.com/werbenhu/ranklist/ranklist.go:337.2,338.50 2 1
github.com/werbenhu/ranklist/ranklist.go:338.50,342.3 3 1
github.com/werbenhu/ranklist/ranklist.go:343.2,343.16 1 1
github.com/werbenhu/ranklist/ranklist.go:347.35,349.37 2 0
github.com/werbenhu/ranklist/ranklist.go:349.37,352.19 3 0
github.com/werbenhu/ranklist/ranklist.go:352.19,353.25 1 0
github.com/werbenhu/ranklist/ranklist.go:353.25,355.5 1 0
github.com/werbenhu/ranklist/ranklist.go:356.4,356.26 1 0
github.com/werbenhu/ranklist/ranklist.go:358.3,358.21 1 0
github.com/werbenhu/ranklist/ranklist.go:360.2,360.52 1 0
33 changes: 16 additions & 17 deletions ranklist.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package ranklist

import (
"fmt"
"math/rand"
"sync"
)
Expand Down Expand Up @@ -343,19 +342,19 @@ func (sl *RankList[K, V]) Range(start int, end int) []Entry[K, V] {
return entries
}

// Print 打印跳表结构
func (sl *RankList[K, V]) Print() {
fmt.Printf("SkipList Level: %d, Length: %d\n", sl.level, sl.length)
for i := sl.level - 1; i >= 0; i-- {
curr := sl.header
fmt.Printf("L%d -> ", i+1)
for curr != nil {
if curr != sl.header {
fmt.Printf("[%v:%v:%v] -> ", curr.data.Key, curr.data.Value, curr.span[i])
}
curr = curr.forward[i]
}
fmt.Println("NIL")
}
fmt.Println("===================================")
}
// Print for test
// func (sl *RankList[K, V]) Print() {
// fmt.Printf("SkipList Level: %d, Length: %d\n", sl.level, sl.length)
// for i := sl.level - 1; i >= 0; i-- {
// curr := sl.header
// fmt.Printf("L%d -> ", i+1)
// for curr != nil {
// if curr != sl.header {
// fmt.Printf("[%v:%v:%v] -> ", curr.data.Key, curr.data.Value, curr.span[i])
// }
// curr = curr.forward[i]
// }
// fmt.Println("NIL")
// }
// fmt.Println("===================================")
// }

0 comments on commit 28b0bb4

Please sign in to comment.