ts2famix 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/.eslintrc.json +24 -0
  2. package/.github/workflows/node.js.yml +60 -0
  3. package/LICENSE +23 -0
  4. package/README.md +111 -0
  5. package/doc-metamodel/skins.include.puml +2 -0
  6. package/jest.config.ts +199 -0
  7. package/package.json +47 -0
  8. package/src/analyze.ts +90 -0
  9. package/src/analyze_functions/processAccesses.ts +50 -0
  10. package/src/analyze_functions/processFiles.ts +656 -0
  11. package/src/analyze_functions/processImportClauses.ts +77 -0
  12. package/src/analyze_functions/processInheritances.ts +84 -0
  13. package/src/analyze_functions/processInvocations.ts +51 -0
  14. package/src/famix2puml.ts +119 -0
  15. package/src/famix_functions/famix_functions.ts +552 -0
  16. package/src/famix_functions/famix_functions_associations.ts +208 -0
  17. package/src/famix_functions/famix_functions_index.ts +44 -0
  18. package/src/famix_functions/famix_functions_types.ts +100 -0
  19. package/src/fqn.ts +127 -0
  20. package/src/fqp_implementation.ts +66 -0
  21. package/src/generate_uml.sh +16 -0
  22. package/src/lib/famix/License.md +23 -0
  23. package/src/lib/famix/package-lock.json +301 -0
  24. package/src/lib/famix/package.json +28 -0
  25. package/src/lib/famix/readme.md +5 -0
  26. package/src/lib/famix/src/famix_JSON_exporter.ts +56 -0
  27. package/src/lib/famix/src/famix_base_element.ts +18 -0
  28. package/src/lib/famix/src/famix_repository.ts +199 -0
  29. package/src/lib/famix/src/index.ts +8 -0
  30. package/src/lib/famix/src/model/famix/access.ts +53 -0
  31. package/src/lib/famix/src/model/famix/accessor.ts +15 -0
  32. package/src/lib/famix/src/model/famix/alias.ts +41 -0
  33. package/src/lib/famix/src/model/famix/association.ts +44 -0
  34. package/src/lib/famix/src/model/famix/behavioral_entity.ts +107 -0
  35. package/src/lib/famix/src/model/famix/c_source_language.ts +15 -0
  36. package/src/lib/famix/src/model/famix/class.ts +86 -0
  37. package/src/lib/famix/src/model/famix/comment.ts +50 -0
  38. package/src/lib/famix/src/model/famix/container_entity.ts +165 -0
  39. package/src/lib/famix/src/model/famix/custom_source_language.ts +27 -0
  40. package/src/lib/famix/src/model/famix/decorator.ts +39 -0
  41. package/src/lib/famix/src/model/famix/entity.ts +15 -0
  42. package/src/lib/famix/src/model/famix/enum.ts +31 -0
  43. package/src/lib/famix/src/model/famix/enum_value.ts +29 -0
  44. package/src/lib/famix/src/model/famix/function.ts +15 -0
  45. package/src/lib/famix/src/model/famix/implicit_variable.ts +15 -0
  46. package/src/lib/famix/src/model/famix/import_clause.ts +53 -0
  47. package/src/lib/famix/src/model/famix/index.ts +42 -0
  48. package/src/lib/famix/src/model/famix/indexed_file_anchor.ts +49 -0
  49. package/src/lib/famix/src/model/famix/inheritance.ts +42 -0
  50. package/src/lib/famix/src/model/famix/interface.ts +75 -0
  51. package/src/lib/famix/src/model/famix/invocation.ts +68 -0
  52. package/src/lib/famix/src/model/famix/method.ts +96 -0
  53. package/src/lib/famix/src/model/famix/module.ts +31 -0
  54. package/src/lib/famix/src/model/famix/named_entity.ts +98 -0
  55. package/src/lib/famix/src/model/famix/namespace.ts +28 -0
  56. package/src/lib/famix/src/model/famix/parameter.ts +29 -0
  57. package/src/lib/famix/src/model/famix/parameterizable_class.ts +31 -0
  58. package/src/lib/famix/src/model/famix/parameterizable_interface.ts +31 -0
  59. package/src/lib/famix/src/model/famix/parameterized_type.ts +40 -0
  60. package/src/lib/famix/src/model/famix/primitive_type.ts +15 -0
  61. package/src/lib/famix/src/model/famix/property.ts +54 -0
  62. package/src/lib/famix/src/model/famix/reference.ts +42 -0
  63. package/src/lib/famix/src/model/famix/scoping_entity.ts +31 -0
  64. package/src/lib/famix/src/model/famix/script_entity.ts +38 -0
  65. package/src/lib/famix/src/model/famix/source_anchor.ts +31 -0
  66. package/src/lib/famix/src/model/famix/source_language.ts +31 -0
  67. package/src/lib/famix/src/model/famix/sourced_entity.ts +70 -0
  68. package/src/lib/famix/src/model/famix/structural_entity.ts +44 -0
  69. package/src/lib/famix/src/model/famix/text_anchor.ts +49 -0
  70. package/src/lib/famix/src/model/famix/type.ts +88 -0
  71. package/src/lib/famix/src/model/famix/type_parameter.ts +33 -0
  72. package/src/lib/famix/src/model/famix/variable.ts +28 -0
  73. package/src/lib/famix/tsconfig.json +27 -0
  74. package/src/lib/famix/tslint.json +15 -0
  75. package/src/lib/ts-complex/cyclomatic-service.ts +85 -0
  76. package/src/ts2famix-cli.ts +26 -0
  77. package/src/ts2famix-tsconfig.ts +30 -0
  78. package/test/abstractClassWithComments.test.ts +58 -0
  79. package/test/abstracts.test.ts +53 -0
  80. package/test/access.test.ts +62 -0
  81. package/test/accesses.test.ts +42 -0
  82. package/test/accessorsWithDecorators.test.ts +98 -0
  83. package/test/alias.test.ts +39 -0
  84. package/test/classExtendsUndefinedClass.test.ts +41 -0
  85. package/test/classImplementsUndefinedInterface.test.ts +45 -0
  86. package/test/classWithDecorators.test.ts +65 -0
  87. package/test/entities.test.ts +232 -0
  88. package/test/entities_json.test.ts +48 -0
  89. package/test/enum.test.ts +55 -0
  90. package/test/functionReturnsFunction.test.ts +53 -0
  91. package/test/functionWithParameters.test.ts +38 -0
  92. package/test/functionWithVariables.test.ts +64 -0
  93. package/test/functions.test.ts +23 -0
  94. package/test/functionsInFunction.test.ts +40 -0
  95. package/test/functionsInMethod.test.ts +42 -0
  96. package/test/genericClass.test.ts +42 -0
  97. package/test/genericClassInheritsInterface.test.ts +47 -0
  98. package/test/genericInterface.test.ts +38 -0
  99. package/test/genericMethod.test.ts +65 -0
  100. package/test/genericWithInvocation.test.ts +71 -0
  101. package/test/generics.test.ts +68 -0
  102. package/test/inheritance.test.ts +50 -0
  103. package/test/interfaceInheritsInterface.test.ts +40 -0
  104. package/test/interfaceInheritsUndefinedInterface.test.ts +41 -0
  105. package/test/invocation.test.ts +94 -0
  106. package/test/invocationWithFunction.test.ts +42 -0
  107. package/test/invocationWithVariable.test.ts +46 -0
  108. package/test/invocation_json.test.ts +63 -0
  109. package/test/invocations.test.ts +131 -0
  110. package/test/jsDoc.test.ts +31 -0
  111. package/test/methodWithDecorator.test.ts +44 -0
  112. package/test/methods.test.ts +42 -0
  113. package/test/metrics.test.ts +51 -0
  114. package/test/module.test.ts +71 -0
  115. package/test/namespaces.test.ts +54 -0
  116. package/test/namespacesAndClasses.test.ts +66 -0
  117. package/test/parameterWithDecorators.test.ts +54 -0
  118. package/test/propertyWithDecorators.test.ts +80 -0
  119. package/test/sample.test.ts +13 -0
  120. package/test/simpleFunction.test.ts +32 -0
  121. package/test/simpleTest.test.ts +18 -0
  122. package/test/simpleTest2.test.ts +36 -0
  123. package/test/types.test.ts +58 -0
  124. package/test_src/sample.ts +103 -0
  125. package/test_src/sampleForModule.ts +10 -0
  126. package/test_src/sampleForModule2.ts +7 -0
  127. package/test_src/sampleForModule3.ts +2 -0
  128. package/tsconfig.json +70 -0
@@ -0,0 +1,15 @@
1
+ import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
+ import { Variable } from "./variable";
3
+
4
+ export class ImplicitVariable extends Variable {
5
+
6
+ public getJSON(): string {
7
+ const mse: FamixJSONExporter = new FamixJSONExporter("ImplicitVariable", this);
8
+ this.addPropertiesToExporter(mse);
9
+ return mse.getJSON();
10
+ }
11
+
12
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
13
+ super.addPropertiesToExporter(exporter);
14
+ }
15
+ }
@@ -0,0 +1,53 @@
1
+ import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
+ import { Association } from "./association";
3
+ import { Module } from "./module";
4
+ import { NamedEntity } from "./named_entity";
5
+
6
+ export class ImportClause extends Association {
7
+
8
+ private importer: Module;
9
+
10
+ public getImporter(): Module {
11
+ return this.importer;
12
+ }
13
+
14
+ public setImporter(importer: Module): void {
15
+ this.importer = importer;
16
+ importer.addImportClause(this);
17
+ }
18
+
19
+ private importedEntity: NamedEntity;
20
+
21
+ public getImportedEntity(): NamedEntity {
22
+ return this.importedEntity;
23
+ }
24
+
25
+ public setImportedEntity(importedEntity: NamedEntity): void {
26
+ this.importedEntity = importedEntity;
27
+ importedEntity.addImport(this);
28
+ }
29
+
30
+ private moduleSpecifier: string;
31
+
32
+ public getModuleSpecifier(): string {
33
+ return this.moduleSpecifier;
34
+ }
35
+
36
+ public setModuleSpecifier(moduleSpecifier: string): void {
37
+ this.moduleSpecifier = moduleSpecifier;
38
+ }
39
+
40
+
41
+ public getJSON(): string {
42
+ const mse: FamixJSONExporter = new FamixJSONExporter("ImportClause", this);
43
+ this.addPropertiesToExporter(mse);
44
+ return mse.getJSON();
45
+ }
46
+
47
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
48
+ super.addPropertiesToExporter(exporter);
49
+ exporter.addProperty("importer", this.getImporter());
50
+ exporter.addProperty("importedEntity", this.getImportedEntity());
51
+ exporter.addProperty("moduleSpecifier", this.getModuleSpecifier());
52
+ }
53
+ }
@@ -0,0 +1,42 @@
1
+ export {Access} from "./access";
2
+ export {Accessor} from "./accessor";
3
+ export {Alias} from "./alias";
4
+ export {Association} from "./association";
5
+ export {BehavioralEntity} from "./behavioral_entity";
6
+ export {CSourceLanguage} from "./c_source_language";
7
+ export {Class} from "./class";
8
+ export {Comment} from "./comment";
9
+ export {ContainerEntity} from "./container_entity";
10
+ export {CustomSourceLanguage} from "./custom_source_language";
11
+ export {Decorator} from "./decorator";
12
+ export {Entity} from "./entity";
13
+ export {EnumValue} from "./enum_value";
14
+ export {Enum} from "./enum";
15
+ export {Property} from "./property";
16
+ export {Function} from "./function";
17
+ export {ImplicitVariable} from "./implicit_variable";
18
+ export {ImportClause} from "./import_clause";
19
+ export {IndexedFileAnchor} from "./indexed_file_anchor";
20
+ export {Inheritance} from "./inheritance";
21
+ export {Interface} from "./interface";
22
+ export {Invocation} from "./invocation";
23
+ export {Method} from "./method";
24
+ export {Module} from "./module";
25
+ export {NamedEntity} from "./named_entity";
26
+ export {Namespace} from "./namespace";
27
+ export {TypeParameter} from "./type_parameter";
28
+ export {Parameter} from "./parameter";
29
+ export {ParameterizableClass} from "./parameterizable_class";
30
+ export {ParameterizableInterface} from "./parameterizable_interface";
31
+ export {ParameterizedType} from "./parameterized_type";
32
+ export {PrimitiveType} from "./primitive_type";
33
+ export {Reference} from "./reference";
34
+ export {ScopingEntity} from "./scoping_entity";
35
+ export {ScriptEntity} from "./script_entity";
36
+ export {SourceAnchor} from "./source_anchor";
37
+ export {SourceLanguage} from "./source_language";
38
+ export {SourcedEntity} from "./sourced_entity";
39
+ export {StructuralEntity} from "./structural_entity";
40
+ export {TextAnchor} from "./text_anchor";
41
+ export {Type} from "./type";
42
+ export {Variable} from "./variable";
@@ -0,0 +1,49 @@
1
+ import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
+ import { SourceAnchor } from "./source_anchor";
3
+
4
+ export class IndexedFileAnchor extends SourceAnchor {
5
+
6
+ private startPos: number;
7
+
8
+ public getStartPos(): number {
9
+ return this.startPos;
10
+ }
11
+
12
+ public setStartPos(startPos: number): void {
13
+ this.startPos = startPos;
14
+ }
15
+
16
+ private endPos: number;
17
+
18
+ public getEndPos(): number {
19
+ return this.endPos;
20
+ }
21
+
22
+ public setEndPos(endPos: number): void {
23
+ this.endPos = endPos;
24
+ }
25
+
26
+ private fileName: string;
27
+
28
+ public getFileName(): string {
29
+ return this.fileName;
30
+ }
31
+
32
+ public setFileName(fileName: string): void {
33
+ this.fileName = fileName;
34
+ }
35
+
36
+
37
+ public getJSON(): string {
38
+ const mse: FamixJSONExporter = new FamixJSONExporter("IndexedFileAnchor", this);
39
+ this.addPropertiesToExporter(mse);
40
+ return mse.getJSON();
41
+ }
42
+
43
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
44
+ super.addPropertiesToExporter(exporter);
45
+ exporter.addProperty("startPos", this.getStartPos());
46
+ exporter.addProperty("endPos", this.getEndPos());
47
+ exporter.addProperty("fileName", this.getFileName());
48
+ }
49
+ }
@@ -0,0 +1,42 @@
1
+ import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
+ import { Association } from "./association";
3
+ import { Class } from "./class";
4
+ import { Interface } from "./interface";
5
+
6
+ export class Inheritance extends Association {
7
+
8
+ private superclass: Class | Interface;
9
+
10
+ public getSuperclass(): Class | Interface {
11
+ return this.superclass;
12
+ }
13
+
14
+ public setSuperclass(superclass: Class | Interface): void {
15
+ this.superclass = superclass;
16
+ superclass.addSubInheritance(this);
17
+ }
18
+
19
+ private subclass: Class | Interface;
20
+
21
+ public getSubclass(): Class | Interface {
22
+ return this.subclass;
23
+ }
24
+
25
+ public setSubclass(subclass: Class | Interface): void {
26
+ this.subclass = subclass;
27
+ subclass.addSuperInheritance(this);
28
+ }
29
+
30
+
31
+ public getJSON(): string {
32
+ const mse: FamixJSONExporter = new FamixJSONExporter("Inheritance", this);
33
+ this.addPropertiesToExporter(mse);
34
+ return mse.getJSON();
35
+ }
36
+
37
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
38
+ super.addPropertiesToExporter(exporter);
39
+ exporter.addProperty("superclass", this.getSuperclass());
40
+ exporter.addProperty("subclass", this.getSubclass());
41
+ }
42
+ }
@@ -0,0 +1,75 @@
1
+ import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
+ import { Type } from "./type";
3
+ import { Method } from "./method";
4
+ import { Property } from "./property";
5
+ import { Inheritance } from "./inheritance";
6
+
7
+ export class Interface extends Type {
8
+
9
+ private properties: Set<Property> = new Set();
10
+
11
+ public getProperties(): Set<Property> {
12
+ return this.properties;
13
+ }
14
+
15
+ public addProperty(property: Property): void {
16
+ if (!this.properties.has(property)) {
17
+ this.properties.add(property);
18
+ property.setParentEntity(this);
19
+ }
20
+ }
21
+
22
+ private methods: Set<Method> = new Set();
23
+
24
+ public getMethods(): Set<Method> {
25
+ return this.methods;
26
+ }
27
+
28
+ public addMethod(method: Method): void {
29
+ if (!this.methods.has(method)) {
30
+ this.methods.add(method);
31
+ method.setParentEntity(this);
32
+ }
33
+ }
34
+
35
+ private superInheritances: Set<Inheritance> = new Set();
36
+
37
+ public getSuperInheritances(): Set<Inheritance> {
38
+ return this.superInheritances;
39
+ }
40
+
41
+ public addSuperInheritance(superInheritance: Inheritance): void {
42
+ if (!this.superInheritances.has(superInheritance)) {
43
+ this.superInheritances.add(superInheritance);
44
+ superInheritance.setSubclass(this);
45
+ }
46
+ }
47
+
48
+ private subInheritances: Set<Inheritance> = new Set();
49
+
50
+ public getSubInheritances(): Set<Inheritance> {
51
+ return this.subInheritances;
52
+ }
53
+
54
+ public addSubInheritance(subInheritance: Inheritance): void {
55
+ if (!this.subInheritances.has(subInheritance)) {
56
+ this.subInheritances.add(subInheritance);
57
+ subInheritance.setSuperclass(this);
58
+ }
59
+ }
60
+
61
+
62
+ public getJSON(): string {
63
+ const mse: FamixJSONExporter = new FamixJSONExporter("Interface", this);
64
+ this.addPropertiesToExporter(mse);
65
+ return mse.getJSON();
66
+ }
67
+
68
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
69
+ super.addPropertiesToExporter(exporter);
70
+ exporter.addProperty("properties", this.getProperties());
71
+ exporter.addProperty("methods", this.getMethods());
72
+ exporter.addProperty("superInheritances", this.getSuperInheritances());
73
+ exporter.addProperty("subInheritances", this.getSubInheritances());
74
+ }
75
+ }
@@ -0,0 +1,68 @@
1
+ import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
+ import { NamedEntity } from "./named_entity";
3
+ import { Association } from "./association";
4
+ import { BehavioralEntity } from "./behavioral_entity";
5
+ import { ContainerEntity } from "./container_entity";
6
+
7
+ export class Invocation extends Association {
8
+
9
+ private candidates: Set<BehavioralEntity> = new Set();
10
+
11
+ public getCandidates(): Set<BehavioralEntity> {
12
+ return this.candidates;
13
+ }
14
+
15
+ public addCandidate(candidate: BehavioralEntity): void {
16
+ if (!this.candidates.has(candidate)) {
17
+ this.candidates.add(candidate);
18
+ candidate.addIncomingInvocation(this);
19
+ }
20
+ }
21
+
22
+ private receiver: NamedEntity;
23
+
24
+ public getReceiver(): NamedEntity {
25
+ return this.receiver;
26
+ }
27
+
28
+ public setReceiver(receiver: NamedEntity): void {
29
+ this.receiver = receiver;
30
+ receiver.addReceivedInvocation(this);
31
+ }
32
+
33
+ private sender: ContainerEntity;
34
+
35
+ public getSender(): ContainerEntity {
36
+ return this.sender;
37
+ }
38
+
39
+ public setSender(sender: ContainerEntity): void {
40
+ this.sender = sender;
41
+ sender.addOutgoingInvocation(this);
42
+ }
43
+
44
+ private signature: string;
45
+
46
+ public getSignature(): string {
47
+ return this.signature;
48
+ }
49
+
50
+ public setSignature(signature: string): void {
51
+ this.signature = signature;
52
+ }
53
+
54
+
55
+ public getJSON(): string {
56
+ const mse: FamixJSONExporter = new FamixJSONExporter("Invocation", this);
57
+ this.addPropertiesToExporter(mse);
58
+ return mse.getJSON();
59
+ }
60
+
61
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
62
+ super.addPropertiesToExporter(exporter);
63
+ exporter.addProperty("candidates", this.getCandidates());
64
+ exporter.addProperty("receiver", this.getReceiver());
65
+ exporter.addProperty("sender", this.getSender());
66
+ exporter.addProperty("signature", this.getSignature());
67
+ }
68
+ }
@@ -0,0 +1,96 @@
1
+ import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
+ import { BehavioralEntity } from "./behavioral_entity";
3
+ import { Class } from "./class";
4
+ import { Interface } from "./interface";
5
+
6
+ export class Method extends BehavioralEntity {
7
+
8
+ private parentEntity: Class | Interface;
9
+
10
+ public getParentEntity(): Class | Interface {
11
+ return this.parentEntity;
12
+ }
13
+
14
+ public setParentEntity(parentEntity: Class | Interface): void {
15
+ this.parentEntity = parentEntity;
16
+ parentEntity.addMethod(this);
17
+ }
18
+
19
+ private kind: string;
20
+
21
+ public getKind(): string {
22
+ return this.kind;
23
+ }
24
+
25
+ public setKind(kind: string): void {
26
+ this.kind = kind;
27
+ }
28
+
29
+ private isAbstract: boolean;
30
+
31
+ public getIsAbstract(): boolean {
32
+ return this.isAbstract;
33
+ }
34
+
35
+ public setIsAbstract(isAbstract: boolean): void {
36
+ this.isAbstract = isAbstract;
37
+ }
38
+
39
+ private isClassSide: boolean;
40
+
41
+ public getIsClassSide(): boolean {
42
+ return this.isClassSide;
43
+ }
44
+
45
+ public setIsClassSide(isClassSide: boolean): void {
46
+ this.isClassSide = isClassSide;
47
+ }
48
+
49
+ private isPrivate: boolean;
50
+
51
+ public getIsPrivate(): boolean {
52
+ return this.isPrivate;
53
+ }
54
+
55
+ public setIsPrivate(isPrivate: boolean): void {
56
+ this.isPrivate = isPrivate;
57
+ }
58
+
59
+ private isPublic: boolean;
60
+
61
+ public getIsPublic(): boolean {
62
+ return this.isPublic;
63
+ }
64
+
65
+ public setIsPublic(isPublic: boolean): void {
66
+ this.isPublic = isPublic;
67
+ }
68
+
69
+ private isProtected: boolean;
70
+
71
+ public getIsProtected(): boolean {
72
+ return this.isProtected;
73
+ }
74
+
75
+ public setIsProtected(isProtected: boolean): void {
76
+ this.isProtected = isProtected;
77
+ }
78
+
79
+
80
+ public getJSON(): string {
81
+ const mse: FamixJSONExporter = new FamixJSONExporter("Method", this);
82
+ this.addPropertiesToExporter(mse);
83
+ return mse.getJSON();
84
+ }
85
+
86
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
87
+ super.addPropertiesToExporter(exporter);
88
+ exporter.addProperty("parentEntity", this.getParentEntity());
89
+ exporter.addProperty("kind", this.getKind());
90
+ exporter.addProperty("isAbstract", this.getIsAbstract());
91
+ exporter.addProperty("isClassSide", this.getIsClassSide());
92
+ exporter.addProperty("isPrivate", this.getIsPrivate());
93
+ exporter.addProperty("isPublic", this.getIsPublic());
94
+ exporter.addProperty("isProtected", this.getIsProtected());
95
+ }
96
+ }
@@ -0,0 +1,31 @@
1
+ import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
+ import { ScriptEntity } from "./script_entity";
3
+ import { ImportClause } from "./import_clause";
4
+
5
+ export class Module extends ScriptEntity {
6
+
7
+ private importClauses: Set<ImportClause> = new Set();
8
+
9
+ public getImportClauses(): Set<ImportClause> {
10
+ return this.importClauses;
11
+ }
12
+
13
+ public addImportClause(importClause: ImportClause): void {
14
+ if (!this.importClauses.has(importClause)) {
15
+ this.importClauses.add(importClause);
16
+ importClause.setImporter(this);
17
+ }
18
+ }
19
+
20
+
21
+ public getJSON(): string {
22
+ const mse: FamixJSONExporter = new FamixJSONExporter("Module", this);
23
+ this.addPropertiesToExporter(mse);
24
+ return mse.getJSON();
25
+ }
26
+
27
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
28
+ super.addPropertiesToExporter(exporter);
29
+ exporter.addProperty("importClauses", this.getImportClauses());
30
+ }
31
+ }
@@ -0,0 +1,98 @@
1
+ import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
+ import { SourcedEntity } from "./sourced_entity";
3
+ import { Invocation } from "./invocation";
4
+ import { ImportClause } from "./import_clause";
5
+ import { Alias } from "./alias";
6
+ import { Decorator } from "./decorator";
7
+
8
+ export class NamedEntity extends SourcedEntity {
9
+
10
+ private fullyQualifiedName: string;
11
+
12
+ public getFullyQualifiedName(): string {
13
+ return this.fullyQualifiedName;
14
+ }
15
+
16
+ public setFullyQualifiedName(fullyQualifiedName: string): void {
17
+ this.fullyQualifiedName = fullyQualifiedName;
18
+ }
19
+
20
+ private receivedInvocations: Set<Invocation> = new Set();
21
+
22
+ public getReceivedInvocations(): Set<Invocation> {
23
+ return this.receivedInvocations;
24
+ }
25
+
26
+ public addReceivedInvocation(receivedInvocation: Invocation): void {
27
+ if (!this.receivedInvocations.has(receivedInvocation)) {
28
+ this.receivedInvocations.add(receivedInvocation);
29
+ receivedInvocation.setReceiver(this);
30
+ }
31
+ }
32
+
33
+ private imports: Set<ImportClause> = new Set();
34
+
35
+ public getImports(): Set<ImportClause> {
36
+ return this.imports;
37
+ }
38
+
39
+ public addImport(anImport: ImportClause): void {
40
+ if (!this.imports.has(anImport)) {
41
+ this.imports.add(anImport);
42
+ anImport.setImportedEntity(this);
43
+ }
44
+ }
45
+
46
+ private name: string;
47
+
48
+ public getName(): string {
49
+ return this.name;
50
+ }
51
+
52
+ public setName(name: string): void {
53
+ this.name = name;
54
+ }
55
+
56
+ private aliases: Set<Alias> = new Set();
57
+
58
+ public getAliases(): Set<Alias> {
59
+ return this.aliases;
60
+ }
61
+
62
+ public addAlias(alias: Alias): void {
63
+ if (!this.aliases.has(alias)) {
64
+ this.aliases.add(alias);
65
+ alias.setParentEntity(this);
66
+ }
67
+ }
68
+
69
+ private decorators: Set<Decorator> = new Set();
70
+
71
+ public getDecorators(): Set<Decorator> {
72
+ return this.decorators;
73
+ }
74
+
75
+ public addDecorator(decorator: Decorator): void {
76
+ if (!this.decorators.has(decorator)) {
77
+ this.decorators.add(decorator);
78
+ decorator.setDecoratedEntity(this);
79
+ }
80
+ }
81
+
82
+
83
+ public getJSON(): string {
84
+ const mse: FamixJSONExporter = new FamixJSONExporter("NamedEntity", this);
85
+ this.addPropertiesToExporter(mse);
86
+ return mse.getJSON();
87
+ }
88
+
89
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
90
+ super.addPropertiesToExporter(exporter);
91
+ exporter.addProperty("fullyQualifiedName", this.getFullyQualifiedName());
92
+ exporter.addProperty("receivedInvocations", this.getReceivedInvocations());
93
+ exporter.addProperty("imports", this.getImports());
94
+ exporter.addProperty("name", this.getName());
95
+ exporter.addProperty("aliases", this.getAliases());
96
+ exporter.addProperty("decorators", this.getDecorators());
97
+ }
98
+ }
@@ -0,0 +1,28 @@
1
+ import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
+ import { ScopingEntity } from "./scoping_entity";
3
+
4
+ export class Namespace extends ScopingEntity {
5
+
6
+ private parentScope: ScopingEntity;
7
+
8
+ public getParentScope(): ScopingEntity {
9
+ return this.parentScope;
10
+ }
11
+
12
+ public setParentScope(parentScope: ScopingEntity): void {
13
+ this.parentScope = parentScope;
14
+ parentScope.addNamespace(this);
15
+ }
16
+
17
+
18
+ public getJSON(): string {
19
+ const mse: FamixJSONExporter = new FamixJSONExporter("Namespace", this);
20
+ this.addPropertiesToExporter(mse);
21
+ return mse.getJSON();
22
+ }
23
+
24
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
25
+ super.addPropertiesToExporter(exporter);
26
+ exporter.addProperty("parentScope", this.getParentScope());
27
+ }
28
+ }
@@ -0,0 +1,29 @@
1
+ import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
+ import { StructuralEntity } from "./structural_entity";
3
+ import { BehavioralEntity } from "./behavioral_entity";
4
+
5
+ export class Parameter extends StructuralEntity {
6
+
7
+ private parentEntity: BehavioralEntity;
8
+
9
+ public getParentEntity(): BehavioralEntity {
10
+ return this.parentEntity;
11
+ }
12
+
13
+ public setParentEntity(parentEntity: BehavioralEntity): void {
14
+ this.parentEntity = parentEntity;
15
+ parentEntity.addParameter(this);
16
+ }
17
+
18
+
19
+ public getJSON(): string {
20
+ const mse: FamixJSONExporter = new FamixJSONExporter("Parameter", this);
21
+ this.addPropertiesToExporter(mse);
22
+ return mse.getJSON();
23
+ }
24
+
25
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
26
+ super.addPropertiesToExporter(exporter);
27
+ exporter.addProperty("parentEntity", this.getParentEntity());
28
+ }
29
+ }
@@ -0,0 +1,31 @@
1
+ import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
+ import { Class } from "./class";
3
+ import { TypeParameter } from "./type_parameter";
4
+
5
+ export class ParameterizableClass extends Class {
6
+
7
+ private typeParameters: Set<TypeParameter> = new Set();
8
+
9
+ public getTypeParameters(): Set<TypeParameter> {
10
+ return this.typeParameters;
11
+ }
12
+
13
+ public addTypeParameter(typeParameter: TypeParameter): void {
14
+ if (!this.typeParameters.has(typeParameter)) {
15
+ this.typeParameters.add(typeParameter);
16
+ typeParameter.setParentGeneric(this);
17
+ }
18
+ }
19
+
20
+
21
+ public getJSON(): string {
22
+ const mse: FamixJSONExporter = new FamixJSONExporter("ParameterizableClass", this);
23
+ this.addPropertiesToExporter(mse);
24
+ return mse.getJSON();
25
+ }
26
+
27
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
28
+ super.addPropertiesToExporter(exporter);
29
+ exporter.addProperty("typeParameters", this.getTypeParameters());
30
+ }
31
+ }