Documentation
¶
Index ¶
- Constants
- Variables
- func CondEndOfMonth(t time.Time) bool
- func CondQuarterly(t time.Time) bool
- func CondYearly(t time.Time) bool
- func DayDate(year int, month time.Month, day int) time.Time
- func Days(from, end time.Time, accept TimeCond) []time.Time
- func Format(w io.Writer, dict map[string]*Support) error
- func Iterate(functions ...*Function) iter.Seq[time.Time]
- func Load(dict map[string]*Support, r io.Reader) error
- func Open(dict map[string]*Support, filenames ...string) (map[string]*Support, error)
- type Function
- type Mode
- type Scanner
- type Support
- func (s *Support) Append(on time.Time, q float64)
- func (s Support) At(i int) (time.Time, float64)
- func (s *Support) Delta() *Support
- func (s Support) Find(t time.Time) int
- func (s *Support) If(cond ValueCond) *Support
- func (s Support) Len() int
- func (s *Support) Scan(initial float64, scanner Scanner) *Support
- func (s *Support) Times() iter.Seq[time.Time]
- func (s *Support) Values() iter.Seq2[time.Time, float64]
- type TimeCond
- type ValueCond
Constants ¶
const Day = 24 * time.Hour
Variables ¶
var ( CondPositive = func(v float64) bool { return v > 0 } CondNegative = func(v float64) bool { return v < 0 } )
var ( // list all scanner function ScannerAcc = func(c, v float64) float64 { return c + v } )
Acc is a Scanner to compute the cumulative value of a support.
Functions ¶
func CondEndOfMonth ¶
CondEndOfMonth return true if 't' represent the last day of the month.
func CondQuarterly ¶
CondQuarterly returns true if 't' represent the first day of a new quarter, jan or apr or jul or oct 1st.
func CondYearly ¶
Condyearly returns true if 't' represent the first day of a new year (a january first).
func Days ¶
Days returns a list of all days starting with 'from' (included) ends after 'end' and return only days accepted by time condition.
func Iterate ¶
Iterate returns an iterator over all event time in chronological order, without repetition.
Types ¶
type Function ¶
type Function struct { Support // contains filtered or unexported fields }
Function is the interface of all support-based functions.
type Mode ¶
type Mode int
const ( ModeNullset Mode = iota // function defined only on the support, NaN everywhere else. ModeStep // Function's value between two support events is the value of the earliest. //ModeLinear // Function's value between two support events is a linear interpolation between the two. LenMode // not a mode but the length of modes )
type Support ¶
type Support struct {
// contains filtered or unexported fields
}
Support struct contains the time based finite support for real-valued functions.
func (*Support) Delta ¶
Delta loop over all interval in this support and returns a new support defined at the end of each interval with the delta on this interval.
func (*Support) Scan ¶
Scan computes a new Support by cumulating values, so that
c:= initial
for value 'v' in support 's' do c <- f(c, v) and append c to the new support
type TimeCond ¶
TimeCond is a function to filter in some events