2017-12-11 14:47:52 +01:00
|
|
|
import { BaseModel } from './BaseModel';
|
|
|
|
import { FormGroup } from '@angular/forms';
|
|
|
|
import { FormGenerator } from './interfaces/FormGenerator';
|
|
|
|
import { Serializable } from './interfaces/Serializable';
|
2018-10-05 17:00:54 +02:00
|
|
|
export class Multiplicity extends BaseModel implements Serializable<Multiplicity>, FormGenerator<FormGroup> {
|
|
|
|
public min: number;
|
|
|
|
public max: number;
|
2017-12-11 14:47:52 +01:00
|
|
|
|
2018-10-05 17:00:54 +02:00
|
|
|
fromJSONObject(item: any): Multiplicity {
|
|
|
|
this.min = item.min;
|
|
|
|
this.max = item.max;
|
|
|
|
return this;
|
|
|
|
}
|
2017-12-11 14:47:52 +01:00
|
|
|
|
2018-10-05 17:00:54 +02:00
|
|
|
buildForm(): FormGroup {
|
|
|
|
const formGroup = this.formBuilder.group({
|
|
|
|
min: [this.min],
|
|
|
|
max: [this.max]
|
2017-12-11 14:47:52 +01:00
|
|
|
|
2018-10-05 17:00:54 +02:00
|
|
|
});
|
|
|
|
return formGroup;
|
|
|
|
}
|
|
|
|
}
|