Skip to content

Commit e2923f5

Browse files
committed
examples
1 parent cd91cc9 commit e2923f5

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

example_period_test.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ func (p uintInterval) String() string {
3939
return fmt.Sprintf("%d...%d", p[0], p[1])
4040
}
4141

42+
// The following example shows how to use the interval library with a simple interval and the correspondig
43+
// compare function.
4244
func ExampleNewTree() {
4345
tree1 := interval.NewTree(cmpUintInterval, periods...)
4446
tree1.Fprint(os.Stdout)
@@ -50,11 +52,12 @@ func ExampleNewTree() {
5052
// └─ 7...9
5153
}
5254

55+
// The Max funtion returns the interval with max left value.
5356
func ExampleTree_Max() {
5457
tree1 := interval.NewTree(cmpUintInterval, periods...)
5558
tree1.Fprint(os.Stdout)
5659

57-
fmt.Println("\nInterval with max value in tree:")
60+
fmt.Println("\nInterval with max left value in tree:")
5861
fmt.Println(tree1.Max())
5962
// Output:
6063
// ▼
@@ -63,10 +66,11 @@ func ExampleTree_Max() {
6366
// │ └─ 3...4
6467
// └─ 7...9
6568
//
66-
//Interval with max value in tree:
69+
//Interval with max left value in tree:
6770
//7...9
6871
}
6972

73+
// The following example explains the Covers method.
7074
func ExampleTree_Covers() {
7175
tree1 := interval.NewTree(cmpUintInterval, periods...)
7276
tree1.Fprint(os.Stdout)
@@ -89,6 +93,7 @@ func ExampleTree_Covers() {
8993
// 3...4
9094
}
9195

96+
// The following example explains the CoveredBy method.
9297
func ExampleTree_CoveredBy() {
9398
tree1 := interval.NewTree(cmpUintInterval, periods...)
9499
tree1.Fprint(os.Stdout)
@@ -111,6 +116,7 @@ func ExampleTree_CoveredBy() {
111116
// 7...9
112117
}
113118

119+
// The following example explains the Precedes method.
114120
func ExampleTree_Precedes_period() {
115121
tree1 := interval.NewTree(cmpUintInterval, periods...)
116122
tree1.Fprint(os.Stdout)
@@ -132,6 +138,7 @@ func ExampleTree_Precedes_period() {
132138
// 3...4
133139
}
134140

141+
// The following example explains the Visit method.
135142
func ExampleTree_Visit() {
136143
tree1 := interval.NewTree(cmpUintInterval, periods...)
137144
fmt.Println("parent/child printing")

0 commit comments

Comments
 (0)