Skip to content

Commit c4375d5

Browse files
authored
docs(csm): update package documentation (#142)
1 parent 98def5b commit c4375d5

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

internal/csm/doc.go

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// "csm" is an internal package focused on solving a single task.
1+
// Package csm is an internal package focused on solving a single task.
22
// Given an arbitrary date and cron expression, what is the first following
33
// instant that fits the expression?
44
//
@@ -10,14 +10,17 @@
1010
// First, we must check from most significant (year) to least significant (second) for
1111
// any field that is invalid according to the cron expression, and move it forward to the
1212
// next valid value. This resets less significant fields and can overflow; advancing more
13-
// significant fields. This process is implemented in CronStateMachine.findForward() (fn_find_forward.go).
13+
// significant fields. This process is implemented in CronStateMachine.findForward()
14+
// (fn_find_forward.go).
1415
//
15-
// Second, if no fields are changed by this process, we must perform the smallest possible step forward
16-
// to find the next valid value. This involves moving forward the least significant field (second),
17-
// taking care to advance the next significant field when the previous one overflows. This process is
18-
// implemented in CronStateMachine.next() (fn_next.go).
16+
// Second, if no fields are changed by this process, we must perform the smallest
17+
// possible step forward to find the next valid value. This involves moving forward
18+
// the least significant field (second), taking care to advance the next significant
19+
// field when the previous one overflows. This process is implemented in CronStateMachine.next()
20+
// (fn_next.go).
1921
//
20-
// NOTE: Some precautions must be taken as the "day" value does not have a constant radix. It depends
21-
// on the month and the year. January always has 30 days, while February 2024 has 29. This is taken into account
22-
// by the DayNode struct (day_node.go) and CronStateMachine.next() (fn_next.go).
22+
// NOTE: Some precautions must be taken as the "day" value does not have a constant radix.
23+
// It depends on the month and the year. January always has 30 days, while February 2024 has 29.
24+
// This is taken into account by the DayNode struct (day_node.go) and CronStateMachine.next()
25+
// (fn_next.go).
2326
package csm

internal/csm/node.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
package csm
22

33
type csmNode interface {
4-
// Returns the value held by the node.
4+
// Value returns the value held by the node.
55
Value() int
66

7-
// Resets the node value to the minimum valid value.
7+
// Reset resets the node value to the minimum valid value.
88
Reset()
99

10-
// Changes the node value to the next valid value.
11-
// Returns true if the value overflowed and false otherwise.
10+
// Next changes the node value to the next valid value.
11+
// It returns true if the value overflowed and false otherwise.
1212
Next() bool
1313

14-
// Checks if the current node value is valid.
14+
// findForward checks if the current node value is valid.
1515
// If it is not valid, find the next valid value.
16-
// Returns true if the value changed and false otherwise.
1716
findForward() result
1817
}
1918

0 commit comments

Comments
 (0)