From d0ff2c578bf9a8135beb8501351a4b53c677f10e Mon Sep 17 00:00:00 2001 From: reugn Date: Fri, 27 Sep 2024 11:36:20 +0300 Subject: [PATCH] docs(csm): update package documentation --- internal/csm/doc.go | 21 ++++++++++++--------- internal/csm/node.go | 11 +++++------ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/internal/csm/doc.go b/internal/csm/doc.go index 5f1e6ee..3c90834 100644 --- a/internal/csm/doc.go +++ b/internal/csm/doc.go @@ -1,4 +1,4 @@ -// "csm" is an internal package focused on solving a single task. +// Package csm is an internal package focused on solving a single task. // Given an arbitrary date and cron expression, what is the first following // instant that fits the expression? // @@ -10,14 +10,17 @@ // First, we must check from most significant (year) to least significant (second) for // any field that is invalid according to the cron expression, and move it forward to the // next valid value. This resets less significant fields and can overflow; advancing more -// significant fields. This process is implemented in CronStateMachine.findForward() (fn_find_forward.go). +// significant fields. This process is implemented in CronStateMachine.findForward() +// (fn_find_forward.go). // -// Second, if no fields are changed by this process, we must perform the smallest possible step forward -// to find the next valid value. This involves moving forward the least significant field (second), -// taking care to advance the next significant field when the previous one overflows. This process is -// implemented in CronStateMachine.next() (fn_next.go). +// Second, if no fields are changed by this process, we must perform the smallest +// possible step forward to find the next valid value. This involves moving forward +// the least significant field (second), taking care to advance the next significant +// field when the previous one overflows. This process is implemented in CronStateMachine.next() +// (fn_next.go). // -// NOTE: Some precautions must be taken as the "day" value does not have a constant radix. It depends -// on the month and the year. January always has 30 days, while February 2024 has 29. This is taken into account -// by the DayNode struct (day_node.go) and CronStateMachine.next() (fn_next.go). +// NOTE: Some precautions must be taken as the "day" value does not have a constant radix. +// It depends on the month and the year. January always has 30 days, while February 2024 has 29. +// This is taken into account by the DayNode struct (day_node.go) and CronStateMachine.next() +// (fn_next.go). package csm diff --git a/internal/csm/node.go b/internal/csm/node.go index 5cdc184..e59b49b 100644 --- a/internal/csm/node.go +++ b/internal/csm/node.go @@ -1,19 +1,18 @@ package csm type csmNode interface { - // Returns the value held by the node. + // Value returns the value held by the node. Value() int - // Resets the node value to the minimum valid value. + // Reset resets the node value to the minimum valid value. Reset() - // Changes the node value to the next valid value. - // Returns true if the value overflowed and false otherwise. + // Next changes the node value to the next valid value. + // It returns true if the value overflowed and false otherwise. Next() bool - // Checks if the current node value is valid. + // findForward checks if the current node value is valid. // If it is not valid, find the next valid value. - // Returns true if the value changed and false otherwise. findForward() result }