mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-20 00:23:03 +00:00
feat: add the uml generator
This commit is contained in:
56
src/uml/model/LightweightClassDefinition.ts
Normal file
56
src/uml/model/LightweightClassDefinition.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {LightweightDefinition} from './LightweightDefinition';
|
||||
import {LightweightProperty} from './LightweightProperty';
|
||||
/**
|
||||
* Represents a class definition
|
||||
*/
|
||||
export class LightweightClassDefinition extends LightweightDefinition {
|
||||
/**
|
||||
* String values of the extended definitions
|
||||
*/
|
||||
public extendedDefinitions: string[];
|
||||
|
||||
/**
|
||||
* String values of the implemented definitions
|
||||
*/
|
||||
public implementedDefinitions: string[];
|
||||
|
||||
/**
|
||||
* Properties of the definition
|
||||
*/
|
||||
public properties: LightweightProperty[];
|
||||
|
||||
/**
|
||||
* The definition type
|
||||
* e.g. `interface`/[`abstract`] `class`
|
||||
*/
|
||||
public type: string;
|
||||
|
||||
/**
|
||||
* Generic type parameters of this class
|
||||
*/
|
||||
public typeParameters: string[];
|
||||
|
||||
constructor(name: string, type: string) {
|
||||
super(name);
|
||||
this.type = type;
|
||||
this.properties = [];
|
||||
this.extendedDefinitions = [];
|
||||
this.implementedDefinitions = [];
|
||||
this.typeParameters = [];
|
||||
}
|
||||
}
|
||||
28
src/uml/model/LightweightDefinition.ts
Normal file
28
src/uml/model/LightweightDefinition.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents any definition without specifics
|
||||
*/
|
||||
export abstract class LightweightDefinition {
|
||||
/**
|
||||
* Name of the definiton
|
||||
*/
|
||||
public name: string;
|
||||
|
||||
constructor(name: string) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
30
src/uml/model/LightweightEnumDefinition.ts
Normal file
30
src/uml/model/LightweightEnumDefinition.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {LightweightDefinition} from './LightweightDefinition';
|
||||
/**
|
||||
* Represents an enum definition
|
||||
*/
|
||||
export class LightweightEnumDefinition extends LightweightDefinition {
|
||||
/**
|
||||
* Enumeration or union values
|
||||
*/
|
||||
public values: string[];
|
||||
|
||||
constructor(name: string) {
|
||||
super(name);
|
||||
this.values = [];
|
||||
}
|
||||
}
|
||||
54
src/uml/model/LightweightProperty.ts
Normal file
54
src/uml/model/LightweightProperty.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {LightweightType} from './LightweightType';
|
||||
|
||||
/**
|
||||
* Represents a property definition
|
||||
*/
|
||||
export class LightweightProperty {
|
||||
/**
|
||||
* Is the property inherited from another definition
|
||||
*/
|
||||
public inherited: boolean;
|
||||
|
||||
/**
|
||||
* Name of the property
|
||||
*/
|
||||
public name: string;
|
||||
|
||||
/**
|
||||
* Is the property marked as optional
|
||||
*/
|
||||
public optional: boolean;
|
||||
|
||||
/**
|
||||
* Type of the property
|
||||
*/
|
||||
public type: LightweightType;
|
||||
|
||||
/**
|
||||
* Constructor for LightweightProperty
|
||||
*
|
||||
* @param name Name of the property
|
||||
* @param type Type of the property
|
||||
* @param optional Is the property optional
|
||||
*/
|
||||
constructor(name: string, type: LightweightType, optional: boolean = true) {
|
||||
this.name = name;
|
||||
this.optional = optional;
|
||||
this.inherited = false;
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
85
src/uml/model/LightweightType.ts
Normal file
85
src/uml/model/LightweightType.ts
Normal file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Describes an easy to use type definition.
|
||||
*/
|
||||
export class LightweightType {
|
||||
/**
|
||||
* Contains all types inside of <> brackets
|
||||
*/
|
||||
genericsTypes: LightweightType[];
|
||||
|
||||
/**
|
||||
* Does the type have generic-parameters
|
||||
*/
|
||||
hasTypeInformation: boolean = false;
|
||||
|
||||
/**
|
||||
* Does the type represent an array type
|
||||
*/
|
||||
isArray: boolean = false;
|
||||
|
||||
/**
|
||||
* Does the type represent a literal type
|
||||
*/
|
||||
isLiteral: boolean = false;
|
||||
|
||||
/**
|
||||
* Does the type represent a primitive type
|
||||
*/
|
||||
isPrimitive: boolean = false;
|
||||
|
||||
/**
|
||||
* Does the type contain a reference to
|
||||
*/
|
||||
isReference: boolean = false;
|
||||
|
||||
/**
|
||||
* Is the type a reflection and not avaiblabe at compile time
|
||||
*/
|
||||
isReflection: boolean = false;
|
||||
|
||||
/**
|
||||
* Does the type have type parameters
|
||||
*/
|
||||
isTyped: boolean = false;
|
||||
|
||||
/**
|
||||
* Is the type a typed parameter
|
||||
*/
|
||||
isTypeParameter: boolean = false;
|
||||
|
||||
/**
|
||||
* Is the type a union type
|
||||
*/
|
||||
isUnion: boolean = false;
|
||||
|
||||
/**
|
||||
* Name of the type
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* Type specifications, if the type is combined by either an array, union or a typeOperator
|
||||
*/
|
||||
specificationTypes: LightweightType[];
|
||||
|
||||
constructor() {
|
||||
this.specificationTypes = [];
|
||||
this.genericsTypes = [];
|
||||
this.name = '';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user