1 | import { MeasuredItemModel } from './measured-item.model';
|
2 |
|
3 | export class MeasuredSerieModel {
|
4 | private id: number = Math.round(Math.random() * 1000);
|
5 | private readonly measurements: MeasuredItemModel[] = [];
|
6 | private title: string;
|
7 | private unit: string;
|
8 |
|
9 | public constructor(title: string, unit: string) {
|
10 | this.title = title;
|
11 | this.unit = unit;
|
12 | }
|
13 |
|
14 | public addMeasurement(measurement: MeasuredItemModel): void {
|
15 | this.measurements.push(measurement);
|
16 | }
|
17 | public remmoveMeasurement(measurement: MeasuredItemModel): void {
|
18 | const index = this.measurements.indexOf(measurement);
|
19 | if (index >= 0) {
|
20 | this.measurements.splice(index, 1);
|
21 | }
|
22 | }
|
23 | public setId(id: number): void {
|
24 | this.id = id;
|
25 | }
|
26 | public getId(): number {
|
27 | return this.id;
|
28 | }
|
29 | public getMeasurements(): MeasuredItemModel[] {
|
30 | return this.measurements;
|
31 | }
|
32 | public setTitle(title: string): void {
|
33 | this.title = title;
|
34 | }
|
35 | public getTitle(): string {
|
36 | return this.title;
|
37 | }
|
38 | public setUnit(unit: string): void {
|
39 | this.unit = unit;
|
40 | }
|
41 | public getUnit(): string {
|
42 | return this.unit;
|
43 | }
|
44 | }
|