import type { IReset } from "@thi.ng/api" ; import { AProc } from "./aproc.js" ; param coeff export const integrator = ( coeff ? , start ? ) => new Integrator ( coeff , start ) ; export class Integrator extends AProc < number , number > implements IReset { constructor ( protected _coeff = 1 , protected _start = 0 ) { super ( _start ) ; } reset ( ) { this . _val = this . _start ; return this ; } next ( x ) { return ( this . _val = this . _val * this . _coeff + x ) ; } coeff ( ) { return this . _coeff ; } setCoeff ( c ) { this . _coeff = c ; } }