From 0fa868851da23ccbd58537195a94a0697bcbba3a Mon Sep 17 00:00:00 2001 From: barsdeveloper Date: Wed, 9 Mar 2022 23:11:40 +0100 Subject: [PATCH] Some documentation comments --- dist/ueblueprint.js | 112 ++++++++++++++++++++++----- js/Utility.js | 7 +- js/entity/FunctionReferenceEntity.js | 3 + js/entity/KeyBindingEntity.js | 6 ++ js/entity/LocalizedTextEntity.js | 4 + js/entity/ObjectEntity.js | 15 +++- js/entity/ObjectReferenceEntity.js | 3 + js/entity/PathSymbolEntity.js | 2 + js/entity/PinEntity.js | 47 ++++++++++- js/entity/PinReferenceEntity.js | 4 +- js/entity/TypeInitialization.js | 1 - js/selection/FastSelectionModel.js | 30 +++---- 12 files changed, 192 insertions(+), 42 deletions(-) diff --git a/dist/ueblueprint.js b/dist/ueblueprint.js index 3105154..b69332c 100755 --- a/dist/ueblueprint.js +++ b/dist/ueblueprint.js @@ -311,23 +311,25 @@ class OrderedIndexArray { } } +/** + * @typedef {{ + * primaryInf: number, + * primarySup: number, + * secondaryInf: number, + * secondarySup: number + * }} BoundariesInfo + * @typedef {{ + * primaryBoundary: number, + * secondaryBoundary: number, + * insertionPosition: number, + * rectangle: number + * onSecondaryAxis: Boolean + * }} Metadata + * @typedef {numeric} Rectangle + */ class FastSelectionModel { /** - * @typedef {{ - * primaryInf: number, - * primarySup: number, - * secondaryInf: number, - * secondarySup: number - * }} BoundariesInfo - * @typedef {{ - * primaryBoundary: number, - * secondaryBoundary: number, - * insertionPosition: number, - * rectangle: number - * onSecondaryAxis: Boolean - * }} Metadata - * @typedef {numeric} Rectangle * @param {number[]} initialPosition Coordinates of the starting point of selection [primaryAxisValue, secondaryAxisValue]. * @param {Rectangle[]} rectangles Rectangles that can be selected by this object. * @param {(rect: Rectangle) => BoundariesInfo} boundariesFunc A function that, given a rectangle, it provides the boundaries of such rectangle. @@ -770,7 +772,6 @@ class TypeInitialization { } /** - * * @param {typeof Object} type * @param {boolean} showDefault * @param {*} value @@ -828,11 +829,14 @@ class Utility { console.error("Expected keys to be an array."); } if (keys.length == 1) { - if (create || keys[0] in target) { + if (create || keys[0] in target || target[keys[0]] === undefined) { target[keys[0]] = value; return true } } else if (keys.length > 0) { + if (create && target[keys[0]] === undefined) { + target[keys[0]] = {}; + } return Utility.objectSet(target[keys[0]], keys.slice(1), value, create) } return false @@ -849,7 +853,7 @@ class Utility { if (keys.constructor != Array) { console.error("Expected keys to be an array."); } - if (keys.length == 0 || !(keys[0] in source)) { + if (keys.length == 0 || !(keys[0] in source) || source[keys[0]] === undefined) { return defaultValue } if (keys.length == 1) { @@ -959,6 +963,9 @@ class ObjectReferenceEntity extends IEntity { type: String, path: String } + + /** @type {String} */ type + /** @type {String} */ path } class FunctionReferenceEntity extends IEntity { @@ -967,6 +974,9 @@ class FunctionReferenceEntity extends IEntity { MemberParent: ObjectReferenceEntity, MemberName: "" } + + /** @type {ObjectReferenceEntity} */ MemberParent + /** @type {String} */ MemberName } class GuidEntity extends IEntity { @@ -1025,10 +1035,16 @@ class LocalizedTextEntity extends IEntity { key: String, value: String } + + /** @type {String} */ namespace + /** @type {String} */ key + /** @type {String} */ value } class PathSymbolEntity extends IEntity { + //value + static attributes = { value: String } @@ -1046,6 +1062,20 @@ class PinReferenceEntity extends IEntity { } } +/** + * @typedef {{ + * PinCategory: String, + * PinSubCategory: String, + * PinSubCategoryObject: ObjectReferenceEntity, + * PinSubCategoryMemberReference: *, + * PinValueType: String, + * ContainerType: ObjectReferenceEntity, + * bIsReference: Boolean, + * bIsConst: Boolean, + * bIsWeakPointer: Boolean, + * bIsUObjectWrapper: Boolean, + * }} PinTypeObjectType + */ class PinEntity extends IEntity { static lookbehind = "Pin" @@ -1065,7 +1095,7 @@ class PinEntity extends IEntity { bIsReference: false, bIsConst: false, bIsWeakPointer: false, - bIsUObjectWrapper: false + bIsUObjectWrapper: false, }, LinkedTo: [PinReferenceEntity], DefaultValue: "", @@ -1079,6 +1109,23 @@ class PinEntity extends IEntity { bOrphanedPin: false, } + /** @type {GuidEntity} */ PinId + /** @type {String} */ PinName + /** @type {LocalizedTextEntity} */ PinFriendlyName + /** @type {String} */ PinToolTip + /** @type {String} */ Direction + /** @type {PinTypeObjectType} */ PinType + /** @type {PinReferenceEntity[]} */ LinkedTo + /** @type {String} */ DefaultValue + /** @type {String} */ AutogeneratedDefaultValue + /** @type {GuidEntity} */ PersistentGuid + /** @type {Boolean} */ bHidden + /** @type {Boolean} */ bNotConnectable + /** @type {Boolean} */ bDefaultValueIsReadOnly + /** @type {Boolean} */ bDefaultValueIsIgnored + /** @type {Boolean} */ bAdvancedView + /** @type {Boolean} */ bOrphanedPin + isInput() { return !this.bHidden && this.Direction !== "EGPD_Output" } @@ -1088,7 +1135,19 @@ class PinEntity extends IEntity { } isConnected() { - return this.LinkedTo.length > 0 + return this.LinkedTo?.length > 0 ?? false + } + + /** + * + * @param {PinReferenceEntity} pinReferenceEntity + */ + connectTo(pinReferenceEntity) { + /** @type {PinReferenceEntity[]} */ + this.LinkedTo; + this.LinkedTo.forEach(reference => { + + }); } getType() { @@ -1123,8 +1182,21 @@ class ObjectEntity extends IEntity { CustomProperties: [PinEntity] } + /** @type {ObjectReferenceEntity} */ Class + /** @type {String} */ Name + /** @type {Boolean} */ bIsPureFunc + /** @type {VariableReferenceEntity} */ VariableReference + /** @type {FunctionReferenceEntity} */ FunctionReference + /** @type {FunctionReferenceEntity} */ EventReference + /** @type {ObjectReferenceEntity} */ TargetType + /** @type {IntegerEntity} */ NodePosX + /** @type {IntegerEntity} */ NodePosY + /** @type {GuidEntity} */ NodeGuid + /** @type {IntegerEntity} */ ErrorType + /** @type {String} */ ErrorMsg + /** @type {PinEntity[]} */ CustomProperties + /** - * * @returns {String} The name of the node */ getNodeDisplayName() { diff --git a/js/Utility.js b/js/Utility.js index 7a87eb9..6f5afd1 100755 --- a/js/Utility.js +++ b/js/Utility.js @@ -44,11 +44,14 @@ export default class Utility { console.error("Expected keys to be an array.") } if (keys.length == 1) { - if (create || keys[0] in target) { + if (create || keys[0] in target || target[keys[0]] === undefined) { target[keys[0]] = value return true } } else if (keys.length > 0) { + if (create && target[keys[0]] === undefined) { + target[keys[0]] = {} + } return Utility.objectSet(target[keys[0]], keys.slice(1), value, create) } return false @@ -65,7 +68,7 @@ export default class Utility { if (keys.constructor != Array) { console.error("Expected keys to be an array.") } - if (keys.length == 0 || !(keys[0] in source)) { + if (keys.length == 0 || !(keys[0] in source) || source[keys[0]] === undefined) { return defaultValue } if (keys.length == 1) { diff --git a/js/entity/FunctionReferenceEntity.js b/js/entity/FunctionReferenceEntity.js index 44931c6..77921a3 100755 --- a/js/entity/FunctionReferenceEntity.js +++ b/js/entity/FunctionReferenceEntity.js @@ -7,4 +7,7 @@ export default class FunctionReferenceEntity extends IEntity { MemberParent: ObjectReferenceEntity, MemberName: "" } + + /** @type {ObjectReferenceEntity} */ MemberParent + /** @type {String} */ MemberName } diff --git a/js/entity/KeyBindingEntity.js b/js/entity/KeyBindingEntity.js index 609decd..405a80f 100644 --- a/js/entity/KeyBindingEntity.js +++ b/js/entity/KeyBindingEntity.js @@ -9,4 +9,10 @@ export default class KeyBindingEntity extends IEntity { Key: String, CommandName: String, } + + /** @type {Boolean} */ bCtrlDown + /** @type {Boolean} */ bAltDown + /** @type {Boolean} */ bShiftDown + /** @type {String} */ Key + /** @type {String} */ CommandName } diff --git a/js/entity/LocalizedTextEntity.js b/js/entity/LocalizedTextEntity.js index a35fe46..222f6a1 100755 --- a/js/entity/LocalizedTextEntity.js +++ b/js/entity/LocalizedTextEntity.js @@ -8,4 +8,8 @@ export default class LocalizedTextEntity extends IEntity { key: String, value: String } + + /** @type {String} */ namespace + /** @type {String} */ key + /** @type {String} */ value } diff --git a/js/entity/ObjectEntity.js b/js/entity/ObjectEntity.js index f9395fc..67118a2 100755 --- a/js/entity/ObjectEntity.js +++ b/js/entity/ObjectEntity.js @@ -25,8 +25,21 @@ export default class ObjectEntity extends IEntity { CustomProperties: [PinEntity] } + /** @type {ObjectReferenceEntity} */ Class + /** @type {String} */ Name + /** @type {Boolean} */ bIsPureFunc + /** @type {VariableReferenceEntity} */ VariableReference + /** @type {FunctionReferenceEntity} */ FunctionReference + /** @type {FunctionReferenceEntity} */ EventReference + /** @type {ObjectReferenceEntity} */ TargetType + /** @type {IntegerEntity} */ NodePosX + /** @type {IntegerEntity} */ NodePosY + /** @type {GuidEntity} */ NodeGuid + /** @type {IntegerEntity} */ ErrorType + /** @type {String} */ ErrorMsg + /** @type {PinEntity[]} */ CustomProperties + /** - * * @returns {String} The name of the node */ getNodeDisplayName() { diff --git a/js/entity/ObjectReferenceEntity.js b/js/entity/ObjectReferenceEntity.js index 84d3571..6849ff7 100755 --- a/js/entity/ObjectReferenceEntity.js +++ b/js/entity/ObjectReferenceEntity.js @@ -6,4 +6,7 @@ export default class ObjectReferenceEntity extends IEntity { type: String, path: String } + + /** @type {String} */ type + /** @type {String} */ path } diff --git a/js/entity/PathSymbolEntity.js b/js/entity/PathSymbolEntity.js index b995eb1..ddcc2bd 100755 --- a/js/entity/PathSymbolEntity.js +++ b/js/entity/PathSymbolEntity.js @@ -2,6 +2,8 @@ import IEntity from "./IEntity" export default class PathSymbolEntity extends IEntity { + //value + static attributes = { value: String } diff --git a/js/entity/PinEntity.js b/js/entity/PinEntity.js index 949437c..099f279 100755 --- a/js/entity/PinEntity.js +++ b/js/entity/PinEntity.js @@ -5,6 +5,20 @@ import ObjectReferenceEntity from "./ObjectReferenceEntity" import PinReferenceEntity from "./PinReferenceEntity" import TypeInitialization from "./TypeInitialization" +/** + * @typedef {{ + * PinCategory: String, + * PinSubCategory: String, + * PinSubCategoryObject: ObjectReferenceEntity, + * PinSubCategoryMemberReference: *, + * PinValueType: String, + * ContainerType: ObjectReferenceEntity, + * bIsReference: Boolean, + * bIsConst: Boolean, + * bIsWeakPointer: Boolean, + * bIsUObjectWrapper: Boolean, + * }} PinTypeObjectType + */ export default class PinEntity extends IEntity { static lookbehind = "Pin" @@ -24,7 +38,7 @@ export default class PinEntity extends IEntity { bIsReference: false, bIsConst: false, bIsWeakPointer: false, - bIsUObjectWrapper: false + bIsUObjectWrapper: false, }, LinkedTo: [PinReferenceEntity], DefaultValue: "", @@ -38,6 +52,23 @@ export default class PinEntity extends IEntity { bOrphanedPin: false, } + /** @type {GuidEntity} */ PinId + /** @type {String} */ PinName + /** @type {LocalizedTextEntity} */ PinFriendlyName + /** @type {String} */ PinToolTip + /** @type {String} */ Direction + /** @type {PinTypeObjectType} */ PinType + /** @type {PinReferenceEntity[]} */ LinkedTo + /** @type {String} */ DefaultValue + /** @type {String} */ AutogeneratedDefaultValue + /** @type {GuidEntity} */ PersistentGuid + /** @type {Boolean} */ bHidden + /** @type {Boolean} */ bNotConnectable + /** @type {Boolean} */ bDefaultValueIsReadOnly + /** @type {Boolean} */ bDefaultValueIsIgnored + /** @type {Boolean} */ bAdvancedView + /** @type {Boolean} */ bOrphanedPin + isInput() { return !this.bHidden && this.Direction !== "EGPD_Output" } @@ -47,7 +78,19 @@ export default class PinEntity extends IEntity { } isConnected() { - return this.LinkedTo.length > 0 + return this.LinkedTo?.length > 0 ?? false + } + + /** + * + * @param {PinReferenceEntity} pinReferenceEntity + */ + connectTo(pinReferenceEntity) { + /** @type {PinReferenceEntity[]} */ + this.LinkedTo + this.LinkedTo.forEach(reference => { + + }) } getType() { diff --git a/js/entity/PinReferenceEntity.js b/js/entity/PinReferenceEntity.js index 5646970..9e3d175 100755 --- a/js/entity/PinReferenceEntity.js +++ b/js/entity/PinReferenceEntity.js @@ -1,11 +1,11 @@ import GuidEntity from "./GuidEntity" import IEntity from "./IEntity" -import PathSymbol from "./PathSymbolEntity" +import PathSymbolEntity from "./PathSymbolEntity" export default class PinReferenceEntity extends IEntity { static attributes = { - objectName: PathSymbol, + objectName: PathSymbolEntity, pinGuid: GuidEntity } } diff --git a/js/entity/TypeInitialization.js b/js/entity/TypeInitialization.js index 35dadd1..9da2bbd 100755 --- a/js/entity/TypeInitialization.js +++ b/js/entity/TypeInitialization.js @@ -11,7 +11,6 @@ export default class TypeInitialization { } /** - * * @param {typeof Object} type * @param {boolean} showDefault * @param {*} value diff --git a/js/selection/FastSelectionModel.js b/js/selection/FastSelectionModel.js index 614cc06..66233a7 100755 --- a/js/selection/FastSelectionModel.js +++ b/js/selection/FastSelectionModel.js @@ -1,22 +1,24 @@ import OrderedIndexArray from "./OrderedIndexArray" +/** + * @typedef {{ + * primaryInf: number, + * primarySup: number, + * secondaryInf: number, + * secondarySup: number + * }} BoundariesInfo + * @typedef {{ + * primaryBoundary: number, + * secondaryBoundary: number, + * insertionPosition: number, + * rectangle: number + * onSecondaryAxis: Boolean + * }} Metadata + * @typedef {numeric} Rectangle + */ export default class FastSelectionModel { /** - * @typedef {{ - * primaryInf: number, - * primarySup: number, - * secondaryInf: number, - * secondarySup: number - * }} BoundariesInfo - * @typedef {{ - * primaryBoundary: number, - * secondaryBoundary: number, - * insertionPosition: number, - * rectangle: number - * onSecondaryAxis: Boolean - * }} Metadata - * @typedef {numeric} Rectangle * @param {number[]} initialPosition Coordinates of the starting point of selection [primaryAxisValue, secondaryAxisValue]. * @param {Rectangle[]} rectangles Rectangles that can be selected by this object. * @param {(rect: Rectangle) => BoundariesInfo} boundariesFunc A function that, given a rectangle, it provides the boundaries of such rectangle.