ts2famix 1.0.13 → 1.0.15

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 (135) hide show
  1. package/.eslintrc.json +24 -24
  2. package/LICENSE +23 -23
  3. package/README.md +109 -109
  4. package/dist/analyze.js +107 -0
  5. package/dist/analyze_functions/processAccesses.js +55 -0
  6. package/dist/analyze_functions/processFiles.js +554 -0
  7. package/dist/analyze_functions/processImportClauses.js +70 -0
  8. package/dist/analyze_functions/processInheritances.js +73 -0
  9. package/dist/analyze_functions/processInvocations.js +49 -0
  10. package/dist/famix2puml.js +125 -0
  11. package/dist/famix_functions/famix_functions.js +525 -0
  12. package/dist/famix_functions/famix_functions_associations.js +223 -0
  13. package/dist/famix_functions/famix_functions_index.js +62 -0
  14. package/dist/famix_functions/famix_functions_types.js +114 -0
  15. package/dist/fqn.js +126 -0
  16. package/dist/lib/famix/src/famix_JSON_exporter.js +54 -0
  17. package/dist/lib/famix/src/famix_base_element.js +13 -0
  18. package/dist/lib/famix/src/famix_repository.js +199 -0
  19. package/dist/lib/famix/src/index.js +30 -0
  20. package/dist/lib/famix/src/model/famix/access.js +39 -0
  21. package/dist/lib/famix/src/model/famix/accessor.js +16 -0
  22. package/dist/lib/famix/src/model/famix/alias.js +32 -0
  23. package/dist/lib/famix/src/model/famix/association.js +36 -0
  24. package/dist/lib/famix/src/model/famix/behavioral_entity.js +81 -0
  25. package/dist/lib/famix/src/model/famix/c_source_language.js +16 -0
  26. package/dist/lib/famix/src/model/famix/class.js +70 -0
  27. package/dist/lib/famix/src/model/famix/comment.js +38 -0
  28. package/dist/lib/famix/src/model/famix/container_entity.js +125 -0
  29. package/dist/lib/famix/src/model/famix/custom_source_language.js +23 -0
  30. package/dist/lib/famix/src/model/famix/decorator.js +31 -0
  31. package/dist/lib/famix/src/model/famix/entity.js +16 -0
  32. package/dist/lib/famix/src/model/famix/enum.js +30 -0
  33. package/dist/lib/famix/src/model/famix/enum_value.js +24 -0
  34. package/dist/lib/famix/src/model/famix/function.js +16 -0
  35. package/dist/lib/famix/src/model/famix/implicit_variable.js +16 -0
  36. package/dist/lib/famix/src/model/famix/import_clause.js +39 -0
  37. package/dist/lib/famix/src/model/famix/index.js +87 -0
  38. package/dist/lib/famix/src/model/famix/indexed_file_anchor.js +37 -0
  39. package/dist/lib/famix/src/model/famix/inheritance.js +32 -0
  40. package/dist/lib/famix/src/model/famix/interface.js +63 -0
  41. package/dist/lib/famix/src/model/famix/invocation.js +53 -0
  42. package/dist/lib/famix/src/model/famix/method.js +66 -0
  43. package/dist/lib/famix/src/model/famix/module.js +31 -0
  44. package/dist/lib/famix/src/model/famix/named_entity.js +77 -0
  45. package/dist/lib/famix/src/model/famix/namespace.js +24 -0
  46. package/dist/lib/famix/src/model/famix/parameter.js +24 -0
  47. package/dist/lib/famix/src/model/famix/parameterizable_class.js +30 -0
  48. package/dist/lib/famix/src/model/famix/parameterizable_interface.js +30 -0
  49. package/dist/lib/famix/src/model/famix/parameterized_type.js +36 -0
  50. package/dist/lib/famix/src/model/famix/primitive_type.js +16 -0
  51. package/dist/lib/famix/src/model/famix/property.js +44 -0
  52. package/dist/lib/famix/src/model/famix/reference.js +32 -0
  53. package/dist/lib/famix/src/model/famix/scoping_entity.js +34 -0
  54. package/dist/lib/famix/src/model/famix/script_entity.js +30 -0
  55. package/dist/lib/famix/src/model/famix/source_anchor.js +26 -0
  56. package/dist/lib/famix/src/model/famix/source_language.js +30 -0
  57. package/dist/lib/famix/src/model/famix/sourced_entity.js +55 -0
  58. package/dist/lib/famix/src/model/famix/structural_entity.js +38 -0
  59. package/dist/lib/famix/src/model/famix/text_anchor.js +37 -0
  60. package/dist/lib/famix/src/model/famix/type.js +71 -0
  61. package/dist/lib/famix/src/model/famix/type_parameter.js +24 -0
  62. package/dist/lib/famix/src/model/famix/variable.js +23 -0
  63. package/dist/lib/ts-complex/cyclomatic-service.js +83 -0
  64. package/dist/ts2famix-cli.js +63 -0
  65. package/dist/ts2famix-tsconfig.js +53 -0
  66. package/jest.config-old.ts +199 -199
  67. package/package.json +47 -47
  68. package/src/analyze.ts +94 -94
  69. package/src/analyze_functions/processAccesses.ts +57 -57
  70. package/src/analyze_functions/processFiles.ts +669 -669
  71. package/src/analyze_functions/processImportClauses.ts +77 -77
  72. package/src/analyze_functions/processInheritances.ts +84 -84
  73. package/src/analyze_functions/processInvocations.ts +51 -51
  74. package/src/famix2puml.ts +119 -119
  75. package/src/famix_functions/famix_functions.ts +565 -559
  76. package/src/famix_functions/famix_functions_associations.ts +225 -215
  77. package/src/famix_functions/famix_functions_index.ts +44 -44
  78. package/src/famix_functions/famix_functions_types.ts +105 -105
  79. package/src/generate_uml.sh +16 -16
  80. package/src/lib/famix/License.md +22 -22
  81. package/src/lib/famix/package-lock.json +301 -301
  82. package/src/lib/famix/package.json +27 -27
  83. package/src/lib/famix/readme.md +4 -4
  84. package/src/lib/famix/src/famix_JSON_exporter.ts +56 -56
  85. package/src/lib/famix/src/famix_base_element.ts +18 -18
  86. package/src/lib/famix/src/famix_repository.ts +212 -199
  87. package/src/lib/famix/src/index.ts +8 -8
  88. package/src/lib/famix/src/model/famix/access.ts +53 -53
  89. package/src/lib/famix/src/model/famix/accessor.ts +15 -15
  90. package/src/lib/famix/src/model/famix/alias.ts +41 -41
  91. package/src/lib/famix/src/model/famix/association.ts +44 -44
  92. package/src/lib/famix/src/model/famix/behavioral_entity.ts +107 -107
  93. package/src/lib/famix/src/model/famix/c_source_language.ts +15 -15
  94. package/src/lib/famix/src/model/famix/class.ts +86 -86
  95. package/src/lib/famix/src/model/famix/comment.ts +50 -50
  96. package/src/lib/famix/src/model/famix/container_entity.ts +165 -165
  97. package/src/lib/famix/src/model/famix/custom_source_language.ts +27 -27
  98. package/src/lib/famix/src/model/famix/decorator.ts +39 -39
  99. package/src/lib/famix/src/model/famix/entity.ts +15 -15
  100. package/src/lib/famix/src/model/famix/enum.ts +31 -31
  101. package/src/lib/famix/src/model/famix/enum_value.ts +29 -29
  102. package/src/lib/famix/src/model/famix/function.ts +15 -15
  103. package/src/lib/famix/src/model/famix/implicit_variable.ts +15 -15
  104. package/src/lib/famix/src/model/famix/import_clause.ts +53 -53
  105. package/src/lib/famix/src/model/famix/index.ts +42 -42
  106. package/src/lib/famix/src/model/famix/indexed_file_anchor.ts +49 -49
  107. package/src/lib/famix/src/model/famix/inheritance.ts +42 -42
  108. package/src/lib/famix/src/model/famix/interface.ts +75 -75
  109. package/src/lib/famix/src/model/famix/invocation.ts +68 -68
  110. package/src/lib/famix/src/model/famix/method.ts +96 -96
  111. package/src/lib/famix/src/model/famix/module.ts +31 -31
  112. package/src/lib/famix/src/model/famix/named_entity.ts +98 -98
  113. package/src/lib/famix/src/model/famix/namespace.ts +28 -28
  114. package/src/lib/famix/src/model/famix/parameter.ts +29 -29
  115. package/src/lib/famix/src/model/famix/parameterizable_class.ts +31 -31
  116. package/src/lib/famix/src/model/famix/parameterizable_interface.ts +31 -31
  117. package/src/lib/famix/src/model/famix/parameterized_type.ts +40 -40
  118. package/src/lib/famix/src/model/famix/primitive_type.ts +15 -15
  119. package/src/lib/famix/src/model/famix/property.ts +54 -54
  120. package/src/lib/famix/src/model/famix/reference.ts +42 -42
  121. package/src/lib/famix/src/model/famix/scoping_entity.ts +34 -31
  122. package/src/lib/famix/src/model/famix/script_entity.ts +38 -38
  123. package/src/lib/famix/src/model/famix/source_anchor.ts +31 -31
  124. package/src/lib/famix/src/model/famix/source_language.ts +31 -31
  125. package/src/lib/famix/src/model/famix/sourced_entity.ts +70 -70
  126. package/src/lib/famix/src/model/famix/structural_entity.ts +44 -44
  127. package/src/lib/famix/src/model/famix/text_anchor.ts +49 -49
  128. package/src/lib/famix/src/model/famix/type.ts +88 -88
  129. package/src/lib/famix/src/model/famix/type_parameter.ts +33 -33
  130. package/src/lib/famix/src/model/famix/variable.ts +28 -28
  131. package/src/lib/famix/tsconfig.json +26 -26
  132. package/src/lib/famix/tslint.json +14 -14
  133. package/src/lib/ts-complex/cyclomatic-service.ts +85 -85
  134. package/src/ts2famix-cli.ts +39 -39
  135. package/tsconfig.json +69 -69
@@ -0,0 +1,199 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FamixRepository = void 0;
4
+ const famix_1 = require("./model/famix");
5
+ /**
6
+ * This class is used to store all Famix elements
7
+ */
8
+ class FamixRepository {
9
+ constructor() {
10
+ this.elements = new Set(); // All Famix elements
11
+ this.famixClasses = new Set(); // All Famix classes
12
+ this.famixInterfaces = new Set(); // All Famix interfaces
13
+ this.famixNamespaces = new Set(); // All Famix namespaces
14
+ this.famixMethods = new Set(); // All Famix methods
15
+ this.famixVariables = new Set(); // All Famix variables
16
+ this.famixFunctions = new Set(); // All Famix functions
17
+ this.famixFiles = new Set(); // All Famix files
18
+ this.idCounter = 1; // Id counter
19
+ }
20
+ /**
21
+ * Gets a Famix entity by id
22
+ * @param id An id of a Famix entity
23
+ * @returns The Famix entity corresponding to the id or undefined if it doesn't exist
24
+ */
25
+ getFamixEntityById(id) {
26
+ const entity = Array.from(this.elements.values()).find(e => e.id === id);
27
+ return entity;
28
+ }
29
+ /**
30
+ * Gets a Famix entity by fully qualified name
31
+ * @param fullyQualifiedName A fully qualified name
32
+ * @returns The Famix entity corresponding to the fully qualified name or undefined if it doesn't exist
33
+ */
34
+ getFamixEntityByFullyQualifiedName(fullyQualifiedName) {
35
+ const allEntities = Array.from(this.elements.values()).filter(e => e instanceof famix_1.NamedEntity);
36
+ const entity = allEntities.find(e => e.getFullyQualifiedName() === fullyQualifiedName);
37
+ return entity;
38
+ }
39
+ // Only for tests
40
+ /**
41
+ * Gets all Famix entities
42
+ * @returns All Famix entities
43
+ */
44
+ _getAllEntities() {
45
+ return new Set(Array.from(this.elements.values()));
46
+ }
47
+ /**
48
+ * Gets all Famix entities of a given type
49
+ * @param theType A type of Famix entity
50
+ * @returns All Famix entities of the given type
51
+ */
52
+ _getAllEntitiesWithType(theType) {
53
+ return new Set(Array.from(this.elements.values()).filter(e => e.constructor.name === theType));
54
+ }
55
+ /**
56
+ * Gets a Famix class by name
57
+ * @param name A class name
58
+ * @returns The Famix class corresponding to the name or undefined if it doesn't exist
59
+ */
60
+ _getFamixClass(name) {
61
+ return Array.from(this.famixClasses.values()).find(ns => ns.getName() === name);
62
+ }
63
+ /**
64
+ * Gets a Famix interface by name
65
+ * @param name An interface name
66
+ * @returns The Famix interface corresponding to the name or undefined if it doesn't exist
67
+ */
68
+ _getFamixInterface(name) {
69
+ return Array.from(this.famixInterfaces.values()).find(ns => ns.getName() === name);
70
+ }
71
+ /**
72
+ * Gets a Famix method by name
73
+ * @param name A method name
74
+ * @returns The Famix method corresponding to the name or undefined if it doesn't exist
75
+ */
76
+ _getFamixMethod(name) {
77
+ return Array.from(this.famixMethods.values()).find(ns => ns.getName() === name);
78
+ }
79
+ /**
80
+ * Gets a Famix function by name
81
+ * @param name A function name
82
+ * @returns The Famix function corresponding to the name or undefined if it doesn't exist
83
+ */
84
+ _getFamixFunction(name) {
85
+ return Array.from(this.famixFunctions.values()).find(ns => ns.getName() === name);
86
+ }
87
+ /**
88
+ * Gets a Famix variable by name
89
+ * @param name A variable name
90
+ * @returns The Famix variable corresponding to the name or undefined if it doesn't exist
91
+ */
92
+ _getFamixVariable(name) {
93
+ return Array.from(this.famixVariables.values()).find(v => v.getName() === name);
94
+ }
95
+ /**
96
+ * Gets a Famix namespace by name
97
+ * @param name A namespace name
98
+ * @returns The Famix namespace corresponding to the name or undefined if it doesn't exist
99
+ */
100
+ _getFamixNamespace(name) {
101
+ return Array.from(this.famixNamespaces.values()).find(ns => ns.getName() === name);
102
+ }
103
+ /**
104
+ * Gets all Famix namespaces
105
+ * @returns All Famix namespaces
106
+ */
107
+ _getFamixNamespaces() {
108
+ return new Set(Array.from(this.famixNamespaces.values()));
109
+ }
110
+ /**
111
+ * Gets a Famix file by name
112
+ * @param name A file name
113
+ * @returns The Famix file corresponding to the name or undefined if it doesn't exist
114
+ */
115
+ _getFamixFile(name) {
116
+ return Array.from(this.famixFiles.values()).find(ns => ns.getName() === name);
117
+ }
118
+ /**
119
+ * Gets all Famix files
120
+ * @returns All Famix files
121
+ */
122
+ _getFamixFiles() {
123
+ return new Set(Array.from(this.famixFiles.values()));
124
+ }
125
+ /**
126
+ * Gets all method names as a set from a class
127
+ * @param className A class name
128
+ * @returns The set of class "className" method names
129
+ */
130
+ _methodNamesAsSetFromClass(className) {
131
+ const theClass = this._getFamixClass(className);
132
+ return new Set(Array.from(theClass.getMethods()).map(m => m.getName()));
133
+ }
134
+ /**
135
+ * Gets all method parents as a set from a class
136
+ * @param className A class name
137
+ * @returns The set of class "className" method parents
138
+ */
139
+ _methodParentsAsSetFromClass(className) {
140
+ const theClass = this._getFamixClass(className);
141
+ return new Set(Array.from(theClass.getMethods()).map(m => m.getParentEntity()));
142
+ }
143
+ /**
144
+ * Gets the map of Famix element ids and their Famix element from a JSON model
145
+ * @param model A JSON model
146
+ * @returns The map of Famix element ids and their Famix element from the JSON model
147
+ */
148
+ _initMapFromModel(model) {
149
+ const parsedModel = JSON.parse(model);
150
+ const idToElementMap = new Map();
151
+ parsedModel.forEach(element => {
152
+ idToElementMap.set(element.id, element);
153
+ });
154
+ return idToElementMap;
155
+ }
156
+ /**
157
+ * Adds a Famix element to the repository
158
+ * @param element A Famix element
159
+ */
160
+ addElement(element) {
161
+ if (element instanceof famix_1.Class) {
162
+ this.famixClasses.add(element);
163
+ }
164
+ else if (element instanceof famix_1.Interface) {
165
+ this.famixInterfaces.add(element);
166
+ }
167
+ else if (element instanceof famix_1.Namespace) {
168
+ this.famixNamespaces.add(element);
169
+ }
170
+ else if (element instanceof famix_1.Variable) {
171
+ this.famixVariables.add(element);
172
+ }
173
+ else if (element instanceof famix_1.Method) {
174
+ this.famixMethods.add(element);
175
+ }
176
+ else if (element instanceof famix_1.Function) {
177
+ this.famixFunctions.add(element);
178
+ }
179
+ else if (element instanceof famix_1.ScriptEntity || element instanceof famix_1.Module) {
180
+ this.famixFiles.add(element);
181
+ }
182
+ this.elements.add(element);
183
+ element.id = this.idCounter;
184
+ this.idCounter++;
185
+ }
186
+ /**
187
+ * Gets a JSON representation of the repository
188
+ * @returns A JSON representation of the repository
189
+ */
190
+ getJSON() {
191
+ let ret = "[";
192
+ for (const element of Array.from(this.elements.values())) {
193
+ ret = ret + element.getJSON() + ",";
194
+ }
195
+ ret = ret.substring(0, ret.length - 1);
196
+ return ret + "]";
197
+ }
198
+ }
199
+ exports.FamixRepository = FamixRepository;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ const Famix = __importStar(require("./model/famix"));
26
+ const famix_base_element_1 = require("./famix_base_element");
27
+ const famix_JSON_exporter_1 = require("./famix_JSON_exporter");
28
+ const famix_repository_1 = require("./famix_repository");
29
+ const model = { Famix };
30
+ module.exports = { FamixBaseElement: famix_base_element_1.FamixBaseElement, FamixJSONExporter: famix_JSON_exporter_1.FamixJSONExporter, FamixRepository: famix_repository_1.FamixRepository, model };
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Access = void 0;
4
+ const famix_JSON_exporter_1 = require("../../famix_JSON_exporter");
5
+ const association_1 = require("./association");
6
+ class Access extends association_1.Association {
7
+ getAccessor() {
8
+ return this.accessor;
9
+ }
10
+ setAccessor(accessor) {
11
+ this.accessor = accessor;
12
+ accessor.addAccess(this);
13
+ }
14
+ getVariable() {
15
+ return this.variable;
16
+ }
17
+ setVariable(variable) {
18
+ this.variable = variable;
19
+ variable.addIncomingAccess(this);
20
+ }
21
+ getIsWrite() {
22
+ return this.isWrite;
23
+ }
24
+ setIsWrite(isWrite) {
25
+ this.isWrite = isWrite;
26
+ }
27
+ getJSON() {
28
+ const mse = new famix_JSON_exporter_1.FamixJSONExporter("Access", this);
29
+ this.addPropertiesToExporter(mse);
30
+ return mse.getJSON();
31
+ }
32
+ addPropertiesToExporter(exporter) {
33
+ super.addPropertiesToExporter(exporter);
34
+ exporter.addProperty("accessor", this.getAccessor());
35
+ exporter.addProperty("variable", this.getVariable());
36
+ exporter.addProperty("isWrite", this.getIsWrite());
37
+ }
38
+ }
39
+ exports.Access = Access;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Accessor = void 0;
4
+ const famix_JSON_exporter_1 = require("../../famix_JSON_exporter");
5
+ const method_1 = require("./method");
6
+ class Accessor extends method_1.Method {
7
+ getJSON() {
8
+ const mse = new famix_JSON_exporter_1.FamixJSONExporter("Accessor", this);
9
+ this.addPropertiesToExporter(mse);
10
+ return mse.getJSON();
11
+ }
12
+ addPropertiesToExporter(exporter) {
13
+ super.addPropertiesToExporter(exporter);
14
+ }
15
+ }
16
+ exports.Accessor = Accessor;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Alias = void 0;
4
+ const famix_JSON_exporter_1 = require("../../famix_JSON_exporter");
5
+ const named_entity_1 = require("./named_entity");
6
+ class Alias extends named_entity_1.NamedEntity {
7
+ getParentEntity() {
8
+ return this.parentEntity;
9
+ }
10
+ setParentEntity(parentEntity) {
11
+ this.parentEntity = parentEntity;
12
+ parentEntity.addAlias(this);
13
+ }
14
+ getAliasedEntity() {
15
+ return this.aliasedEntity;
16
+ }
17
+ setAliasedEntity(aliasedEntity) {
18
+ this.aliasedEntity = aliasedEntity;
19
+ aliasedEntity.addTypeAlias(this);
20
+ }
21
+ getJSON() {
22
+ const mse = new famix_JSON_exporter_1.FamixJSONExporter("Alias", this);
23
+ this.addPropertiesToExporter(mse);
24
+ return mse.getJSON();
25
+ }
26
+ addPropertiesToExporter(exporter) {
27
+ super.addPropertiesToExporter(exporter);
28
+ exporter.addProperty("parentEntity", this.getParentEntity());
29
+ exporter.addProperty("aliasedEntity", this.getAliasedEntity());
30
+ }
31
+ }
32
+ exports.Alias = Alias;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Association = void 0;
4
+ const famix_JSON_exporter_1 = require("../../famix_JSON_exporter");
5
+ const sourced_entity_1 = require("./sourced_entity");
6
+ class Association extends sourced_entity_1.SourcedEntity {
7
+ getNext() {
8
+ return this.next;
9
+ }
10
+ setNext(next) {
11
+ if (this.next === undefined) {
12
+ this.next = next;
13
+ next.setPrevious(this);
14
+ }
15
+ }
16
+ getPrevious() {
17
+ return this.previous;
18
+ }
19
+ setPrevious(previous) {
20
+ if (this.previous === undefined) {
21
+ this.previous = previous;
22
+ previous.setNext(this);
23
+ }
24
+ }
25
+ getJSON() {
26
+ const mse = new famix_JSON_exporter_1.FamixJSONExporter("Association", this);
27
+ this.addPropertiesToExporter(mse);
28
+ return mse.getJSON();
29
+ }
30
+ addPropertiesToExporter(exporter) {
31
+ super.addPropertiesToExporter(exporter);
32
+ exporter.addProperty("next", this.getNext());
33
+ exporter.addProperty("previous", this.getPrevious());
34
+ }
35
+ }
36
+ exports.Association = Association;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BehavioralEntity = void 0;
4
+ const famix_JSON_exporter_1 = require("../../famix_JSON_exporter");
5
+ const container_entity_1 = require("./container_entity");
6
+ class BehavioralEntity extends container_entity_1.ContainerEntity {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.parameters = new Set();
10
+ this.incomingInvocations = new Set();
11
+ this.typeParameters = new Set();
12
+ }
13
+ getIsGeneric() {
14
+ return this.isGeneric;
15
+ }
16
+ setIsGeneric(isGeneric) {
17
+ this.isGeneric = isGeneric;
18
+ }
19
+ getSignature() {
20
+ return this.signature;
21
+ }
22
+ setSignature(signature) {
23
+ this.signature = signature;
24
+ }
25
+ getParameters() {
26
+ return this.parameters;
27
+ }
28
+ addParameter(parameter) {
29
+ if (!this.parameters.has(parameter)) {
30
+ this.parameters.add(parameter);
31
+ parameter.setParentEntity(this);
32
+ }
33
+ }
34
+ getNumberOfParameters() {
35
+ return this.numberOfParameters;
36
+ }
37
+ setNumberOfParameters(numberOfParameters) {
38
+ this.numberOfParameters = numberOfParameters;
39
+ }
40
+ getIncomingInvocations() {
41
+ return this.incomingInvocations;
42
+ }
43
+ addIncomingInvocation(incomingInvocation) {
44
+ if (!this.incomingInvocations.has(incomingInvocation)) {
45
+ this.incomingInvocations.add(incomingInvocation);
46
+ incomingInvocation.addCandidate(this);
47
+ }
48
+ }
49
+ getDeclaredType() {
50
+ return this.declaredType;
51
+ }
52
+ setDeclaredType(declaredType) {
53
+ this.declaredType = declaredType;
54
+ declaredType.addBehavioralEntityWithDeclaredType(this);
55
+ }
56
+ getTypeParameters() {
57
+ return this.typeParameters;
58
+ }
59
+ addTypeParameter(typeParameter) {
60
+ if (!this.typeParameters.has(typeParameter)) {
61
+ this.typeParameters.add(typeParameter);
62
+ typeParameter.setParentGeneric(this);
63
+ }
64
+ }
65
+ getJSON() {
66
+ const mse = new famix_JSON_exporter_1.FamixJSONExporter("BehavioralEntity", this);
67
+ this.addPropertiesToExporter(mse);
68
+ return mse.getJSON();
69
+ }
70
+ addPropertiesToExporter(exporter) {
71
+ super.addPropertiesToExporter(exporter);
72
+ exporter.addProperty("isGeneric", this.getIsGeneric());
73
+ exporter.addProperty("signature", this.getSignature());
74
+ exporter.addProperty("parameters", this.getParameters());
75
+ exporter.addProperty("numberOfParameters", this.getNumberOfParameters());
76
+ exporter.addProperty("incomingInvocations", this.getIncomingInvocations());
77
+ exporter.addProperty("declaredType", this.getDeclaredType());
78
+ exporter.addProperty("typeParameters", this.getTypeParameters());
79
+ }
80
+ }
81
+ exports.BehavioralEntity = BehavioralEntity;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CSourceLanguage = void 0;
4
+ const famix_JSON_exporter_1 = require("../../famix_JSON_exporter");
5
+ const source_language_1 = require("./source_language");
6
+ class CSourceLanguage extends source_language_1.SourceLanguage {
7
+ getJSON() {
8
+ const mse = new famix_JSON_exporter_1.FamixJSONExporter("CSourceLanguage", this);
9
+ this.addPropertiesToExporter(mse);
10
+ return mse.getJSON();
11
+ }
12
+ addPropertiesToExporter(exporter) {
13
+ super.addPropertiesToExporter(exporter);
14
+ }
15
+ }
16
+ exports.CSourceLanguage = CSourceLanguage;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Class = void 0;
4
+ const famix_JSON_exporter_1 = require("../../famix_JSON_exporter");
5
+ const type_1 = require("./type");
6
+ class Class extends type_1.Type {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.properties = new Set();
10
+ this.methods = new Set();
11
+ this.superInheritances = new Set();
12
+ this.subInheritances = new Set();
13
+ }
14
+ getIsAbstract() {
15
+ return this.isAbstract;
16
+ }
17
+ setIsAbstract(isAbstract) {
18
+ this.isAbstract = isAbstract;
19
+ }
20
+ getProperties() {
21
+ return this.properties;
22
+ }
23
+ addProperty(property) {
24
+ if (!this.properties.has(property)) {
25
+ this.properties.add(property);
26
+ property.setParentEntity(this);
27
+ }
28
+ }
29
+ getMethods() {
30
+ return this.methods;
31
+ }
32
+ addMethod(method) {
33
+ if (!this.methods.has(method)) {
34
+ this.methods.add(method);
35
+ method.setParentEntity(this);
36
+ }
37
+ }
38
+ getSuperInheritances() {
39
+ return this.superInheritances;
40
+ }
41
+ addSuperInheritance(superInheritance) {
42
+ if (!this.superInheritances.has(superInheritance)) {
43
+ this.superInheritances.add(superInheritance);
44
+ superInheritance.setSubclass(this);
45
+ }
46
+ }
47
+ getSubInheritances() {
48
+ return this.subInheritances;
49
+ }
50
+ addSubInheritance(subInheritance) {
51
+ if (!this.subInheritances.has(subInheritance)) {
52
+ this.subInheritances.add(subInheritance);
53
+ subInheritance.setSuperclass(this);
54
+ }
55
+ }
56
+ getJSON() {
57
+ const mse = new famix_JSON_exporter_1.FamixJSONExporter("Class", this);
58
+ this.addPropertiesToExporter(mse);
59
+ return mse.getJSON();
60
+ }
61
+ addPropertiesToExporter(exporter) {
62
+ super.addPropertiesToExporter(exporter);
63
+ exporter.addProperty("isAbstract", this.getIsAbstract());
64
+ exporter.addProperty("properties", this.getProperties());
65
+ exporter.addProperty("methods", this.getMethods());
66
+ exporter.addProperty("superInheritances", this.getSuperInheritances());
67
+ exporter.addProperty("subInheritances", this.getSubInheritances());
68
+ }
69
+ }
70
+ exports.Class = Class;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Comment = void 0;
4
+ const famix_JSON_exporter_1 = require("../../famix_JSON_exporter");
5
+ const sourced_entity_1 = require("./sourced_entity");
6
+ class Comment extends sourced_entity_1.SourcedEntity {
7
+ getIsJSDoc() {
8
+ return this.isJSDoc;
9
+ }
10
+ setIsJSDoc(isJSDoc) {
11
+ this.isJSDoc = isJSDoc;
12
+ }
13
+ getContainer() {
14
+ return this.container;
15
+ }
16
+ setContainer(container) {
17
+ this.container = container;
18
+ container.addComment(this);
19
+ }
20
+ getContent() {
21
+ return this.content;
22
+ }
23
+ setContent(content) {
24
+ this.content = content;
25
+ }
26
+ getJSON() {
27
+ const mse = new famix_JSON_exporter_1.FamixJSONExporter("Comment", this);
28
+ this.addPropertiesToExporter(mse);
29
+ return mse.getJSON();
30
+ }
31
+ addPropertiesToExporter(exporter) {
32
+ super.addPropertiesToExporter(exporter);
33
+ exporter.addProperty("isJSDoc", this.getIsJSDoc());
34
+ exporter.addProperty("container", this.getContainer());
35
+ exporter.addProperty("content", this.getContent());
36
+ }
37
+ }
38
+ exports.Comment = Comment;
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ContainerEntity = void 0;
4
+ const famix_JSON_exporter_1 = require("../../famix_JSON_exporter");
5
+ const named_entity_1 = require("./named_entity");
6
+ class ContainerEntity extends named_entity_1.NamedEntity {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.childrenContainerEntities = new Set();
10
+ this.outgoingReferences = new Set();
11
+ this.outgoingInvocations = new Set();
12
+ this.accesses = new Set();
13
+ this.childrenTypes = new Set();
14
+ this.childrenFunctions = new Set();
15
+ this.variables = new Set();
16
+ }
17
+ getParentContainerEntity() {
18
+ return this.parentContainerEntity;
19
+ }
20
+ setParentContainerEntity(parentContainerEntity) {
21
+ this.parentContainerEntity = parentContainerEntity;
22
+ parentContainerEntity.addChildContainerEntity(this);
23
+ }
24
+ getChildrenContainerEntities() {
25
+ return this.childrenContainerEntities;
26
+ }
27
+ addChildContainerEntity(childContainerEntity) {
28
+ if (!this.childrenContainerEntities.has(childContainerEntity)) {
29
+ this.childrenContainerEntities.add(childContainerEntity);
30
+ childContainerEntity.setParentContainerEntity(this);
31
+ }
32
+ }
33
+ getCyclomaticComplexity() {
34
+ return this.cyclomaticComplexity;
35
+ }
36
+ setCyclomaticComplexity(cyclomaticComplexity) {
37
+ this.cyclomaticComplexity = cyclomaticComplexity;
38
+ }
39
+ getNumberOfStatements() {
40
+ return this.numberOfStatements;
41
+ }
42
+ setNumberOfStatements(numberOfStatements) {
43
+ this.numberOfStatements = numberOfStatements;
44
+ }
45
+ getOutgoingReferences() {
46
+ return this.outgoingReferences;
47
+ }
48
+ addOutgoingReference(outgoingReference) {
49
+ if (!this.outgoingReferences.has(outgoingReference)) {
50
+ this.outgoingReferences.add(outgoingReference);
51
+ outgoingReference.setSource(this);
52
+ }
53
+ }
54
+ getNumberOfLinesOfCode() {
55
+ return this.numberOfLinesOfCode;
56
+ }
57
+ setNumberOfLinesOfCode(numberOfLinesOfCode) {
58
+ this.numberOfLinesOfCode = numberOfLinesOfCode;
59
+ }
60
+ getOutgoingInvocations() {
61
+ return this.outgoingInvocations;
62
+ }
63
+ addOutgoingInvocation(outgoingInvocation) {
64
+ if (!this.outgoingInvocations.has(outgoingInvocation)) {
65
+ this.outgoingInvocations.add(outgoingInvocation);
66
+ outgoingInvocation.setSender(this);
67
+ }
68
+ }
69
+ getAccesses() {
70
+ return this.accesses;
71
+ }
72
+ addAccess(access) {
73
+ if (!this.accesses.has(access)) {
74
+ this.accesses.add(access);
75
+ access.setAccessor(this);
76
+ }
77
+ }
78
+ getTypes() {
79
+ return this.childrenTypes;
80
+ }
81
+ addType(childType) {
82
+ if (!this.childrenTypes.has(childType)) {
83
+ this.childrenTypes.add(childType);
84
+ childType.setParentContainerEntity(this);
85
+ }
86
+ }
87
+ getFunctions() {
88
+ return this.childrenFunctions;
89
+ }
90
+ addFunction(childFunction) {
91
+ if (!this.childrenFunctions.has(childFunction)) {
92
+ this.childrenFunctions.add(childFunction);
93
+ childFunction.setParentContainerEntity(this);
94
+ }
95
+ }
96
+ getVariables() {
97
+ return this.variables;
98
+ }
99
+ addVariable(variable) {
100
+ if (!this.variables.has(variable)) {
101
+ this.variables.add(variable);
102
+ variable.setParentContainerEntity(this);
103
+ }
104
+ }
105
+ getJSON() {
106
+ const mse = new famix_JSON_exporter_1.FamixJSONExporter("ContainerEntity", this);
107
+ this.addPropertiesToExporter(mse);
108
+ return mse.getJSON();
109
+ }
110
+ addPropertiesToExporter(exporter) {
111
+ super.addPropertiesToExporter(exporter);
112
+ exporter.addProperty("parentBehaviouralEntity", this.getParentContainerEntity());
113
+ exporter.addProperty("childrenContainerEntities", this.getChildrenContainerEntities());
114
+ exporter.addProperty("cyclomaticComplexity", this.getCyclomaticComplexity());
115
+ exporter.addProperty("numberOfStatements", this.getNumberOfStatements());
116
+ exporter.addProperty("outgoingReferences", this.getOutgoingReferences());
117
+ exporter.addProperty("numberOfLinesOfCode", this.getNumberOfLinesOfCode());
118
+ exporter.addProperty("outgoingInvocations", this.getOutgoingInvocations());
119
+ exporter.addProperty("accesses", this.getAccesses());
120
+ exporter.addProperty("types", this.getTypes());
121
+ exporter.addProperty("functions", this.getFunctions());
122
+ exporter.addProperty("variables", this.getVariables());
123
+ }
124
+ }
125
+ exports.ContainerEntity = ContainerEntity;