class Flow { duration: number tx: number rx: number constructor(duration: number, tx: number, rx: number) { this.duration = duration this.tx = tx this.rx = rx } addFlow(tx: number, rx: number) { this.tx += tx this.rx += rx } print() { return { "tx": this.duration == 0 ? 0 : ((this.tx / 1024 / this.duration).toFixed(2) + "KB/S"), "rx": this.duration == 0 ? 0 : ((this.rx / 1024 / this.duration).toFixed(2) + "KB/S") } } getMBTx(): number { return (this.tx / 1024 / 1024) } getMBRx(): number { return (this.rx / 1024 / 1024) } } export = Flow