Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Commit 88aee22

Browse files
committed
Add TODO notes
1 parent 1445678 commit 88aee22

File tree

7 files changed

+23
-0
lines changed

7 files changed

+23
-0
lines changed

interval.go

+5
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ var reRangeS = regexp.MustCompile(`^(\d*)$`)
1212
var reRangeM = regexp.MustCompile(`^(\d*):(\d*)$`)
1313
var reRangeL = regexp.MustCompile(`^(\d*):(\d*):(\d*)$`)
1414

15+
// Interval TODO
1516
type Interval struct {
1617
Low int64
1718
High int64
1819
Step int64
1920
}
2021

22+
// NewInterval TODO
2123
func NewInterval(low, high, step string) Interval {
2224
if low == "" {
2325
low = "1"
@@ -44,10 +46,12 @@ func NewInterval(low, high, step string) Interval {
4446
}
4547
}
4648

49+
// Contains TODO
4750
func (r *Interval) Contains(i int64) bool {
4851
return (i >= r.Low) && (i <= r.High) && (((i - r.Low) % r.Step) == 0)
4952
}
5053

54+
// String2Intervals TODO
5155
func String2Intervals(s string) []Interval {
5256
if reRanges.MatchString(s) {
5357
result := []Interval{}
@@ -75,6 +79,7 @@ func String2Intervals(s string) []Interval {
7579
return nil
7680
}
7781

82+
// Intervals2Func TODO
7883
func Intervals2Func(rs []Interval) func(int64) bool {
7984
return func(i int64) bool {
8085
result := false

list.go

+5
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
package datautils
22

3+
// List TODO
34
type List struct {
45
Elements []string
56
}
67

8+
// NewList TODO
79
func NewList() List {
810
list := List{}
911
return list
1012
}
1113

14+
// Add TODO
1215
func (l *List) Add(element string) {
1316
l.Elements = append(l.Elements, element)
1417
}
1518

19+
// Clear TODO
1620
func (l *List) Clear() {
1721
l.Elements = []string{}
1822
}
1923

24+
// IsEmpty TODO
2025
func (l *List) IsEmpty() bool {
2126
return len(l.Elements) == 0
2227
}

main.go

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ func processStdin(c *cli.Context, process func(string) error) error {
2626
return err
2727
}
2828

29+
// DefaultApp TODO
2930
func DefaultApp(version, date, goVersion string) *cli.App {
3031
app := cli.NewApp()
3132
dateTime := ParseRFCDate(date).Format("2006-01-02")

math.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package datautils
22

3+
// Max TODO
34
func Max(x, y int64) int64 {
45
if x > y {
56
return x

pair.go

+6
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,38 @@ package datautils
22

33
import "sort"
44

5+
// Pair TODO
56
type Pair struct {
67
Key string
78
Value int64
89
}
910

11+
// Pairs TODO
1012
type Pairs []Pair
1113

14+
// ReverseKeys TODO
1215
func (ps Pairs) ReverseKeys() {
1316
sort.SliceStable(ps, func(i, j int) bool {
1417
return ps[i].Key > ps[j].Key
1518
})
1619

1720
}
1821

22+
// ReverseValues TODO
1923
func (ps Pairs) ReverseValues() {
2024
sort.SliceStable(ps, func(i, j int) bool {
2125
return ps[i].Value > ps[j].Value
2226
})
2327
}
2428

29+
// SortKeys TODO
2530
func (ps Pairs) SortKeys() {
2631
sort.SliceStable(ps, func(i, j int) bool {
2732
return ps[i].Key < ps[j].Key
2833
})
2934
}
3035

36+
// SortValues TODO
3137
func (ps Pairs) SortValues() {
3238
sort.SliceStable(ps, func(i, j int) bool {
3339
return ps[i].Value < ps[j].Value

pipe.go

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import "bufio"
44
import "fmt"
55
import "os"
66

7+
// StdinSource TODO
78
func StdinSource() <-chan string {
89
out := make(chan string)
910
go func() {
@@ -17,12 +18,14 @@ func StdinSource() <-chan string {
1718
return out
1819
}
1920

21+
// StdoutSink TODO
2022
func StdoutSink(src <-chan string) {
2123
for s := range src {
2224
fmt.Println(s)
2325
}
2426
}
2527

28+
// TransformPipe TODO
2629
func TransformPipe(src <-chan string, transform func(string) string) <-chan string {
2730
out := make(chan string)
2831
go func() {

string.go

+2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ package datautils
22

33
import "strings"
44

5+
// IsWhite TODO
56
func IsWhite(s string) bool {
67
return len(strings.TrimSpace(s)) == 0
78
}
89

10+
// IsNotWhite TODO
911
func IsNotWhite(s string) bool {
1012
return !IsWhite(s)
1113
}

0 commit comments

Comments
 (0)