export class container { public id: number; private CountedValue: number; public countStartedAt: number; public containerFillAtStart: number; private currentDifference: number; constructor(id: number, startedAt?: number) { this.id = id; this.CountedValue = 0; this.currentDifference = 0; this.countStartedAt = startedAt; } newValue(value: number) { this.currentDifference = value - this.countStartedAt; } get countedValue() { return this.CountedValue + this.currentDifference; } save() { this.CountedValue = this.CountedValue + this.currentDifference; this.currentDifference = 0; } }