ts2famix 1.4.0 → 2.0.0

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 (119) hide show
  1. package/README.md +1 -1
  2. package/dist/analyze.js +6 -3
  3. package/dist/analyze_functions/process_functions.js +248 -100
  4. package/dist/famix2puml.js +1 -0
  5. package/dist/famix_functions/EntityDictionary.js +661 -155
  6. package/dist/famix_functions/helpers_creation.js +26 -6
  7. package/dist/fqn.js +156 -69
  8. package/dist/lib/famix/src/famix_JSON_exporter.js +1 -0
  9. package/dist/lib/famix/src/famix_base_element.js +1 -0
  10. package/dist/lib/famix/src/famix_repository.js +9 -8
  11. package/dist/lib/famix/src/index.js +1 -0
  12. package/dist/lib/famix/src/model/famix/access.js +3 -2
  13. package/dist/lib/famix/src/model/famix/accessor.js +1 -0
  14. package/dist/lib/famix/src/model/famix/alias.js +2 -1
  15. package/dist/lib/famix/src/model/famix/arrowFunction.js +17 -0
  16. package/dist/lib/famix/src/model/famix/behavioral_entity.js +13 -15
  17. package/dist/lib/famix/src/model/famix/class.js +1 -0
  18. package/dist/lib/famix/src/model/famix/comment.js +2 -1
  19. package/dist/lib/famix/src/model/famix/concretisation.js +31 -0
  20. package/dist/lib/famix/src/model/famix/container_entity.js +7 -6
  21. package/dist/lib/famix/src/model/famix/decorator.js +2 -1
  22. package/dist/lib/famix/src/model/famix/entity.js +1 -0
  23. package/dist/lib/famix/src/model/famix/enum.js +2 -1
  24. package/dist/lib/famix/src/model/famix/enum_value.js +2 -1
  25. package/dist/lib/famix/src/model/famix/function.js +1 -0
  26. package/dist/lib/famix/src/model/famix/implicit_variable.js +1 -0
  27. package/dist/lib/famix/src/model/famix/import_clause.js +5 -3
  28. package/dist/lib/famix/src/model/famix/index.js +18 -11
  29. package/dist/lib/famix/src/model/famix/indexed_file_anchor.js +3 -2
  30. package/dist/lib/famix/src/model/famix/inheritance.js +3 -2
  31. package/dist/lib/famix/src/model/famix/interface.js +2 -1
  32. package/dist/lib/famix/src/model/famix/invocation.js +3 -2
  33. package/dist/lib/famix/src/model/famix/method.js +2 -1
  34. package/dist/lib/famix/src/model/famix/module.js +53 -0
  35. package/dist/lib/famix/src/model/famix/named_entity.js +4 -3
  36. package/dist/lib/famix/src/model/famix/parameter.js +2 -1
  37. package/dist/lib/famix/src/model/famix/parameterConcretisation.js +44 -0
  38. package/dist/lib/famix/src/model/famix/parameter_type.js +22 -1
  39. package/dist/lib/famix/src/model/famix/parametric_arrow_function.js +31 -0
  40. package/dist/lib/famix/src/model/famix/parametric_class.js +44 -0
  41. package/dist/lib/famix/src/model/famix/parametric_function.js +31 -0
  42. package/dist/lib/famix/src/model/famix/parametric_interface.js +44 -0
  43. package/dist/lib/famix/src/model/famix/parametric_method.js +31 -0
  44. package/dist/lib/famix/src/model/famix/primitive_type.js +1 -0
  45. package/dist/lib/famix/src/model/famix/property.js +91 -9
  46. package/dist/lib/famix/src/model/famix/reference.js +3 -2
  47. package/dist/lib/famix/src/model/famix/scoping_entity.js +12 -10
  48. package/dist/lib/famix/src/model/famix/script_entity.js +1 -2
  49. package/dist/lib/famix/src/model/famix/source_anchor.js +1 -0
  50. package/dist/lib/famix/src/model/famix/source_language.js +1 -1
  51. package/dist/lib/famix/src/model/famix/sourced_entity.js +2 -1
  52. package/dist/lib/famix/src/model/famix/structural_entity.js +1 -0
  53. package/dist/lib/famix/src/model/famix/text_anchor.js +1 -0
  54. package/dist/lib/famix/src/model/famix/type.js +6 -4
  55. package/dist/lib/famix/src/model/famix/variable.js +1 -0
  56. package/dist/lib/ts-complex/cyclomatic-service.js +2 -2
  57. package/dist/ts2famix-cli-wrapper.js +16 -0
  58. package/dist/ts2famix-cli.js +8 -1
  59. package/dist/ts2famix-tsconfig.js +1 -0
  60. package/doc-uml/famix-typescript-model.puml +559 -0
  61. package/doc-uml/famix-typescript-model.svg +1 -0
  62. package/jest.config.json +2 -1
  63. package/package.json +10 -10
  64. package/src/analyze.ts +25 -22
  65. package/src/analyze_functions/process_functions.ts +272 -96
  66. package/src/famix_functions/EntityDictionary.ts +731 -182
  67. package/src/famix_functions/helpers_creation.ts +28 -2
  68. package/src/fqn.ts +132 -10
  69. package/src/lib/famix/src/famix_repository.ts +9 -9
  70. package/src/lib/famix/src/model/famix/access.ts +2 -2
  71. package/src/lib/famix/src/model/famix/alias.ts +1 -1
  72. package/src/lib/famix/src/model/famix/arrowFunction.ts +15 -0
  73. package/src/lib/famix/src/model/famix/behavioral_entity.ts +12 -19
  74. package/src/lib/famix/src/model/famix/comment.ts +1 -1
  75. package/src/lib/famix/src/model/famix/concretisation.ts +42 -0
  76. package/src/lib/famix/src/model/famix/container_entity.ts +6 -6
  77. package/src/lib/famix/src/model/famix/decorator.ts +1 -1
  78. package/src/lib/famix/src/model/famix/enum.ts +1 -1
  79. package/src/lib/famix/src/model/famix/enum_value.ts +1 -1
  80. package/src/lib/famix/src/model/famix/import_clause.ts +4 -3
  81. package/src/lib/famix/src/model/famix/index.ts +8 -5
  82. package/src/lib/famix/src/model/famix/indexed_file_anchor.ts +2 -2
  83. package/src/lib/famix/src/model/famix/inheritance.ts +3 -4
  84. package/src/lib/famix/src/model/famix/interface.ts +1 -1
  85. package/src/lib/famix/src/model/famix/invocation.ts +2 -2
  86. package/src/lib/famix/src/model/famix/method.ts +1 -1
  87. package/src/lib/famix/src/model/famix/module.ts +67 -1
  88. package/src/lib/famix/src/model/famix/named_entity.ts +3 -3
  89. package/src/lib/famix/src/model/famix/parameter.ts +1 -1
  90. package/src/lib/famix/src/model/famix/parameterConcretisation.ts +54 -0
  91. package/src/lib/famix/src/model/famix/parameter_type.ts +33 -6
  92. package/src/lib/famix/src/model/famix/parametric_arrow_function.ts +32 -0
  93. package/src/lib/famix/src/model/famix/parametric_class.ts +49 -0
  94. package/src/lib/famix/src/model/famix/parametric_function.ts +32 -0
  95. package/src/lib/famix/src/model/famix/parametric_interface.ts +49 -0
  96. package/src/lib/famix/src/model/famix/parametric_method.ts +32 -0
  97. package/src/lib/famix/src/model/famix/property.ts +109 -11
  98. package/src/lib/famix/src/model/famix/reference.ts +2 -2
  99. package/src/lib/famix/src/model/famix/scoping_entity.ts +12 -11
  100. package/src/lib/famix/src/model/famix/script_entity.ts +0 -2
  101. package/src/lib/famix/src/model/famix/source_language.ts +0 -1
  102. package/src/lib/famix/src/model/famix/sourced_entity.ts +1 -1
  103. package/src/lib/famix/src/model/famix/type.ts +5 -4
  104. package/src/ts2famix-cli-wrapper.ts +17 -0
  105. package/src/ts2famix-cli.ts +7 -1
  106. package/tsconfig.json +5 -5
  107. package/dist/lib/famix/src/model/famix/association.js +0 -36
  108. package/dist/lib/famix/src/model/famix/namespace.js +0 -24
  109. package/dist/lib/famix/src/model/famix/parameterizable_class.js +0 -30
  110. package/dist/lib/famix/src/model/famix/parameterizable_interface.js +0 -30
  111. package/dist/lib/famix/src/model/famix/parameterized_type.js +0 -36
  112. package/doc-uml/metamodel-full.svg +0 -1
  113. package/doc-uml/metamodel.svg +0 -1
  114. package/plantuml.jar +0 -0
  115. package/src/lib/famix/src/model/famix/association.ts +0 -44
  116. package/src/lib/famix/src/model/famix/namespace.ts +0 -28
  117. package/src/lib/famix/src/model/famix/parameterizable_class.ts +0 -31
  118. package/src/lib/famix/src/model/famix/parameterizable_interface.ts +0 -31
  119. package/src/lib/famix/src/model/famix/parameterized_type.ts +0 -40
@@ -1,9 +1,75 @@
1
1
  import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
- import { ScriptEntity } from "./script_entity";
3
2
  import { ImportClause } from "./import_clause";
3
+ import { ScopingEntity } from "./scoping_entity";
4
+ import { ScriptEntity } from "./script_entity";
4
5
 
5
6
  export class Module extends ScriptEntity {
6
7
 
8
+
9
+ /**
10
+ * Getter $isAmbient
11
+ * @return {boolean }
12
+ */
13
+ public get $isAmbient(): boolean {
14
+ return this.isAmbient;
15
+ }
16
+
17
+ /**
18
+ * Setter $isAmbient
19
+ * @param {boolean } value
20
+ */
21
+ public set $isAmbient(value: boolean ) {
22
+ this.isAmbient = value;
23
+ }
24
+
25
+ private isAmbient: boolean = false;
26
+
27
+ /**
28
+ * Getter $isNamespace
29
+ * @return {boolean }
30
+ */
31
+ public get $isNamespace(): boolean {
32
+ return this.isNamespace;
33
+ }
34
+
35
+ /**
36
+ * Setter $isNamespace
37
+ * @param {boolean } value
38
+ */
39
+ public set $isNamespace(value: boolean ) {
40
+ this.isNamespace = value;
41
+ }
42
+ private isNamespace: boolean = false;
43
+
44
+ /**
45
+ * Getter $isModule
46
+ * @return {boolean }
47
+ */
48
+ public get $isModule(): boolean {
49
+ return this.isModule;
50
+ }
51
+
52
+ /**
53
+ * Setter $isModule
54
+ * @param {boolean } value
55
+ */
56
+ public set $isModule(value: boolean ) {
57
+ this.isModule = value;
58
+ }
59
+
60
+ private isModule: boolean = true;
61
+
62
+ private parentScope: ScopingEntity;
63
+
64
+ public getParentScope(): ScopingEntity {
65
+ return this.parentScope;
66
+ }
67
+
68
+ public setParentScope(parentScope: ScopingEntity): void {
69
+ this.parentScope = parentScope;
70
+ parentScope.addModule(this);
71
+ }
72
+
7
73
  // incomingImports are in NamedEntity
8
74
  private outgoingImports: Set<ImportClause> = new Set();
9
75
 
@@ -88,11 +88,11 @@ export class NamedEntity extends SourcedEntity {
88
88
 
89
89
  public addPropertiesToExporter(exporter: FamixJSONExporter): void {
90
90
  super.addPropertiesToExporter(exporter);
91
- exporter.addProperty("fullyQualifiedName", this.getFullyQualifiedName());
92
- exporter.addProperty("incomingInvocations", this.getReceivedInvocations());
91
+ // exporter.addProperty("fullyQualifiedName", this.getFullyQualifiedName());
92
+ // exporter.addProperty("incomingInvocations", this.getReceivedInvocations());
93
93
  exporter.addProperty("incomingImports", this.getIncomingImports());
94
94
  exporter.addProperty("name", this.getName());
95
- exporter.addProperty("aliases", this.getAliases());
95
+ // exporter.addProperty("aliases", this.getAliases()); /* since these generate Unknown property messages */
96
96
  exporter.addProperty("decorators", this.getDecorators());
97
97
  }
98
98
  }
@@ -24,6 +24,6 @@ export class Parameter extends StructuralEntity {
24
24
 
25
25
  public addPropertiesToExporter(exporter: FamixJSONExporter): void {
26
26
  super.addPropertiesToExporter(exporter);
27
- exporter.addProperty("parentEntity", this.getParentEntity());
27
+ exporter.addProperty("parentBehaviouralEntity", this.getParentEntity());
28
28
  }
29
29
  }
@@ -0,0 +1,54 @@
1
+ import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
+ import { Concretisation } from "./concretisation";
3
+ import { Entity } from "./entity";
4
+ import { ParameterType } from "./parameter_type";
5
+ import { PrimitiveType } from "./primitive_type";
6
+
7
+ export class ParameterConcretisation extends Entity {
8
+
9
+ private genericParameter: ParameterType;
10
+
11
+ public getGenericParameter(): ParameterType {
12
+ return this.genericParameter;
13
+ }
14
+
15
+ public setGenericParameter(genericEntity: ParameterType): void {
16
+ this.genericParameter = genericEntity;
17
+ }
18
+
19
+ private concreteParameter: PrimitiveType;
20
+
21
+ public getConcreteParameter(): PrimitiveType {
22
+ return this.concreteParameter;
23
+ }
24
+
25
+ public setConcreteParameter(concreteParameter: PrimitiveType): void {
26
+ this.concreteParameter = concreteParameter;
27
+ }
28
+
29
+ private concretisations: Set<Concretisation> = new Set();
30
+
31
+ public getConcretisations(): Set<Concretisation> {
32
+ return this.concretisations;
33
+ }
34
+
35
+ public addConcretisation(concretisation: Concretisation): void {
36
+ if (!this.concretisations.has(concretisation)) {
37
+ this.concretisations.add(concretisation);
38
+ }
39
+ }
40
+
41
+ public getJSON(): string {
42
+ const json: FamixJSONExporter = new FamixJSONExporter("ParameterConcretisation", this);
43
+ this.addPropertiesToExporter(json);
44
+ return json.getJSON();
45
+ }
46
+
47
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
48
+ super.addPropertiesToExporter(exporter);
49
+ exporter.addProperty("genericEntity", this.getGenericParameter());
50
+ exporter.addProperty("concreteEntity", this.getConcreteParameter());
51
+ exporter.addProperty("concretisations", this.getConcretisations());
52
+ }
53
+
54
+ }
@@ -1,24 +1,49 @@
1
1
  import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
2
  import { Type } from "./type";
3
- import { ParameterizableClass } from "./parameterizable_class";
4
- import { ParameterizableInterface } from "./parameterizable_interface";
3
+ import { ParametricClass } from "./parametric_class";
4
+ import { ParametricInterface } from "./parametric_interface";
5
5
  import { Method } from "./method";
6
6
  import { Function as FamixFunction } from "./function";
7
7
  import { Accessor } from "./accessor";
8
+ import { ParametricMethod } from "./parametric_method";
9
+ import { ParametricFunction } from "./parametric_function";
10
+ import { ArrowFunction } from "./arrowFunction";
11
+ import { ParametricArrowFunction } from "./parametric_arrow_function";
8
12
 
9
13
  export class ParameterType extends Type {
10
14
 
11
- private parentGeneric: ParameterizableClass | ParameterizableInterface | Method | Accessor | FamixFunction;
15
+ private parentGeneric: ParametricClass | ParametricInterface | Method | ParametricMethod | Accessor | FamixFunction | ParametricFunction | ArrowFunction | ParametricArrowFunction;
12
16
 
13
- public getParentGeneric(): ParameterizableClass | ParameterizableInterface | Method | Accessor | FamixFunction {
17
+ public getParentGeneric(): ParametricClass | ParametricInterface | Method | ParametricMethod | Accessor | FamixFunction | ParametricFunction | ArrowFunction | ParametricArrowFunction {
14
18
  return this.parentGeneric;
15
19
  }
16
20
 
17
- public setParentGeneric(parentGeneric: ParameterizableClass | ParameterizableInterface | Method | Accessor | FamixFunction): void {
21
+ public setParentGeneric(parentGeneric: ParametricClass | ParametricInterface | Method | ParametricMethod | Accessor | FamixFunction | ParametricFunction | ArrowFunction | ParametricArrowFunction): void {
18
22
  this.parentGeneric = parentGeneric;
19
- parentGeneric.addParameterType(this);
23
+ parentGeneric.addGenericParameter(this);
20
24
  }
21
25
 
26
+ private baseType: Type;
27
+
28
+ public getBaseType(): Type {
29
+ return this.baseType;
30
+ }
31
+
32
+ public setBaseType(baseType: Type): void {
33
+ this.baseType = baseType;
34
+ }
35
+
36
+ private arguments: Set<Type> = new Set();
37
+
38
+ public getArguments(): Set<Type> {
39
+ return this.arguments;
40
+ }
41
+
42
+ public addArgument(argument: Type): void {
43
+ if (!this.arguments.has(argument)) {
44
+ this.arguments.add(argument);
45
+ }
46
+ }
22
47
 
23
48
  public getJSON(): string {
24
49
  const json: FamixJSONExporter = new FamixJSONExporter("ParameterType", this);
@@ -29,5 +54,7 @@ export class ParameterType extends Type {
29
54
  public addPropertiesToExporter(exporter: FamixJSONExporter): void {
30
55
  super.addPropertiesToExporter(exporter);
31
56
  exporter.addProperty("parentGeneric", this.getParentGeneric());
57
+ exporter.addProperty("baseType", this.getBaseType());
58
+ exporter.addProperty("arguments", this.getArguments());
32
59
  }
33
60
  }
@@ -0,0 +1,32 @@
1
+ import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
+ import { ArrowFunction } from "./arrowFunction";
3
+ import { Class } from "./class";
4
+ import { Interface } from "./interface";
5
+ import { PrimitiveType } from "./primitive_type";
6
+
7
+ export class ParametricArrowFunction extends ArrowFunction {
8
+
9
+ private concreteParameters: Set<PrimitiveType | Class | Interface> = new Set();
10
+
11
+ public getConcreteParameters(): Set<PrimitiveType | Class | Interface > {
12
+ return this.concreteParameters;
13
+ }
14
+
15
+ public addConcreteParameter(concreteParameter: PrimitiveType | Class | Interface): void {
16
+ if (!this.concreteParameters.has(concreteParameter)) {
17
+ this.concreteParameters.add(concreteParameter);
18
+ }
19
+ }
20
+
21
+ public getJSON(): string {
22
+ const json: FamixJSONExporter = new FamixJSONExporter("ParametricArrowFunction", this);
23
+ this.addPropertiesToExporter(json);
24
+ return json.getJSON();
25
+ }
26
+
27
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
28
+ super.addPropertiesToExporter(exporter);
29
+ exporter.addProperty("genericParameters", this.getGenericParameters());
30
+ exporter.addProperty("concreteParameters", this.getConcreteParameters());
31
+ }
32
+ }
@@ -0,0 +1,49 @@
1
+ import { Interface } from "./interface";
2
+ import { FamixJSONExporter } from "../../famix_JSON_exporter";
3
+ import { Class } from "./class";
4
+ import { ParameterType } from "./parameter_type";
5
+ import { PrimitiveType } from "./primitive_type";
6
+
7
+ export class ParametricClass extends Class {
8
+
9
+ private genericParameters: Set<ParameterType> = new Set();
10
+
11
+ public getGenericParameters(): Set<ParameterType> {
12
+ return this.genericParameters;
13
+ }
14
+
15
+ public addGenericParameter(genericParameter: ParameterType): void {
16
+ if (!this.genericParameters.has(genericParameter)) {
17
+ this.genericParameters.add(genericParameter);
18
+ genericParameter.setParentGeneric(this);
19
+ }
20
+ }
21
+
22
+ clearGenericParameters(): void {
23
+ this.genericParameters.clear();
24
+ }
25
+
26
+ private concreteParameters: Set<PrimitiveType | Class | Interface> = new Set();
27
+
28
+ public getConcreteParameters(): Set<PrimitiveType | Class | Interface> {
29
+ return this.concreteParameters;
30
+ }
31
+
32
+ public addConcreteParameter(concreteParameter: PrimitiveType | Class | Interface ): void {
33
+ if (!this.concreteParameters.has(concreteParameter)) {
34
+ this.concreteParameters.add(concreteParameter);
35
+ }
36
+ }
37
+
38
+ public getJSON(): string {
39
+ const json: FamixJSONExporter = new FamixJSONExporter("ParametricClass", this);
40
+ this.addPropertiesToExporter(json);
41
+ return json.getJSON();
42
+ }
43
+
44
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
45
+ super.addPropertiesToExporter(exporter);
46
+ exporter.addProperty("genericParameters", this.getGenericParameters());
47
+ exporter.addProperty("concreteParameters", this.getConcreteParameters());
48
+ }
49
+ }
@@ -0,0 +1,32 @@
1
+ import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
+ import { Class } from "./class";
3
+ import { Function } from "./function";
4
+ import { Interface } from "./interface";
5
+ import { PrimitiveType } from "./primitive_type";
6
+
7
+ export class ParametricFunction extends Function {
8
+
9
+ private concreteParameters: Set<PrimitiveType | Class | Interface> = new Set();
10
+
11
+ public getConcreteParameters(): Set<PrimitiveType | Class | Interface> {
12
+ return this.concreteParameters;
13
+ }
14
+
15
+ public addConcreteParameter(concreteParameter: PrimitiveType | Class | Interface): void {
16
+ if (!this.concreteParameters.has(concreteParameter)) {
17
+ this.concreteParameters.add(concreteParameter);
18
+ }
19
+ }
20
+
21
+ public getJSON(): string {
22
+ const json: FamixJSONExporter = new FamixJSONExporter("ParametricFunction", this);
23
+ this.addPropertiesToExporter(json);
24
+ return json.getJSON();
25
+ }
26
+
27
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
28
+ super.addPropertiesToExporter(exporter);
29
+ exporter.addProperty("genericParameters", this.getGenericParameters());
30
+ exporter.addProperty("concreteParameters", this.getConcreteParameters());
31
+ }
32
+ }
@@ -0,0 +1,49 @@
1
+ import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
+ import { Class } from "./class";
3
+ import { Interface } from "./interface";
4
+ import { ParameterType } from "./parameter_type";
5
+ import { PrimitiveType } from "./primitive_type";
6
+
7
+ export class ParametricInterface extends Interface {
8
+
9
+ private genericParameters: Set<ParameterType> = new Set();
10
+
11
+ public getGenericParameters(): Set<ParameterType> {
12
+ return this.genericParameters;
13
+ }
14
+
15
+ public addGenericParameter(genericParameter: ParameterType): void {
16
+ if (!this.genericParameters.has(genericParameter)) {
17
+ this.genericParameters.add(genericParameter);
18
+ genericParameter.setParentGeneric(this);
19
+ }
20
+ }
21
+
22
+ clearGenericParameters(): void {
23
+ this.genericParameters.clear();
24
+ }
25
+
26
+ private concreteParameters: Set<PrimitiveType | Class | Interface> = new Set();
27
+
28
+ public getConcreteParameters(): Set<PrimitiveType | Class | Interface> {
29
+ return this.concreteParameters;
30
+ }
31
+
32
+ public addConcreteParameter(concreteParameter: PrimitiveType | Class | Interface): void {
33
+ if (!this.concreteParameters.has(concreteParameter)) {
34
+ this.concreteParameters.add(concreteParameter);
35
+ }
36
+ }
37
+
38
+ public getJSON(): string {
39
+ const json: FamixJSONExporter = new FamixJSONExporter("ParametricInterface", this);
40
+ this.addPropertiesToExporter(json);
41
+ return json.getJSON();
42
+ }
43
+
44
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
45
+ super.addPropertiesToExporter(exporter);
46
+ exporter.addProperty("genericParameters", this.getGenericParameters());
47
+ exporter.addProperty("concreteParameters", this.getConcreteParameters());
48
+ }
49
+ }
@@ -0,0 +1,32 @@
1
+ import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
+ import { Class } from "./class";
3
+ import { Interface } from "./interface";
4
+ import { Method } from "./method";
5
+ import { PrimitiveType } from "./primitive_type";
6
+
7
+ export class ParametricMethod extends Method {
8
+
9
+ private concreteParameters: Set<PrimitiveType | Class | Interface> = new Set();
10
+
11
+ public getConcreteParameters(): Set<PrimitiveType | Class | Interface> {
12
+ return this.concreteParameters;
13
+ }
14
+
15
+ public addConcreteParameter(concreteParameter: PrimitiveType | Class | Interface): void {
16
+ if (!this.concreteParameters.has(concreteParameter)) {
17
+ this.concreteParameters.add(concreteParameter);
18
+ }
19
+ }
20
+
21
+ public getJSON(): string {
22
+ const json: FamixJSONExporter = new FamixJSONExporter("ParametricMethod", this);
23
+ this.addPropertiesToExporter(json);
24
+ return json.getJSON();
25
+ }
26
+
27
+ public addPropertiesToExporter(exporter: FamixJSONExporter): void {
28
+ super.addPropertiesToExporter(exporter);
29
+ exporter.addProperty("genericParameters", this.getGenericParameters());
30
+ exporter.addProperty("concreteParameters", this.getConcreteParameters());
31
+ }
32
+ }
@@ -3,9 +3,28 @@ import { Class } from "./class";
3
3
  import { Interface } from "./interface";
4
4
  import { StructuralEntity } from "./structural_entity";
5
5
 
6
+ export type VisibilityTypes = "public" | "private" | "protected" | "";
7
+
6
8
  export class Property extends StructuralEntity {
7
9
 
8
- private isClassSide: boolean;
10
+ private isClassSide: boolean = false;
11
+
12
+ /**
13
+ * Getter $readOnly
14
+ * @return {boolean}
15
+ */
16
+ public get readOnly(): boolean {
17
+ return this._readOnly;
18
+ }
19
+
20
+ /**
21
+ * Setter $readOnly
22
+ * @param {boolean} value
23
+ */
24
+ public set readOnly(value: boolean) {
25
+ this._readOnly = value;
26
+ }
27
+ private _readOnly: boolean;
9
28
 
10
29
  public getIsClassSide(): boolean {
11
30
  return this.isClassSide;
@@ -26,19 +45,94 @@ export class Property extends StructuralEntity {
26
45
  parentEntity.addProperty(this);
27
46
  }
28
47
 
29
- private modifiers: Set<string> = new Set();
30
48
 
31
- public getModifiers(): Set<string> {
32
- return this.modifiers;
49
+ /**
50
+ * Getter $isClassSide
51
+ * @return {boolean }
52
+ */
53
+ public get $isClassSide(): boolean {
54
+ return this.isClassSide;
55
+ }
56
+
57
+ /**
58
+ * Setter $isClassSide
59
+ * @param {boolean } value
60
+ */
61
+ public set $isClassSide(value: boolean ) {
62
+ this.isClassSide = value;
63
+ }
64
+
65
+ /**
66
+ * Getter isDefinitelyAssigned
67
+ * @return {boolean}
68
+ */
69
+ public get isDefinitelyAssigned(): boolean {
70
+ return this._isDefinitelyAssigned;
71
+ }
72
+
73
+ /**
74
+ * Setter isDefinitelyAssigned
75
+ * @param {boolean} value
76
+ */
77
+ public set isDefinitelyAssigned(value: boolean) {
78
+ this._isDefinitelyAssigned = value;
79
+ }
80
+
81
+ /**
82
+ * Getter isOptional
83
+ * @return {boolean}
84
+ */
85
+ public get isOptional(): boolean {
86
+ return this._isOptional;
87
+ }
88
+
89
+ /**
90
+ * Setter isOptional
91
+ * @param {boolean} value
92
+ */
93
+ public set isOptional(value: boolean) {
94
+ this._isOptional = value;
95
+ }
96
+
97
+ /**
98
+ * Getter isJavaScriptPrivate
99
+ * @return {boolean}
100
+ */
101
+ public get isJavaScriptPrivate(): boolean {
102
+ return this._isJavaScriptPrivate;
103
+ }
104
+
105
+ /**
106
+ * Setter isJavaScriptPrivate
107
+ * @param {boolean} value
108
+ */
109
+ public set isJavaScriptPrivate(value: boolean) {
110
+ this._isJavaScriptPrivate = value;
111
+ }
112
+ private _isDefinitelyAssigned: boolean;
113
+
114
+ private _isOptional: boolean;
115
+
116
+ private _isJavaScriptPrivate: boolean;
117
+
118
+ /**
119
+ * Getter visibility
120
+ * @return {VisibilityTypes }
121
+ */
122
+ public get visibility(): VisibilityTypes {
123
+ return this._visibility;
33
124
  }
34
125
 
35
- public addModifier(modifier: string): void {
36
- if (!this.modifiers.has(modifier)) {
37
- this.modifiers.add(modifier);
38
- }
126
+ /**
127
+ * Setter visibility
128
+ * @param {VisibilityTypes } value
129
+ */
130
+ public set visibility(value: VisibilityTypes) {
131
+ this._visibility = value;
39
132
  }
40
133
 
41
-
134
+ private _visibility: VisibilityTypes = "";
135
+
42
136
  public getJSON(): string {
43
137
  const json: FamixJSONExporter = new FamixJSONExporter("Property", this);
44
138
  this.addPropertiesToExporter(json);
@@ -47,8 +141,12 @@ export class Property extends StructuralEntity {
47
141
 
48
142
  public addPropertiesToExporter(exporter: FamixJSONExporter): void {
49
143
  super.addPropertiesToExporter(exporter);
144
+ exporter.addProperty("readOnly", this.readOnly);
50
145
  exporter.addProperty("isClassSide", this.getIsClassSide());
51
- exporter.addProperty("parentEntity", this.getParentEntity());
52
- exporter.addProperty("modifiers", this.getModifiers());
146
+ exporter.addProperty("parentType", this.getParentEntity());
147
+ exporter.addProperty("visibility", this.visibility);
148
+ exporter.addProperty("isDefinitelyAssigned", this.isDefinitelyAssigned);
149
+ exporter.addProperty("isOptional", this.isOptional);
150
+ exporter.addProperty("isJavaScriptPrivate", this.isJavaScriptPrivate);
53
151
  }
54
152
  }
@@ -1,9 +1,9 @@
1
1
  import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
2
  import { Type } from "./type";
3
- import { Association } from "./association";
4
3
  import { ContainerEntity } from "./container_entity";
4
+ import { Entity } from "./entity";
5
5
 
6
- export class Reference extends Association {
6
+ export class Reference extends Entity {
7
7
 
8
8
  private source: ContainerEntity;
9
9
 
@@ -1,23 +1,24 @@
1
1
  import { FamixJSONExporter } from "../../famix_JSON_exporter";
2
2
  import { ContainerEntity } from "./container_entity";
3
- import { Namespace } from "./namespace";
3
+ // import { Namespace } from "./namespace";
4
4
  import { logger } from "../../../../../analyze";
5
+ import { Module } from "./module";
5
6
 
6
7
  export class ScopingEntity extends ContainerEntity {
7
8
 
8
- private childrenNamespaces: Set<Namespace> = new Set();
9
+ private childModules: Set<Module> = new Set();
9
10
 
10
- public getNamespaces(): Set<Namespace> {
11
- return this.childrenNamespaces;
11
+ public getModules(): Set<Module> {
12
+ return this.childModules;
12
13
  }
13
14
 
14
- public addNamespace(childNamespace: Namespace): void {
15
- if (!this.childrenNamespaces.has(childNamespace)) {
16
- logger.debug("Adding namespace " + childNamespace.getName() + " to " + this.getName());
17
- this.childrenNamespaces.add(childNamespace);
18
- childNamespace.setParentScope(this);
15
+ public addModule(childModule: Module): void {
16
+ if (!this.childModules.has(childModule)) {
17
+ logger.debug("Adding module " + childModule.getName() + " to " + this.getName());
18
+ this.childModules.add(childModule);
19
+ childModule.setParentScope(this);
19
20
  } else {
20
- logger.debug("Namespace " + childNamespace.getName() + " already added to " + this.getName());
21
+ logger.debug("Module " + childModule.getName() + " already added to " + this.getName());
21
22
  }
22
23
  }
23
24
 
@@ -30,6 +31,6 @@ export class ScopingEntity extends ContainerEntity {
30
31
 
31
32
  public addPropertiesToExporter(exporter: FamixJSONExporter): void {
32
33
  super.addPropertiesToExporter(exporter);
33
- exporter.addProperty("namespaces", this.getNamespaces());
34
+ // exporter.addProperty("namespaces", this.getModules());
34
35
  }
35
36
  }
@@ -32,7 +32,5 @@ export class ScriptEntity extends ScopingEntity {
32
32
 
33
33
  public addPropertiesToExporter(exporter: FamixJSONExporter): void {
34
34
  super.addPropertiesToExporter(exporter);
35
- exporter.addProperty("numberOfLinesOfText", this.getNumberOfLinesOfText());
36
- exporter.addProperty("numberOfCharacters", this.getNumberOfCharacters());
37
35
  }
38
36
  }
@@ -31,7 +31,6 @@ export class SourceLanguage extends Entity {
31
31
 
32
32
  public addPropertiesToExporter(exporter: FamixJSONExporter): void {
33
33
  super.addPropertiesToExporter(exporter);
34
- exporter.addProperty("name", this.name);
35
34
  exporter.addProperty("sourcedEntities", this.getSourcedEntities());
36
35
  }
37
36
  }
@@ -41,7 +41,7 @@ export class SourcedEntity extends Entity {
41
41
  this.comments.add(comment);
42
42
  comment.setContainer(this);
43
43
  } else {
44
- logger.warn("WARNING: adding comment that is already in comments: " + comment.getJSON() + " to " + this.getJSON());
44
+ logger.debug("Adding comment that is already in comments: " + comment.getJSON() + " to " + this.getJSON());
45
45
  }
46
46
  }
47
47
 
@@ -79,10 +79,11 @@ export class Type extends ContainerEntity {
79
79
 
80
80
  public addPropertiesToExporter(exporter: FamixJSONExporter): void {
81
81
  super.addPropertiesToExporter(exporter);
82
- exporter.addProperty("container", this.getContainer());
83
- exporter.addProperty("typeAliases", this.getTypeAliases());
84
- exporter.addProperty("structuresWithDeclaredType", this.getStructuresWithDeclaredType());
85
- exporter.addProperty("behavioralEntitiesWithDeclaredType", this.getBehavioralEntitiesWithDeclaredType());
82
+ exporter.addProperty("typeContainer", this.getContainer());
83
+ /* unsupported properties in MM so far */
84
+ // exporter.addProperty("typeAliases", this.getTypeAliases());
85
+ // exporter.addProperty("structuresWithDeclaredType", this.getStructuresWithDeclaredType());
86
+ // exporter.addProperty("behavioralEntitiesWithDeclaredType", this.getBehavioralEntitiesWithDeclaredType());
86
87
  exporter.addProperty("incomingReferences", this.getIncomingReferences());
87
88
  }
88
89
  }