ts2famix 1.4.1 → 2.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 (210) hide show
  1. package/LICENSE +1 -0
  2. package/README.md +30 -61
  3. package/dist/analyze.js +4 -2
  4. package/dist/analyze_functions/process_functions.js +285 -131
  5. package/dist/famix_functions/EntityDictionary.js +864 -231
  6. package/dist/famix_functions/helpers_creation.js +61 -10
  7. package/dist/fqn.js +160 -111
  8. package/dist/lib/famix/famix_JSON_exporter.js +55 -0
  9. package/dist/lib/famix/famix_base_element.js +18 -0
  10. package/dist/lib/famix/famix_repository.js +224 -0
  11. package/dist/lib/famix/{src/index.js → index.js} +1 -0
  12. package/dist/lib/famix/model/famix/access.js +40 -0
  13. package/dist/lib/famix/model/famix/accessor.js +17 -0
  14. package/dist/lib/famix/model/famix/alias.js +33 -0
  15. package/dist/lib/famix/model/famix/arrow_function.js +17 -0
  16. package/dist/lib/famix/model/famix/behavioral_entity.js +79 -0
  17. package/dist/lib/famix/model/famix/class.js +71 -0
  18. package/dist/lib/famix/model/famix/comment.js +39 -0
  19. package/dist/lib/famix/model/famix/concretisation.js +31 -0
  20. package/dist/lib/famix/model/famix/container_entity.js +126 -0
  21. package/dist/lib/famix/model/famix/decorator.js +32 -0
  22. package/dist/lib/famix/model/famix/entity.js +17 -0
  23. package/dist/lib/famix/model/famix/enum.js +31 -0
  24. package/dist/lib/famix/model/famix/enum_value.js +25 -0
  25. package/dist/lib/famix/model/famix/function.js +17 -0
  26. package/dist/lib/famix/model/famix/import_clause.js +41 -0
  27. package/dist/lib/famix/model/famix/index.js +86 -0
  28. package/dist/lib/famix/model/famix/indexed_file_anchor.js +38 -0
  29. package/dist/lib/famix/model/famix/inheritance.js +33 -0
  30. package/dist/lib/famix/model/famix/interface.js +64 -0
  31. package/dist/lib/famix/model/famix/invocation.js +54 -0
  32. package/dist/lib/famix/model/famix/method.js +67 -0
  33. package/dist/lib/famix/model/famix/module.js +60 -0
  34. package/dist/lib/famix/model/famix/named_entity.js +78 -0
  35. package/dist/lib/famix/model/famix/parameter.js +25 -0
  36. package/dist/lib/famix/model/famix/parameter_concretisation.js +44 -0
  37. package/dist/lib/famix/model/famix/parameter_type.js +45 -0
  38. package/dist/lib/famix/model/famix/parametric_arrow_function.js +31 -0
  39. package/dist/lib/famix/model/famix/parametric_class.js +44 -0
  40. package/dist/lib/famix/model/famix/parametric_function.js +31 -0
  41. package/dist/lib/famix/model/famix/parametric_interface.js +44 -0
  42. package/dist/lib/famix/model/famix/parametric_method.js +31 -0
  43. package/dist/lib/famix/model/famix/primitive_type.js +17 -0
  44. package/dist/lib/famix/model/famix/property.js +73 -0
  45. package/dist/lib/famix/model/famix/reference.js +33 -0
  46. package/dist/lib/famix/model/famix/scoping_entity.js +36 -0
  47. package/dist/lib/famix/model/famix/script_entity.js +29 -0
  48. package/dist/lib/famix/model/famix/source_anchor.js +27 -0
  49. package/dist/lib/famix/model/famix/source_language.js +35 -0
  50. package/dist/lib/famix/model/famix/sourced_entity.js +60 -0
  51. package/dist/lib/famix/model/famix/structural_entity.js +39 -0
  52. package/dist/lib/famix/model/famix/type.js +73 -0
  53. package/dist/lib/famix/model/famix/variable.js +24 -0
  54. package/dist/lib/ts-complex/cyclomatic-service.js +3 -3
  55. package/dist/refactorer/refactor-getter-setter.js +142 -0
  56. package/dist/ts2famix-cli-wrapper.js +42 -0
  57. package/dist/ts2famix-cli.js +8 -1
  58. package/dist/ts2famix-tsconfig.js +1 -0
  59. package/doc-uml/famix-typescript-model.puml +608 -0
  60. package/doc-uml/famix-typescript-model.svg +1 -0
  61. package/jest.config.json +2 -1
  62. package/package.json +13 -12
  63. package/src/analyze.ts +24 -23
  64. package/src/analyze_functions/process_functions.ts +310 -129
  65. package/src/famix_functions/EntityDictionary.ts +949 -271
  66. package/src/famix_functions/helpers_creation.ts +64 -6
  67. package/src/fqn.ts +169 -96
  68. package/{dist/lib/famix/src/famix_JSON_exporter.js → src/lib/famix/famix_JSON_exporter.ts} +16 -14
  69. package/src/lib/famix/famix_base_element.ts +22 -0
  70. package/{dist/lib/famix/src/famix_repository.js → src/lib/famix/famix_repository.ts} +96 -75
  71. package/src/lib/famix/model/famix/access.ts +50 -0
  72. package/src/lib/famix/model/famix/alias.ts +39 -0
  73. package/src/lib/famix/{src/model/famix/implicit_variable.ts → model/famix/arrow_function.ts} +3 -3
  74. package/src/lib/famix/model/famix/behavioral_entity.ts +97 -0
  75. package/src/lib/famix/model/famix/class.ts +85 -0
  76. package/src/lib/famix/model/famix/comment.ts +47 -0
  77. package/src/lib/famix/model/famix/concretisation.ts +40 -0
  78. package/src/lib/famix/model/famix/container_entity.ts +160 -0
  79. package/src/lib/famix/model/famix/decorator.ts +37 -0
  80. package/src/lib/famix/model/famix/enum.ts +30 -0
  81. package/src/lib/famix/model/famix/enum_value.ts +28 -0
  82. package/src/lib/famix/model/famix/import_clause.ts +51 -0
  83. package/src/lib/famix/{src/model → model}/famix/index.ts +8 -7
  84. package/src/lib/famix/model/famix/indexed_file_anchor.ts +46 -0
  85. package/src/lib/famix/model/famix/inheritance.ts +40 -0
  86. package/src/lib/famix/model/famix/interface.ts +75 -0
  87. package/src/lib/famix/model/famix/invocation.ts +65 -0
  88. package/src/lib/famix/model/famix/method.ts +89 -0
  89. package/src/lib/famix/model/famix/module.ts +71 -0
  90. package/src/lib/famix/model/famix/named_entity.ts +95 -0
  91. package/src/lib/famix/{src/model → model}/famix/parameter.ts +11 -12
  92. package/src/lib/famix/model/famix/parameter_concretisation.ts +51 -0
  93. package/src/lib/famix/model/famix/parameter_type.ts +58 -0
  94. package/src/lib/famix/model/famix/parametric_arrow_function.ts +32 -0
  95. package/src/lib/famix/model/famix/parametric_class.ts +49 -0
  96. package/src/lib/famix/model/famix/parametric_function.ts +32 -0
  97. package/src/lib/famix/model/famix/parametric_interface.ts +49 -0
  98. package/src/lib/famix/model/famix/parametric_method.ts +32 -0
  99. package/src/lib/famix/model/famix/primitive_type.ts +15 -0
  100. package/src/lib/famix/model/famix/property.ts +94 -0
  101. package/src/lib/famix/model/famix/reference.ts +40 -0
  102. package/src/lib/famix/model/famix/scoping_entity.ts +35 -0
  103. package/src/lib/famix/model/famix/script_entity.ts +34 -0
  104. package/src/lib/famix/model/famix/source_anchor.ts +30 -0
  105. package/src/lib/famix/model/famix/source_language.ts +35 -0
  106. package/src/lib/famix/model/famix/sourced_entity.ts +70 -0
  107. package/src/lib/famix/model/famix/structural_entity.ts +43 -0
  108. package/src/lib/famix/model/famix/type.ts +87 -0
  109. package/src/lib/famix/model/famix/variable.ts +27 -0
  110. package/src/lib/famix/package.json +1 -1
  111. package/src/lib/ts-complex/cyclomatic-service.ts +10 -10
  112. package/src/refactorer/refactor-getter-setter.ts +140 -0
  113. package/src/ts2famix-cli-wrapper.ts +21 -0
  114. package/src/ts2famix-cli.ts +8 -2
  115. package/tsconfig.check-tests.json +14 -0
  116. package/tsconfig.json +71 -69
  117. package/dist/famix2puml.js +0 -125
  118. package/dist/lib/famix/src/famix_base_element.js +0 -17
  119. package/dist/lib/famix/src/model/famix/access.js +0 -39
  120. package/dist/lib/famix/src/model/famix/accessor.js +0 -16
  121. package/dist/lib/famix/src/model/famix/alias.js +0 -32
  122. package/dist/lib/famix/src/model/famix/association.js +0 -36
  123. package/dist/lib/famix/src/model/famix/behavioral_entity.js +0 -81
  124. package/dist/lib/famix/src/model/famix/class.js +0 -70
  125. package/dist/lib/famix/src/model/famix/comment.js +0 -38
  126. package/dist/lib/famix/src/model/famix/container_entity.js +0 -125
  127. package/dist/lib/famix/src/model/famix/decorator.js +0 -31
  128. package/dist/lib/famix/src/model/famix/entity.js +0 -16
  129. package/dist/lib/famix/src/model/famix/enum.js +0 -30
  130. package/dist/lib/famix/src/model/famix/enum_value.js +0 -24
  131. package/dist/lib/famix/src/model/famix/function.js +0 -16
  132. package/dist/lib/famix/src/model/famix/implicit_variable.js +0 -16
  133. package/dist/lib/famix/src/model/famix/import_clause.js +0 -39
  134. package/dist/lib/famix/src/model/famix/index.js +0 -83
  135. package/dist/lib/famix/src/model/famix/indexed_file_anchor.js +0 -51
  136. package/dist/lib/famix/src/model/famix/inheritance.js +0 -32
  137. package/dist/lib/famix/src/model/famix/interface.js +0 -63
  138. package/dist/lib/famix/src/model/famix/invocation.js +0 -53
  139. package/dist/lib/famix/src/model/famix/method.js +0 -66
  140. package/dist/lib/famix/src/model/famix/module.js +0 -31
  141. package/dist/lib/famix/src/model/famix/named_entity.js +0 -77
  142. package/dist/lib/famix/src/model/famix/namespace.js +0 -24
  143. package/dist/lib/famix/src/model/famix/parameter.js +0 -24
  144. package/dist/lib/famix/src/model/famix/parameter_type.js +0 -24
  145. package/dist/lib/famix/src/model/famix/parameterizable_class.js +0 -30
  146. package/dist/lib/famix/src/model/famix/parameterizable_interface.js +0 -30
  147. package/dist/lib/famix/src/model/famix/parameterized_type.js +0 -36
  148. package/dist/lib/famix/src/model/famix/primitive_type.js +0 -16
  149. package/dist/lib/famix/src/model/famix/property.js +0 -44
  150. package/dist/lib/famix/src/model/famix/reference.js +0 -32
  151. package/dist/lib/famix/src/model/famix/scoping_entity.js +0 -35
  152. package/dist/lib/famix/src/model/famix/script_entity.js +0 -30
  153. package/dist/lib/famix/src/model/famix/source_anchor.js +0 -26
  154. package/dist/lib/famix/src/model/famix/source_language.js +0 -35
  155. package/dist/lib/famix/src/model/famix/sourced_entity.js +0 -59
  156. package/dist/lib/famix/src/model/famix/structural_entity.js +0 -38
  157. package/dist/lib/famix/src/model/famix/text_anchor.js +0 -37
  158. package/dist/lib/famix/src/model/famix/type.js +0 -71
  159. package/dist/lib/famix/src/model/famix/variable.js +0 -23
  160. package/doc-uml/metamodel-full.svg +0 -1
  161. package/doc-uml/metamodel.svg +0 -1
  162. package/jest.config-old.ts +0 -199
  163. package/plantuml.jar +0 -0
  164. package/src/famix2puml.ts +0 -119
  165. package/src/lib/famix/package-lock.json +0 -301
  166. package/src/lib/famix/readme.md +0 -5
  167. package/src/lib/famix/src/famix_JSON_exporter.ts +0 -56
  168. package/src/lib/famix/src/famix_base_element.ts +0 -22
  169. package/src/lib/famix/src/famix_repository.ts +0 -243
  170. package/src/lib/famix/src/model/famix/access.ts +0 -53
  171. package/src/lib/famix/src/model/famix/alias.ts +0 -41
  172. package/src/lib/famix/src/model/famix/association.ts +0 -44
  173. package/src/lib/famix/src/model/famix/behavioral_entity.ts +0 -107
  174. package/src/lib/famix/src/model/famix/class.ts +0 -86
  175. package/src/lib/famix/src/model/famix/comment.ts +0 -50
  176. package/src/lib/famix/src/model/famix/container_entity.ts +0 -165
  177. package/src/lib/famix/src/model/famix/decorator.ts +0 -39
  178. package/src/lib/famix/src/model/famix/enum.ts +0 -31
  179. package/src/lib/famix/src/model/famix/enum_value.ts +0 -29
  180. package/src/lib/famix/src/model/famix/import_clause.ts +0 -53
  181. package/src/lib/famix/src/model/famix/indexed_file_anchor.ts +0 -71
  182. package/src/lib/famix/src/model/famix/inheritance.ts +0 -42
  183. package/src/lib/famix/src/model/famix/interface.ts +0 -75
  184. package/src/lib/famix/src/model/famix/invocation.ts +0 -68
  185. package/src/lib/famix/src/model/famix/method.ts +0 -96
  186. package/src/lib/famix/src/model/famix/module.ts +0 -31
  187. package/src/lib/famix/src/model/famix/named_entity.ts +0 -98
  188. package/src/lib/famix/src/model/famix/namespace.ts +0 -28
  189. package/src/lib/famix/src/model/famix/parameter_type.ts +0 -33
  190. package/src/lib/famix/src/model/famix/parameterizable_class.ts +0 -31
  191. package/src/lib/famix/src/model/famix/parameterizable_interface.ts +0 -31
  192. package/src/lib/famix/src/model/famix/parameterized_type.ts +0 -40
  193. package/src/lib/famix/src/model/famix/primitive_type.ts +0 -15
  194. package/src/lib/famix/src/model/famix/property.ts +0 -54
  195. package/src/lib/famix/src/model/famix/reference.ts +0 -42
  196. package/src/lib/famix/src/model/famix/scoping_entity.ts +0 -35
  197. package/src/lib/famix/src/model/famix/script_entity.ts +0 -38
  198. package/src/lib/famix/src/model/famix/source_anchor.ts +0 -31
  199. package/src/lib/famix/src/model/famix/source_language.ts +0 -37
  200. package/src/lib/famix/src/model/famix/sourced_entity.ts +0 -73
  201. package/src/lib/famix/src/model/famix/structural_entity.ts +0 -44
  202. package/src/lib/famix/src/model/famix/text_anchor.ts +0 -49
  203. package/src/lib/famix/src/model/famix/type.ts +0 -88
  204. package/src/lib/famix/src/model/famix/variable.ts +0 -28
  205. package/src/lib/famix/tsconfig.json +0 -27
  206. package/src/lib/famix/tslint.json +0 -15
  207. /package/src/lib/famix/{src/index.ts → index.ts} +0 -0
  208. /package/src/lib/famix/{src/model → model}/famix/accessor.ts +0 -0
  209. /package/src/lib/famix/{src/model → model}/famix/entity.ts +0 -0
  210. /package/src/lib/famix/{src/model → model}/famix/function.ts +0 -0
@@ -0,0 +1,40 @@
1
+ import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
+ import { Entity } from "./entity";
3
+ import { ParametricClass } from "./parametric_class";
4
+ import { ParametricFunction } from "./parametric_function";
5
+ import { ParametricInterface } from "./parametric_interface";
6
+ import { ParametricMethod } from "./parametric_method";
7
+
8
+ export class Concretisation extends Entity {
9
+
10
+ private _genericEntity!: ParametricClass | ParametricInterface | ParametricFunction | ParametricMethod;
11
+ private _concreteEntity!: ParametricClass | ParametricInterface | ParametricFunction | ParametricMethod; // is this correct?
12
+
13
+ public getJSON(): string {
14
+ const json: FamixJSONExporter = new FamixJSONExporter("Concretisation", this);
15
+ this.addPropertiesToExporter(json);
16
+ return json.getJSON();
17
+ }
18
+
19
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
20
+ super.addPropertiesToExporter(exporter);
21
+ exporter.addProperty("genericEntity", this.genericEntity);
22
+ exporter.addProperty("concreteEntity", this.concreteEntity);
23
+ }
24
+
25
+ get genericEntity() {
26
+ return this._genericEntity;
27
+ }
28
+
29
+ set genericEntity(genericEntity: ParametricClass | ParametricInterface | ParametricFunction | ParametricMethod) {
30
+ this._genericEntity = genericEntity;
31
+ }
32
+
33
+ get concreteEntity() {
34
+ return this._concreteEntity;
35
+ }
36
+
37
+ set concreteEntity(concreteEntity: ParametricClass | ParametricInterface | ParametricFunction | ParametricMethod) {
38
+ this._concreteEntity = concreteEntity;
39
+ }
40
+ }
@@ -0,0 +1,160 @@
1
+ import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
+ import { Type } from "./type";
3
+ import { Invocation } from "./invocation";
4
+ import { NamedEntity } from "./named_entity";
5
+ import { Reference } from "./reference";
6
+ import { Access } from "./access";
7
+ import { Function as FamixFunctionEntity } from "./function";
8
+ import { Variable } from "./variable";
9
+
10
+ export class ContainerEntity extends NamedEntity {
11
+
12
+ private _parentContainerEntity!: ContainerEntity;
13
+ private _childrenContainerEntities: Set<ContainerEntity> = new Set();
14
+
15
+ public addChildContainerEntity(childContainerEntity: ContainerEntity): void {
16
+ if (!this._childrenContainerEntities.has(childContainerEntity)) {
17
+ this._childrenContainerEntities.add(childContainerEntity);
18
+ childContainerEntity.parentContainerEntity = this;
19
+ }
20
+ }
21
+
22
+ private _cyclomaticComplexity!: number;
23
+ private _numberOfStatements!: number;
24
+ private _outgoingReferences: Set<Reference> = new Set();
25
+
26
+ public addOutgoingReference(outgoingReference: Reference): void {
27
+ if (!this._outgoingReferences.has(outgoingReference)) {
28
+ this._outgoingReferences.add(outgoingReference);
29
+ outgoingReference.source = this;
30
+ }
31
+ }
32
+
33
+ private _numberOfLinesOfCode!: number;
34
+ private _outgoingInvocations: Set<Invocation> = new Set();
35
+
36
+ public addOutgoingInvocation(outgoingInvocation: Invocation): void {
37
+ if (!this._outgoingInvocations.has(outgoingInvocation)) {
38
+ this._outgoingInvocations.add(outgoingInvocation);
39
+ outgoingInvocation.sender = this;
40
+ }
41
+ }
42
+
43
+ private _accesses: Set<Access> = new Set();
44
+
45
+ public addAccess(access: Access): void {
46
+ if (!this._accesses.has(access)) {
47
+ this._accesses.add(access);
48
+ access.accessor = this;
49
+ }
50
+ }
51
+
52
+ private childrenTypes: Set<Type> = new Set();
53
+
54
+ public addType(childType: Type): void {
55
+ if (!this.childrenTypes.has(childType)) {
56
+ this.childrenTypes.add(childType);
57
+ childType.parentContainerEntity = this;
58
+ }
59
+ }
60
+
61
+ private childrenFunctions: Set<FamixFunctionEntity> = new Set();
62
+
63
+ public addFunction(childFunction: FamixFunctionEntity): void {
64
+ if (!this.childrenFunctions.has(childFunction)) {
65
+ this.childrenFunctions.add(childFunction);
66
+ childFunction.parentContainerEntity = this;
67
+ }
68
+ }
69
+
70
+ private _variables: Set<Variable> = new Set();
71
+
72
+ public addVariable(variable: Variable): void {
73
+ if (!this._variables.has(variable)) {
74
+ this._variables.add(variable);
75
+ variable.parentContainerEntity = this;
76
+ }
77
+ }
78
+
79
+ public getJSON(): string {
80
+ const json: FamixJSONExporter = new FamixJSONExporter("ContainerEntity", this);
81
+ this.addPropertiesToExporter(json);
82
+ return json.getJSON();
83
+ }
84
+
85
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
86
+ super.addPropertiesToExporter(exporter);
87
+ // exporter.addProperty("parentBehaviouralEntity", this.getParentContainerEntity());
88
+ // exporter.addProperty("childrenContainerEntities", this.getChildrenContainerEntities());
89
+ exporter.addProperty("cyclomaticComplexity", this.cyclomaticComplexity);
90
+ exporter.addProperty("numberOfStatements", this.numberOfStatements);
91
+ // exporter.addProperty("outgoingReferences", this.getOutgoingReferences()); /* derived ?*/
92
+ exporter.addProperty("numberOfLinesOfCode", this.numberOfLinesOfCode);
93
+ // exporter.addProperty("outgoingInvocations", this.getOutgoingInvocations()); /* derived ?*/
94
+ // exporter.addProperty("accesses", this.getAccesses()); /* derived ?*/
95
+ exporter.addProperty("types", this.types);
96
+ exporter.addProperty("functions", this.functions);
97
+ exporter.addProperty("localVariables", this.variables);
98
+ }
99
+
100
+ get parentContainerEntity() {
101
+ return this._parentContainerEntity;
102
+ }
103
+
104
+ set parentContainerEntity(parentContainerEntity: ContainerEntity) {
105
+ this._parentContainerEntity = parentContainerEntity;
106
+ parentContainerEntity.addChildContainerEntity(this);
107
+ }
108
+
109
+ get childrenContainerEntities(): Set<ContainerEntity> {
110
+ return this._childrenContainerEntities;
111
+ }
112
+
113
+ get cyclomaticComplexity(): number {
114
+ return this._cyclomaticComplexity;
115
+ }
116
+
117
+ set cyclomaticComplexity(cyclomaticComplexity: number) {
118
+ this._cyclomaticComplexity = cyclomaticComplexity;
119
+ }
120
+
121
+ get numberOfStatements(): number {
122
+ return this._numberOfStatements;
123
+ }
124
+
125
+ set numberOfStatements(numberOfStatements: number) {
126
+ this._numberOfStatements = numberOfStatements;
127
+ }
128
+
129
+ get outgoingReferences() {
130
+ return this._outgoingReferences;
131
+ }
132
+
133
+ get numberOfLinesOfCode(): number {
134
+ return this._numberOfLinesOfCode;
135
+ }
136
+
137
+ set numberOfLinesOfCode(numberOfLinesOfCode: number) {
138
+ this._numberOfLinesOfCode = numberOfLinesOfCode;
139
+ }
140
+
141
+ get outgoingInvocations() {
142
+ return this._outgoingInvocations;
143
+ }
144
+
145
+ get accesses() {
146
+ return this._accesses;
147
+ }
148
+
149
+ get types() {
150
+ return this.childrenTypes;
151
+ }
152
+
153
+ get functions() {
154
+ return this.childrenFunctions;
155
+ }
156
+
157
+ get variables() {
158
+ return this._variables;
159
+ }
160
+ }
@@ -0,0 +1,37 @@
1
+ import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
+ import { NamedEntity } from "./named_entity";
3
+
4
+ export class Decorator extends NamedEntity {
5
+
6
+ private _decoratorExpression!: string;
7
+ private _decoratedEntity!: NamedEntity;
8
+
9
+ public getJSON(): string {
10
+ const json: FamixJSONExporter = new FamixJSONExporter("Decorator", this);
11
+ this.addPropertiesToExporter(json);
12
+ return json.getJSON();
13
+ }
14
+
15
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
16
+ super.addPropertiesToExporter(exporter);
17
+ exporter.addProperty("expression", this.decoratorExpression);
18
+ exporter.addProperty("decoratedEntity", this.decoratedEntity);
19
+ }
20
+
21
+ get decoratorExpression(): string {
22
+ return this._decoratorExpression;
23
+ }
24
+
25
+ set decoratorExpression(decoratorExpression: string) {
26
+ this._decoratorExpression = decoratorExpression;
27
+ }
28
+
29
+ get decoratedEntity(): NamedEntity {
30
+ return this._decoratedEntity;
31
+ }
32
+
33
+ set decoratedEntity(decoratedEntity: NamedEntity) {
34
+ this._decoratedEntity = decoratedEntity;
35
+ decoratedEntity.addDecorator(this);
36
+ }
37
+ }
@@ -0,0 +1,30 @@
1
+ import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
+ import { Type } from "./type";
3
+ import { EnumValue } from "./enum_value";
4
+
5
+ export class Enum extends Type {
6
+
7
+ private _values: Set<EnumValue> = new Set();
8
+
9
+ public addValue(value: EnumValue): void {
10
+ if (!this._values.has(value)) {
11
+ this._values.add(value);
12
+ value.parentEntity = this;
13
+ }
14
+ }
15
+
16
+ public getJSON(): string {
17
+ const json: FamixJSONExporter = new FamixJSONExporter("Enum", this);
18
+ this.addPropertiesToExporter(json);
19
+ return json.getJSON();
20
+ }
21
+
22
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
23
+ super.addPropertiesToExporter(exporter);
24
+ exporter.addProperty("enumValues", this.values);
25
+ }
26
+
27
+ get values() {
28
+ return this._values;
29
+ }
30
+ }
@@ -0,0 +1,28 @@
1
+ import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
+ import { StructuralEntity } from "./structural_entity";
3
+ import { Enum } from "./enum";
4
+
5
+ export class EnumValue extends StructuralEntity {
6
+
7
+ private _parentEntity!: Enum;
8
+
9
+ public getJSON(): string {
10
+ const json: FamixJSONExporter = new FamixJSONExporter("EnumValue", this);
11
+ this.addPropertiesToExporter(json);
12
+ return json.getJSON();
13
+ }
14
+
15
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
16
+ super.addPropertiesToExporter(exporter);
17
+ exporter.addProperty("parentEnum", this.parentEntity);
18
+ }
19
+
20
+ get parentEntity(): Enum {
21
+ return this._parentEntity;
22
+ }
23
+
24
+ set parentEntity(parentEntity: Enum) {
25
+ this._parentEntity = parentEntity;
26
+ parentEntity.addValue(this);
27
+ }
28
+ }
@@ -0,0 +1,51 @@
1
+ import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
+ import { Entity } from "./entity";
3
+ import { Module } from "./module";
4
+ import { NamedEntity } from "./named_entity";
5
+
6
+ export class ImportClause extends Entity {
7
+
8
+ private _importingEntity!: Module;
9
+ private _importedEntity!: NamedEntity;
10
+ private _moduleSpecifier!: string;
11
+
12
+ public getJSON(): string {
13
+ const json: FamixJSONExporter = new FamixJSONExporter("ImportClause", this);
14
+ this.addPropertiesToExporter(json);
15
+ return json.getJSON();
16
+ }
17
+
18
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
19
+ super.addPropertiesToExporter(exporter);
20
+ exporter.addProperty("importingEntity", this.importingEntity);
21
+ exporter.addProperty("importedEntity", this.importedEntity);
22
+ // unknown property below
23
+ // exporter.addProperty("moduleSpecifier", this.getModuleSpecifier());
24
+ }
25
+
26
+ get importingEntity(): Module {
27
+ return this._importingEntity;
28
+ }
29
+
30
+ set importingEntity(importer: Module) {
31
+ this._importingEntity = importer;
32
+ importer.addOutgoingImport(this); // opposite
33
+ }
34
+
35
+ get importedEntity(): NamedEntity {
36
+ return this._importedEntity;
37
+ }
38
+
39
+ set importedEntity(importedEntity: NamedEntity) {
40
+ this._importedEntity = importedEntity;
41
+ importedEntity.addIncomingImport(this); // incomingImports in Famix TImportable/TImport
42
+ }
43
+
44
+ get moduleSpecifier(): string {
45
+ return this._moduleSpecifier;
46
+ }
47
+
48
+ set moduleSpecifier(moduleSpecifier: string) {
49
+ this._moduleSpecifier = moduleSpecifier;
50
+ }
51
+ }
@@ -1,18 +1,17 @@
1
1
  export { Access } from "./access";
2
2
  export { Accessor } from "./accessor";
3
3
  export { Alias } from "./alias";
4
- export { Association } from "./association";
5
4
  export { BehavioralEntity } from "./behavioral_entity";
6
5
  export { Class } from "./class";
7
6
  export { Comment } from "./comment";
8
7
  export { ContainerEntity } from "./container_entity";
8
+ export { Concretisation } from "./concretisation";
9
9
  export { Decorator } from "./decorator";
10
10
  export { Entity } from "./entity";
11
11
  export { EnumValue } from "./enum_value";
12
12
  export { Enum } from "./enum";
13
13
  export { Property } from "./property";
14
14
  export { Function } from "./function";
15
- export { ImplicitVariable } from "./implicit_variable";
16
15
  export { ImportClause } from "./import_clause";
17
16
  export { IndexedFileAnchor } from "./indexed_file_anchor";
18
17
  export { Inheritance } from "./inheritance";
@@ -21,12 +20,10 @@ export { Invocation } from "./invocation";
21
20
  export { Method } from "./method";
22
21
  export { Module } from "./module";
23
22
  export { NamedEntity } from "./named_entity";
24
- export { Namespace } from "./namespace";
25
23
  export { ParameterType } from "./parameter_type";
26
24
  export { Parameter } from "./parameter";
27
- export { ParameterizableClass } from "./parameterizable_class";
28
- export { ParameterizableInterface } from "./parameterizable_interface";
29
- export { ParameterizedType } from "./parameterized_type";
25
+ export { ParametricClass } from "./parametric_class";
26
+ export { ParametricInterface } from "./parametric_interface";
30
27
  export { PrimitiveType } from "./primitive_type";
31
28
  export { Reference } from "./reference";
32
29
  export { ScopingEntity } from "./scoping_entity";
@@ -35,6 +32,10 @@ export { SourceAnchor } from "./source_anchor";
35
32
  export { SourceLanguage } from "./source_language";
36
33
  export { SourcedEntity } from "./sourced_entity";
37
34
  export { StructuralEntity } from "./structural_entity";
38
- export { TextAnchor } from "./text_anchor";
39
35
  export { Type } from "./type";
40
36
  export { Variable } from "./variable";
37
+ export { ParametricFunction } from "./parametric_function";
38
+ export { ParametricMethod } from "./parametric_method";
39
+ export { ArrowFunction } from "./arrow_function";
40
+ export { ParametricArrowFunction } from "./parametric_arrow_function";
41
+ export { ParameterConcretisation } from "./parameter_concretisation";
@@ -0,0 +1,46 @@
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
+ private _endPos!: number;
8
+ private _fileName!: string;
9
+
10
+ public getJSON(): string {
11
+ const json: FamixJSONExporter = new FamixJSONExporter("IndexedFileAnchor", this);
12
+ this.addPropertiesToExporter(json);
13
+ return json.getJSON();
14
+ }
15
+
16
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
17
+ super.addPropertiesToExporter(exporter);
18
+ exporter.addProperty("startPos", this.startPos);
19
+ exporter.addProperty("endPos", this.endPos);
20
+ exporter.addProperty("fileName", this.fileName);
21
+ }
22
+
23
+ get startPos(): number {
24
+ return this._startPos;
25
+ }
26
+
27
+ set startPos(startPos: number) {
28
+ this._startPos = startPos;
29
+ }
30
+
31
+ get endPos(): number {
32
+ return this._endPos;
33
+ }
34
+
35
+ set endPos(endPos: number) {
36
+ this._endPos = endPos;
37
+ }
38
+
39
+ get fileName(): string {
40
+ return this._fileName;
41
+ }
42
+
43
+ set fileName(fileName: string) {
44
+ this._fileName = fileName;
45
+ }
46
+ }
@@ -0,0 +1,40 @@
1
+ import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
+ import { Class } from "./class";
3
+ import { Entity } from "./entity";
4
+ import { Interface } from "./interface";
5
+
6
+ export class Inheritance extends Entity {
7
+
8
+ private _superclass!: Class | Interface;
9
+ private _subclass!: Class | Interface;
10
+
11
+ public getJSON(): string {
12
+ const json: FamixJSONExporter = new FamixJSONExporter("Inheritance", this);
13
+ this.addPropertiesToExporter(json);
14
+ return json.getJSON();
15
+ }
16
+
17
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
18
+ super.addPropertiesToExporter(exporter);
19
+ exporter.addProperty("superclass", this.superclass);
20
+ exporter.addProperty("subclass", this.subclass);
21
+ }
22
+
23
+ get superclass() {
24
+ return this._superclass;
25
+ }
26
+
27
+ set superclass(superclass: Class | Interface) {
28
+ this._superclass = superclass;
29
+ superclass.addSubInheritance(this);
30
+ }
31
+
32
+ get subclass() {
33
+ return this._subclass;
34
+ }
35
+
36
+ set subclass(subclass: Class | Interface) {
37
+ this._subclass = subclass;
38
+ subclass.addSuperInheritance(this);
39
+ }
40
+ }
@@ -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 addProperty(property: Property): void {
12
+ if (!this._properties.has(property)) {
13
+ this._properties.add(property);
14
+ property.parentEntity = this;
15
+ }
16
+ }
17
+
18
+ private _methods: Set<Method> = new Set();
19
+
20
+ public addMethod(method: Method): void {
21
+ if (!this._methods.has(method)) {
22
+ this._methods.add(method);
23
+ method.parentEntity = this;
24
+ }
25
+ }
26
+
27
+ private _superInheritances: Set<Inheritance> = new Set();
28
+
29
+ public addSuperInheritance(superInheritance: Inheritance): void {
30
+ if (!this._superInheritances.has(superInheritance)) {
31
+ this._superInheritances.add(superInheritance);
32
+ superInheritance.subclass = this;
33
+ }
34
+ }
35
+
36
+ private _subInheritances: Set<Inheritance> = new Set();
37
+
38
+ public addSubInheritance(subInheritance: Inheritance): void {
39
+ if (!this._subInheritances.has(subInheritance)) {
40
+ this._subInheritances.add(subInheritance);
41
+ subInheritance.superclass = this;
42
+ }
43
+ }
44
+
45
+
46
+ public getJSON(): string {
47
+ const json: FamixJSONExporter = new FamixJSONExporter("Interface", this);
48
+ this.addPropertiesToExporter(json);
49
+ return json.getJSON();
50
+ }
51
+
52
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
53
+ super.addPropertiesToExporter(exporter);
54
+ exporter.addProperty("attributes", this.properties);
55
+ exporter.addProperty("methods", this.methods);
56
+ exporter.addProperty("superInheritances", this.superInheritances);
57
+ exporter.addProperty("subInheritances", this.subInheritances);
58
+ }
59
+
60
+ get properties() {
61
+ return this._properties;
62
+ }
63
+
64
+ get methods() {
65
+ return this._methods;
66
+ }
67
+
68
+ get superInheritances() {
69
+ return this._superInheritances;
70
+ }
71
+
72
+ get subInheritances() {
73
+ return this._subInheritances;
74
+ }
75
+ }
@@ -0,0 +1,65 @@
1
+ import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
+ import { NamedEntity } from "./named_entity";
3
+ import { BehavioralEntity } from "./behavioral_entity";
4
+ import { ContainerEntity } from "./container_entity";
5
+ import { Entity } from "./entity";
6
+
7
+ export class Invocation extends Entity {
8
+
9
+ private _candidates: Set<BehavioralEntity> = new Set();
10
+
11
+ public addCandidate(candidate: BehavioralEntity): void {
12
+ if (!this._candidates.has(candidate)) {
13
+ this._candidates.add(candidate);
14
+ candidate.addIncomingInvocation(this);
15
+ }
16
+ }
17
+
18
+ private _receiver!: NamedEntity;
19
+ private _sender!: ContainerEntity;
20
+ private _signature!: string;
21
+
22
+ public getJSON(): string {
23
+ const json: FamixJSONExporter = new FamixJSONExporter("Invocation", this);
24
+ this.addPropertiesToExporter(json);
25
+ return json.getJSON();
26
+ }
27
+
28
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
29
+ super.addPropertiesToExporter(exporter);
30
+ exporter.addProperty("candidates", this.candidates);
31
+ exporter.addProperty("receiver", this.receiver);
32
+ exporter.addProperty("sender", this.sender);
33
+ exporter.addProperty("signature", this.signature);
34
+ }
35
+
36
+ get candidates() {
37
+ return this._candidates;
38
+ }
39
+
40
+ get receiver() {
41
+ return this._receiver;
42
+ }
43
+
44
+ set receiver(receiver: NamedEntity) {
45
+ this._receiver = receiver;
46
+ receiver.addReceivedInvocation(this);
47
+ }
48
+
49
+ get sender() {
50
+ return this._sender;
51
+ }
52
+
53
+ set sender(sender: ContainerEntity) {
54
+ this._sender = sender;
55
+ sender.addOutgoingInvocation(this);
56
+ }
57
+
58
+ get signature() {
59
+ return this._signature;
60
+ }
61
+
62
+ set signature(signature: string) {
63
+ this._signature = signature;
64
+ }
65
+ }