modelling/lib/ControlModel.ts
2020-05-02 21:18:32 +02:00

37 lines
874 B
TypeScript

/*
* Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of Modelling which is released under MIT.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, May 2020
*/
export abstract class ControlModel {
protected data: Record<string, string|number|boolean> = {};
public get object (): Record<string, string|number|boolean> {
return this.data;
}
public set object (obj: Record<string, string|number|boolean>) {
this.data = obj;
}
public constructor (obj: Record<string, string|number|boolean>) {
this.object = obj;
}
public get (key: string): string|number|boolean {
return this.data[key];
}
public set (key: string, value: string|number|boolean): void {
this.data[key] = value;
}
public update (): void {
this.verify ();
}
public abstract verify(): void;
}