2019-10-17 16:44:15 +02:00
|
|
|
import { TypeDefinition } from '../is-model/types/TypeDefinition';
|
2019-10-11 18:16:14 +02:00
|
|
|
|
|
|
|
export class Type {
|
|
|
|
|
|
|
|
name: string;
|
|
|
|
description: string;
|
|
|
|
abstract: boolean;
|
|
|
|
parent: Type;
|
|
|
|
children: Type[];
|
|
|
|
|
2019-10-16 11:48:47 +02:00
|
|
|
constructor(isType: TypeDefinition) {
|
2019-10-11 18:16:14 +02:00
|
|
|
this.name = isType.name;
|
|
|
|
this.description = isType.description;
|
|
|
|
this.abstract = isType.abstract;
|
|
|
|
this.children = new Array();
|
|
|
|
}
|
|
|
|
|
|
|
|
addChild(type: Type) {
|
|
|
|
type.parent = this;
|
|
|
|
this.children.push(type);
|
2019-10-14 15:56:35 +02:00
|
|
|
this.children.sort((left, right) => left.name.localeCompare(right.name));
|
2019-10-11 18:16:14 +02:00
|
|
|
}
|
|
|
|
|
2019-10-16 11:02:59 +02:00
|
|
|
}
|