@bptlab/openbpt-modeler-typed-pn-variants 1.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.
- package/LICENSE +21 -0
- package/README.md +25 -0
- package/assets/icons/pn-fire-transition.svg +6 -0
- package/assets/icons/pn-inhibitor-arc.svg +30 -0
- package/assets/icons/pn-place.svg +62 -0
- package/assets/icons/pn-transition.svg +46 -0
- package/assets/icons/pn-unfire-transition.svg +6 -0
- package/assets/icons/reset.svg +1 -0
- package/assets/icons/toggle-off.svg +1 -0
- package/assets/icons/toggle-on.svg +1 -0
- package/assets/simulation.css +265 -0
- package/assets/tpn-js.css +101 -0
- package/dist/lib/BaseViewer.js +181 -0
- package/dist/lib/BaseViewer.js.map +1 -0
- package/dist/lib/CustomModeler.js +100 -0
- package/dist/lib/CustomModeler.js.map +1 -0
- package/dist/lib/NavigatedViewer.js +14 -0
- package/dist/lib/NavigatedViewer.js.map +1 -0
- package/dist/lib/Viewer.js +53 -0
- package/dist/lib/Viewer.js.map +1 -0
- package/dist/lib/auto-place/CustomAutoPlace.js +10 -0
- package/dist/lib/auto-place/CustomAutoPlace.js.map +1 -0
- package/dist/lib/auto-place/CustomAutoPlaceUtil.js +51 -0
- package/dist/lib/auto-place/CustomAutoPlaceUtil.js.map +1 -0
- package/dist/lib/auto-place/index.js +9 -0
- package/dist/lib/auto-place/index.js.map +1 -0
- package/dist/lib/common/copy-paste/CommonCopyPaste.js +58 -0
- package/dist/lib/common/copy-paste/CommonCopyPaste.js.map +1 -0
- package/dist/lib/common/copy-paste/ModdleCopy.js +168 -0
- package/dist/lib/common/copy-paste/ModdleCopy.js.map +1 -0
- package/dist/lib/common/copy-paste/index.js +10 -0
- package/dist/lib/common/copy-paste/index.js.map +1 -0
- package/dist/lib/common/editor-actions/EditorActions.js +110 -0
- package/dist/lib/common/editor-actions/EditorActions.js.map +1 -0
- package/dist/lib/common/editor-actions/index.js +7 -0
- package/dist/lib/common/editor-actions/index.js.map +1 -0
- package/dist/lib/common/keyboard/KeyboardBindings.js +101 -0
- package/dist/lib/common/keyboard/KeyboardBindings.js.map +1 -0
- package/dist/lib/common/keyboard/index.js +8 -0
- package/dist/lib/common/keyboard/index.js.map +1 -0
- package/dist/lib/common/search/CommonSearchProvider.js +72 -0
- package/dist/lib/common/search/CommonSearchProvider.js.map +1 -0
- package/dist/lib/common/search/index.js +9 -0
- package/dist/lib/common/search/index.js.map +1 -0
- package/dist/lib/core/index.js +6 -0
- package/dist/lib/core/index.js.map +1 -0
- package/dist/lib/declarations-panel/Util.js +32 -0
- package/dist/lib/declarations-panel/Util.js.map +1 -0
- package/dist/lib/declarations-panel/cmd/IdentifierCommitHandler.js +34 -0
- package/dist/lib/declarations-panel/cmd/IdentifierCommitHandler.js.map +1 -0
- package/dist/lib/declarations-panel/cmd/MultiCommandHandler.js +24 -0
- package/dist/lib/declarations-panel/cmd/MultiCommandHandler.js.map +1 -0
- package/dist/lib/declarations-panel/cmd/index.js +19 -0
- package/dist/lib/declarations-panel/cmd/index.js.map +1 -0
- package/dist/lib/declarations-panel/context/DeclarationsPanelContext.js +10 -0
- package/dist/lib/declarations-panel/context/DeclarationsPanelContext.js.map +1 -0
- package/dist/lib/declarations-panel/context/index.js +2 -0
- package/dist/lib/declarations-panel/context/index.js.map +1 -0
- package/dist/lib/declarations-panel/hooks/index.js +2 -0
- package/dist/lib/declarations-panel/hooks/index.js.map +1 -0
- package/dist/lib/declarations-panel/hooks/useService.js +7 -0
- package/dist/lib/declarations-panel/hooks/useService.js.map +1 -0
- package/dist/lib/declarations-panel/provider/DeclarationsProvider.js +107 -0
- package/dist/lib/declarations-panel/provider/DeclarationsProvider.js.map +1 -0
- package/dist/lib/declarations-panel/provider/IdentifierService.js +107 -0
- package/dist/lib/declarations-panel/provider/IdentifierService.js.map +1 -0
- package/dist/lib/declarations-panel/provider/SimulationModeService.js +14 -0
- package/dist/lib/declarations-panel/provider/SimulationModeService.js.map +1 -0
- package/dist/lib/declarations-panel/provider/index.js +14 -0
- package/dist/lib/declarations-panel/provider/index.js.map +1 -0
- package/dist/lib/declarations-panel/provider/properties/ArcProps.js +123 -0
- package/dist/lib/declarations-panel/provider/properties/ArcProps.js.map +1 -0
- package/dist/lib/declarations-panel/provider/properties/IdProps.js +47 -0
- package/dist/lib/declarations-panel/provider/properties/IdProps.js.map +1 -0
- package/dist/lib/declarations-panel/provider/properties/ModelDeclarations.js +193 -0
- package/dist/lib/declarations-panel/provider/properties/ModelDeclarations.js.map +1 -0
- package/dist/lib/declarations-panel/provider/properties/NameProps.js +43 -0
- package/dist/lib/declarations-panel/provider/properties/NameProps.js.map +1 -0
- package/dist/lib/declarations-panel/provider/properties/PlaceProps.js +135 -0
- package/dist/lib/declarations-panel/provider/properties/PlaceProps.js.map +1 -0
- package/dist/lib/declarations-panel/provider/properties/ReferenceSelect.js +21 -0
- package/dist/lib/declarations-panel/provider/properties/ReferenceSelect.js.map +1 -0
- package/dist/lib/declarations-panel/provider/properties/TokenProps.js +116 -0
- package/dist/lib/declarations-panel/provider/properties/TokenProps.js.map +1 -0
- package/dist/lib/declarations-panel/provider/properties/Util.js +112 -0
- package/dist/lib/declarations-panel/provider/properties/Util.js.map +1 -0
- package/dist/lib/declarations-panel/provider/properties/VariableArcProps.js +107 -0
- package/dist/lib/declarations-panel/provider/properties/VariableArcProps.js.map +1 -0
- package/dist/lib/declarations-panel/provider/properties/index.js +8 -0
- package/dist/lib/declarations-panel/provider/properties/index.js.map +1 -0
- package/dist/lib/declarations-panel/render/DeclarationsPanel.js +197 -0
- package/dist/lib/declarations-panel/render/DeclarationsPanel.js.map +1 -0
- package/dist/lib/declarations-panel/render/DeclarationsPanelRenderer.js +154 -0
- package/dist/lib/declarations-panel/render/DeclarationsPanelRenderer.js.map +1 -0
- package/dist/lib/declarations-panel/render/PanelHeaderProvider.js +55 -0
- package/dist/lib/declarations-panel/render/PanelHeaderProvider.js.map +1 -0
- package/dist/lib/declarations-panel/render/PanelPlaceholderProvider.js +17 -0
- package/dist/lib/declarations-panel/render/PanelPlaceholderProvider.js.map +1 -0
- package/dist/lib/declarations-panel/render/index.js +9 -0
- package/dist/lib/declarations-panel/render/index.js.map +1 -0
- package/dist/lib/draw/CustomRenderer.js +361 -0
- package/dist/lib/draw/CustomRenderer.js.map +1 -0
- package/dist/lib/draw/TextRenderer.js +52 -0
- package/dist/lib/draw/TextRenderer.js.map +1 -0
- package/dist/lib/draw/index.js +8 -0
- package/dist/lib/draw/index.js.map +1 -0
- package/dist/lib/import/CustomImporter.js +177 -0
- package/dist/lib/import/CustomImporter.js.map +1 -0
- package/dist/lib/import/CustomTreeWalker.js +178 -0
- package/dist/lib/import/CustomTreeWalker.js.map +1 -0
- package/dist/lib/import/Importer.js +47 -0
- package/dist/lib/import/Importer.js.map +1 -0
- package/dist/lib/import/index.js +7 -0
- package/dist/lib/import/index.js.map +1 -0
- package/dist/lib/moddle/CustomModdle.js +86 -0
- package/dist/lib/moddle/CustomModdle.js.map +1 -0
- package/dist/lib/moddle/index.js +15 -0
- package/dist/lib/moddle/index.js.map +1 -0
- package/dist/lib/moddle/resources/dc.json +99 -0
- package/dist/lib/moddle/resources/diagramSchema.js +210 -0
- package/dist/lib/moddle/resources/diagramSchema.js.map +1 -0
- package/dist/lib/moddle/resources/modelSchema.js +254 -0
- package/dist/lib/moddle/resources/modelSchema.js.map +1 -0
- package/dist/lib/modeling/CustomElementFactory.js +66 -0
- package/dist/lib/modeling/CustomElementFactory.js.map +1 -0
- package/dist/lib/modeling/CustomLabelEditing.js +177 -0
- package/dist/lib/modeling/CustomLabelEditing.js.map +1 -0
- package/dist/lib/modeling/CustomModeling.js +40 -0
- package/dist/lib/modeling/CustomModeling.js.map +1 -0
- package/dist/lib/modeling/CustomUpdater.js +291 -0
- package/dist/lib/modeling/CustomUpdater.js.map +1 -0
- package/dist/lib/modeling/CustomVerification.js +111 -0
- package/dist/lib/modeling/CustomVerification.js.map +1 -0
- package/dist/lib/modeling/ElementFactory.js +56 -0
- package/dist/lib/modeling/ElementFactory.js.map +1 -0
- package/dist/lib/modeling/LabelUtil.js +151 -0
- package/dist/lib/modeling/LabelUtil.js.map +1 -0
- package/dist/lib/modeling/UpdateLabelHandler.js +86 -0
- package/dist/lib/modeling/UpdateLabelHandler.js.map +1 -0
- package/dist/lib/modeling/UpdateModdlePropertiesHandler.js +88 -0
- package/dist/lib/modeling/UpdateModdlePropertiesHandler.js.map +1 -0
- package/dist/lib/modeling/UpdatePropertiesHandler.js +136 -0
- package/dist/lib/modeling/UpdatePropertiesHandler.js.map +1 -0
- package/dist/lib/modeling/behavior/AdaptiveLabelPositioningBehavior.js +169 -0
- package/dist/lib/modeling/behavior/AdaptiveLabelPositioningBehavior.js.map +1 -0
- package/dist/lib/modeling/behavior/LabelBehavior.js +255 -0
- package/dist/lib/modeling/behavior/LabelBehavior.js.map +1 -0
- package/dist/lib/modeling/behavior/index.js +8 -0
- package/dist/lib/modeling/behavior/index.js.map +1 -0
- package/dist/lib/modeling/behavior/util/GeometricUtil.js +99 -0
- package/dist/lib/modeling/behavior/util/GeometricUtil.js.map +1 -0
- package/dist/lib/modeling/behavior/util/LabelLayoutUtil.js +178 -0
- package/dist/lib/modeling/behavior/util/LabelLayoutUtil.js.map +1 -0
- package/dist/lib/modeling/behavior/util/LineAttachmentUtil.js +175 -0
- package/dist/lib/modeling/behavior/util/LineAttachmentUtil.js.map +1 -0
- package/dist/lib/modeling/index.js +36 -0
- package/dist/lib/modeling/index.js.map +1 -0
- package/dist/lib/palette/CustomContextPadProvider.js +182 -0
- package/dist/lib/palette/CustomContextPadProvider.js.map +1 -0
- package/dist/lib/palette/CustomPaletteProvider.js +93 -0
- package/dist/lib/palette/CustomPaletteProvider.js.map +1 -0
- package/dist/lib/palette/TokenModals.js +105 -0
- package/dist/lib/palette/TokenModals.js.map +1 -0
- package/dist/lib/palette/index.js +28 -0
- package/dist/lib/palette/index.js.map +1 -0
- package/dist/lib/replace/ReplaceMenuProvider.js +84 -0
- package/dist/lib/replace/ReplaceMenuProvider.js.map +1 -0
- package/dist/lib/replace/index.js +9 -0
- package/dist/lib/replace/index.js.map +1 -0
- package/dist/lib/rules/CustomRuleProvider.js +107 -0
- package/dist/lib/rules/CustomRuleProvider.js.map +1 -0
- package/dist/lib/rules/index.js +8 -0
- package/dist/lib/rules/index.js.map +1 -0
- package/dist/lib/simulation/EventHelper.js +6 -0
- package/dist/lib/simulation/EventHelper.js.map +1 -0
- package/dist/lib/simulation/Utils.js +8 -0
- package/dist/lib/simulation/Utils.js.map +1 -0
- package/dist/lib/simulation/binding-utils/arcPlaceInfoLogic.js +157 -0
- package/dist/lib/simulation/binding-utils/arcPlaceInfoLogic.js.map +1 -0
- package/dist/lib/simulation/binding-utils/bindingUtils.js +64 -0
- package/dist/lib/simulation/binding-utils/bindingUtils.js.map +1 -0
- package/dist/lib/simulation/binding-utils/earlyReturnLogic.js +107 -0
- package/dist/lib/simulation/binding-utils/earlyReturnLogic.js.map +1 -0
- package/dist/lib/simulation/binding-utils/exactSynchro.js +102 -0
- package/dist/lib/simulation/binding-utils/exactSynchro.js.map +1 -0
- package/dist/lib/simulation/binding-utils/helpers.js +141 -0
- package/dist/lib/simulation/binding-utils/helpers.js.map +1 -0
- package/dist/lib/simulation/binding-utils/inhibitorLogic.js +166 -0
- package/dist/lib/simulation/binding-utils/inhibitorLogic.js.map +1 -0
- package/dist/lib/simulation/binding-utils/linkingLogic.js +384 -0
- package/dist/lib/simulation/binding-utils/linkingLogic.js.map +1 -0
- package/dist/lib/simulation/context-pads/ContextPads.js +141 -0
- package/dist/lib/simulation/context-pads/ContextPads.js.map +1 -0
- package/dist/lib/simulation/context-pads/FireTransitionHandler.js +481 -0
- package/dist/lib/simulation/context-pads/FireTransitionHandler.js.map +1 -0
- package/dist/lib/simulation/context-pads/FireTransitionUtils.js +169 -0
- package/dist/lib/simulation/context-pads/FireTransitionUtils.js.map +1 -0
- package/dist/lib/simulation/context-pads/FormJsAdapter.js +99 -0
- package/dist/lib/simulation/context-pads/FormJsAdapter.js.map +1 -0
- package/dist/lib/simulation/context-pads/index.js +8 -0
- package/dist/lib/simulation/context-pads/index.js.map +1 -0
- package/dist/lib/simulation/palette/Palette.js +36 -0
- package/dist/lib/simulation/palette/Palette.js.map +1 -0
- package/dist/lib/simulation/palette/index.js +6 -0
- package/dist/lib/simulation/palette/index.js.map +1 -0
- package/dist/lib/simulation/reset-simulation/ResetSimulation.js +36 -0
- package/dist/lib/simulation/reset-simulation/ResetSimulation.js.map +1 -0
- package/dist/lib/simulation/reset-simulation/index.js +6 -0
- package/dist/lib/simulation/reset-simulation/index.js.map +1 -0
- package/dist/lib/simulation/simulation-history/SimulationHistory.js +158 -0
- package/dist/lib/simulation/simulation-history/SimulationHistory.js.map +1 -0
- package/dist/lib/simulation/simulation-history/index.js +6 -0
- package/dist/lib/simulation/simulation-history/index.js.map +1 -0
- package/dist/lib/simulation/simulator/Simulator.js +131 -0
- package/dist/lib/simulation/simulator/Simulator.js.map +1 -0
- package/dist/lib/simulation/simulator/index.js +6 -0
- package/dist/lib/simulation/simulator/index.js.map +1 -0
- package/dist/lib/simulation/toggle-simulation-mode/DisableModeling.js +85 -0
- package/dist/lib/simulation/toggle-simulation-mode/DisableModeling.js.map +1 -0
- package/dist/lib/simulation/toggle-simulation-mode/ToggleSimulationMode.js +65 -0
- package/dist/lib/simulation/toggle-simulation-mode/ToggleSimulationMode.js.map +1 -0
- package/dist/lib/simulation/toggle-simulation-mode/index.js +8 -0
- package/dist/lib/simulation/toggle-simulation-mode/index.js.map +1 -0
- package/dist/lib/util/EventBusEvents.js +70 -0
- package/dist/lib/util/EventBusEvents.js.map +1 -0
- package/dist/lib/util/FileUtil.js +35 -0
- package/dist/lib/util/FileUtil.js.map +1 -0
- package/dist/lib/util/HtmlUtil.js +67 -0
- package/dist/lib/util/HtmlUtil.js.map +1 -0
- package/dist/lib/util/Util.js +60 -0
- package/dist/lib/util/Util.js.map +1 -0
- package/dist/lib/util/constants.js +6 -0
- package/dist/lib/util/constants.js.map +1 -0
- package/dist/lib/util/emptyDiagram.js +12 -0
- package/dist/lib/util/emptyDiagram.js.map +1 -0
- package/dist/lib/util/generated-icons.js +12 -0
- package/dist/lib/util/generated-icons.js.map +1 -0
- package/dist/scripts/build-icons.js +30 -0
- package/dist/scripts/build-icons.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/index.js +1 -0
- package/package.json +83 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { is } from "../util/Util";
|
|
2
|
+
import { isArray } from "min-dash";
|
|
3
|
+
import { MODELER_PREFIX } from "../util/constants";
|
|
4
|
+
const variableArcReplaceOptions = [
|
|
5
|
+
{
|
|
6
|
+
label: "Replace with non-variable arc",
|
|
7
|
+
actionName: "replace-with-arc",
|
|
8
|
+
className: "bpmn-icon-connection",
|
|
9
|
+
target: {
|
|
10
|
+
type: `${MODELER_PREFIX}:Arc`,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
];
|
|
14
|
+
const arcReplaceOptions = [
|
|
15
|
+
{
|
|
16
|
+
label: "Replace with variable arc",
|
|
17
|
+
actionName: "replace-with-variable-arc",
|
|
18
|
+
className: "bpmn-icon-connection",
|
|
19
|
+
target: {
|
|
20
|
+
type: `${MODELER_PREFIX}:VariableArc`,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
export default class ReplaceMenuProvider {
|
|
25
|
+
constructor(customElementFactory, popupMenu, modeling, moddle, rules, translate, moddleCopy) {
|
|
26
|
+
this._customElementFactory = customElementFactory;
|
|
27
|
+
this._popupMenu = popupMenu;
|
|
28
|
+
this._modeling = modeling;
|
|
29
|
+
this._moddle = moddle;
|
|
30
|
+
this._rules = rules;
|
|
31
|
+
this._translate = translate;
|
|
32
|
+
this._moddleCopy = moddleCopy;
|
|
33
|
+
this._popupMenu.registerProvider("tpn-replace", this);
|
|
34
|
+
}
|
|
35
|
+
getPopupMenuEntries(target) {
|
|
36
|
+
const businessObject = target.businessObject;
|
|
37
|
+
if (isArray(target)) {
|
|
38
|
+
return {};
|
|
39
|
+
}
|
|
40
|
+
if (is(businessObject, `${MODELER_PREFIX}:Arc`)) {
|
|
41
|
+
return this._createArcEntries(target);
|
|
42
|
+
}
|
|
43
|
+
return {};
|
|
44
|
+
}
|
|
45
|
+
_createArcEntries(target) {
|
|
46
|
+
const entries = {};
|
|
47
|
+
const self = this;
|
|
48
|
+
if (target.businessObject.variableType) {
|
|
49
|
+
entries["replace-with-arc"] = self._createEntry(variableArcReplaceOptions[0], target, function () {
|
|
50
|
+
self._modeling.updateProperties(target, { variableType: undefined });
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
entries["replace-with-variable-arc"] = self._createEntry(arcReplaceOptions[0], target, function () {
|
|
55
|
+
self._modeling.updateProperties(target, {
|
|
56
|
+
variableType: "something",
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return entries;
|
|
61
|
+
}
|
|
62
|
+
_createEntry(replaceOption, target, action) {
|
|
63
|
+
const translate = this._translate;
|
|
64
|
+
let label = replaceOption.label;
|
|
65
|
+
if (label && typeof label === "function") {
|
|
66
|
+
label = label(target);
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
label: translate(label),
|
|
70
|
+
className: replaceOption.className,
|
|
71
|
+
action: action,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
ReplaceMenuProvider.$inject = [
|
|
76
|
+
"customElementFactory",
|
|
77
|
+
"popupMenu",
|
|
78
|
+
"modeling",
|
|
79
|
+
"moddle",
|
|
80
|
+
"rules",
|
|
81
|
+
"translate",
|
|
82
|
+
"moddleCopy",
|
|
83
|
+
];
|
|
84
|
+
//# sourceMappingURL=ReplaceMenuProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReplaceMenuProvider.js","sourceRoot":"","sources":["../../../lib/replace/ReplaceMenuPro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,CAAC;CACF;AAED,mBAAmB,CAAC,OAAO,GAAG;IAC5B,sBAAsB;IACtB,WAAW;IACX,UAAU;IACV,QAAQ;IACR,OAAO;IACP,WAAW;IACX,YAAY;CACb,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import PopupMenuModule from "diagram-js/lib/features/popup-menu";
|
|
2
|
+
import ReplaceMenuProvider from "./ReplaceMenuProvider";
|
|
3
|
+
import AutoPlaceModule from "../auto-place";
|
|
4
|
+
export default {
|
|
5
|
+
__depends__: [PopupMenuModule, AutoPlaceModule],
|
|
6
|
+
__init__: ["replaceMenuProvider"],
|
|
7
|
+
replaceMenuProvider: ["type", ReplaceMenuProvider],
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/replace/index.js"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,oCAAoC,CAAC;AAEjE,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,eAAe,MAAM,eAAe,CAAC;AAE5C,eAAe;IACb,WAAW,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC;IAC/C,QAAQ,EAAE,CAAC,qBAAqB,CAAC;IACjC,mBAAmB,EAAE,CAAC,MAAM,EAAE,mBAAmB,CAAC;CACnD,CAAC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import RuleProvider from "diagram-js/lib/features/rules/RuleProvider";
|
|
2
|
+
import { isLabel } from "../modeling/LabelUtil";
|
|
3
|
+
import { is } from "../util/Util";
|
|
4
|
+
import { MODELER_PREFIX } from "../util/constants";
|
|
5
|
+
export default class CustomRuleProvider extends RuleProvider {
|
|
6
|
+
constructor(eventBus, elementRegistry) {
|
|
7
|
+
super(eventBus);
|
|
8
|
+
this._elementRegistry = elementRegistry;
|
|
9
|
+
}
|
|
10
|
+
// CustomModelerTodo: Define the rules for your modeler. For example, you can define which elements can be connected to each other,
|
|
11
|
+
// which elements can be moved, resized, or created, and so on.
|
|
12
|
+
init() {
|
|
13
|
+
this.addRule("connection.create", function (context) {
|
|
14
|
+
const { source, target } = context;
|
|
15
|
+
return canConnect(source, target);
|
|
16
|
+
});
|
|
17
|
+
// CustomModelerTodo: Define which elements may be the source of a connection.
|
|
18
|
+
// Returns the type of connection to be used. May depend on the source element type.
|
|
19
|
+
this.addRule("connection.start", function (context) {
|
|
20
|
+
const source = context.source;
|
|
21
|
+
return (is(source, `${MODELER_PREFIX}:Node`) && {
|
|
22
|
+
type: `${MODELER_PREFIX}:Arc`,
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
this.addRule("connection.reconnect", function (context) {
|
|
26
|
+
const { source, target } = context;
|
|
27
|
+
return canConnect(source, target);
|
|
28
|
+
});
|
|
29
|
+
this.addRule("connection.updateWaypoints", function (context) {
|
|
30
|
+
return {
|
|
31
|
+
type: context.connection.type,
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
// Shapes should not be placed (created/moved) on top of each other.
|
|
35
|
+
// Look at https://github.com/bpmn-io/bpmn-js/blob/c3ab26b1ab8e33f238cec6c9704f875e4ddc1a1a/lib/features/rules/BpmnRules.js#L160 for reference
|
|
36
|
+
// if your modeler should support overlapping/hierarchical shapes.
|
|
37
|
+
// Note: Currently, the target is defined as the shape at the cursor position.
|
|
38
|
+
// Hence, overlaps are still possible since we do not consider the bounds of the moved shape.
|
|
39
|
+
this.addRule("shape.create", function (context) {
|
|
40
|
+
const { shape, target } = context;
|
|
41
|
+
return canCreate(shape, target);
|
|
42
|
+
});
|
|
43
|
+
this.addRule("elements.create", function (context) {
|
|
44
|
+
const { target, elements } = context;
|
|
45
|
+
return elements.every(function (shape) {
|
|
46
|
+
return canCreate(shape, target);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
this.addRule("elements.move", function (context) {
|
|
50
|
+
// Note: Since it's only about the position, the objects are called "shapes" instead of "elements" in the context object.
|
|
51
|
+
const { target, shapes } = context;
|
|
52
|
+
return canMove(shapes, target);
|
|
53
|
+
});
|
|
54
|
+
// CustomModelerTodo: Define which elements may be resized.
|
|
55
|
+
this.addRule("shape.resize", function (context) {
|
|
56
|
+
if (context.shape.type === `${MODELER_PREFIX}:Transition`) {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
return false;
|
|
60
|
+
});
|
|
61
|
+
this.addRule("element.copy", function (context) {
|
|
62
|
+
return true;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
canConnect(source, target) {
|
|
66
|
+
return canConnect(source, target);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
CustomRuleProvider.$inject = ["eventBus", "elementRegistry"];
|
|
70
|
+
// CustomModelerTodo: Define logic to regulate which elements can be connected.
|
|
71
|
+
// Must return the type of the connection to be created.
|
|
72
|
+
function canConnect(source, target) {
|
|
73
|
+
return (((source.type === `${MODELER_PREFIX}:Place` &&
|
|
74
|
+
target.type === `${MODELER_PREFIX}:Transition`) ||
|
|
75
|
+
(source.type === `${MODELER_PREFIX}:Transition` &&
|
|
76
|
+
target.type === `${MODELER_PREFIX}:Place`)) && {
|
|
77
|
+
type: `${MODELER_PREFIX}:Arc`,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function canMove(shapes, target) {
|
|
81
|
+
// allow default move check to start move operation
|
|
82
|
+
if (!target) {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
// check if shapes can be dropped on target location
|
|
86
|
+
return shapes.every(function (shape) {
|
|
87
|
+
return canDrop(shape, target);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function canCreate(shape, target) {
|
|
91
|
+
if (!target) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
return canDrop(shape, target);
|
|
95
|
+
}
|
|
96
|
+
function canDrop(shape, target) {
|
|
97
|
+
// labels can be moved everywhere
|
|
98
|
+
if (isLabel(shape)) {
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
// ModelElements (i.e., places, transitions, and arcs) cannot be dropped on other ModelElements
|
|
102
|
+
if (is(shape, `${MODELER_PREFIX}:ModelElement`)) {
|
|
103
|
+
return !is(target, `${MODELER_PREFIX}:ModelElement`);
|
|
104
|
+
}
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=CustomRuleProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomRuleProvider.js","sourceRoot":"","sources":["../../../lib/rules/CustomRuleProvider.js"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,4CAA4C,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,YAAY;IAC1D,YAAY,QAAQ,EAAE,eAAe;QACnC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChB,IAAI,CAAC,gBAAgB,GAAG,eAAe,CAAC;IAC1C,CAAC;IAED,mIAAmI;IACnI,+DAA+D;IAC/D,IAAI;QACF,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,UAAU,OAAO;YACjD,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;YACnC,OAAO,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;QAEH,8EAA8E;QAC9E,oFAAoF;QACpF,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,UAAU,OAAO;YAChD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAC9B,OAAO,CACL,EAAE,CAAC,MAAM,EAAE,GAAG,cAAc,OAAO,CAAC,IAAI;gBACtC,IAAI,EAAE,GAAG,cAAc,MAAM;aAC9B,C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AAE,MAAM,CAAC,CAAC;AAChC,CAAC;AAED,SAAS,OAAO,CAAC,KAAK,EAAE,MAAM;IAC5B,iCAAiC;IACjC,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,+FAA+F;IAC/F,IAAI,EAAE,CAAC,KAAK,EAAE,GAAG,cAAc,eAAe,CAAC,EAAE,CAAC;QAChD,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,cAAc,eAAe,CAAC,CAAC;IACvD,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import RulesModule from "diagram-js/lib/features/rules";
|
|
2
|
+
import CustomRuleProvider from "./CustomRuleProvider";
|
|
3
|
+
export default {
|
|
4
|
+
__depends__: [RulesModule],
|
|
5
|
+
__init__: ["customRuleProvider"],
|
|
6
|
+
customRuleProvider: ["type", CustomRuleProvider],
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/rules/index.js"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,+BAA+B,CAAC;AAExD,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAEtD,eAAe;IACb,WAAW,EAAE,CAAC,WAAW,CAAC;IAC1B,QAAQ,EAAE,CAAC,oBAAoB,CAAC;IAChC,kBAAkB,EAAE,CAAC,MAAM,EAAE,kBAAkB,CAAC;CACjD,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const TOGGLE_MODE_EVENT = "tokenSimulation.toggleMode";
|
|
2
|
+
const FIRE_TRANSITION_EVENT = "tokenSimulation.fire";
|
|
3
|
+
const RESET_SIMULATION_EVENT = "tokenSimulation.reset";
|
|
4
|
+
const TRANSITION_FIRED_EVENT = "tokenSimulation.firedTransition";
|
|
5
|
+
export { TOGGLE_MODE_EVENT, FIRE_TRANSITION_EVENT, RESET_SIMULATION_EVENT, TRANSITION_FIRED_EVENT, };
|
|
6
|
+
//# sourceMappingURL=EventHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventHelper.js","sourceRoot":"","sources":["../../../lib/simulation/EventHelper.js"],"names":[],"mappings":"AAAA,MAAM,iBAAiB,GAAG,4BAA4B,CAAC;AACvD,MAAM,qBAAqB,GAAG,sBAAsB,CAAC;AACrD,MAAM,sBAAsB,GAAG,uBAAuB,CAAC;AACvD,MAAM,sBAAsB,GAAG,iCAAiC,CAAC;AAEjE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,GACvB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { getValidInputBindings } from "./binding-utils/bindingUtils";
|
|
2
|
+
// TODO: change all imports to bindingUtilsNew
|
|
3
|
+
import { transitionIsEnabled } from "./binding-utils/bindingUtils";
|
|
4
|
+
export { getValidInputBindings, transitionIsEnabled };
|
|
5
|
+
export function getChildById(element, id) {
|
|
6
|
+
return element.children.find((child) => child.id === id);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=Utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../lib/simulation/Utils.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,8CAA8C;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,CAAC;AAEtD,MAAM,UAAU,YAAY,CAAC,OAAO,EAAE,EAAE;IACtC,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { createDataClassCombinationKeyFromDict, getDataClassFromKey, getDataClassKey, tokensEqual, } from "./helpers";
|
|
2
|
+
/**
|
|
3
|
+
* Builds a dictionary mapping arc IDs to their corresponding `ArcPlaceInfo` objects.
|
|
4
|
+
* For each incoming arc, generates its `ArcPlaceInfo` and checks for existing data class combinations.
|
|
5
|
+
* If a combination is new, adds the arc and its info to the dictionary.
|
|
6
|
+
* If a combination already exists, merges tokens into the existing `ArcPlaceInfo` and updates its data class info.
|
|
7
|
+
*
|
|
8
|
+
* @param incomingArcs - An array of `Arc` objects to process.
|
|
9
|
+
* @returns A tuple `[ArcPlaceInfoDict, ArcPlaceInfoDict]` where the first dictionary contains merged arc info for all relevant arcs, and the second dictionary contains arc info for exact-syncing arcs only.
|
|
10
|
+
*/
|
|
11
|
+
export function buildArcPlaceInfoDict(incomingArcs) {
|
|
12
|
+
const arcPlaceInfoDict = {};
|
|
13
|
+
const exactSynchingArcPlaceInfoDict = {};
|
|
14
|
+
const existingDataClassCombinations = {};
|
|
15
|
+
for (const arc of incomingArcs) {
|
|
16
|
+
const arcPlaceInfo = buildArcPlaceInfo(arc);
|
|
17
|
+
// Never merge inhibitor arcs
|
|
18
|
+
if (arcPlaceInfo.isInhibitorArc) {
|
|
19
|
+
arcPlaceInfoDict[arc.id] = arcPlaceInfo;
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
// For exact synchro arcs, also keep track of them in a separate dictionary for later use in checking ExactSubsetSynchro constraints
|
|
23
|
+
if (arcPlaceInfo.isExactSyncing) {
|
|
24
|
+
exactSynchingArcPlaceInfoDict[arc.id] = Object.assign({}, arcPlaceInfo);
|
|
25
|
+
}
|
|
26
|
+
const dataClassCombination = createDataClassCombinationKeyFromDict(arcPlaceInfo.dataClassInfoDict);
|
|
27
|
+
if (!existingDataClassCombinations[dataClassCombination]) {
|
|
28
|
+
existingDataClassCombinations[dataClassCombination] = arc.id;
|
|
29
|
+
arcPlaceInfoDict[arc.id] = arcPlaceInfo;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
// Merge tokens into existing ArcPlaceInfo
|
|
33
|
+
const existingArcId = existingDataClassCombinations[dataClassCombination];
|
|
34
|
+
arcPlaceInfoDict[existingArcId].tokens = arcPlaceInfoDict[existingArcId].tokens.filter((token) => arcPlaceInfo.tokens.some((existingToken) => tokensEqual(token, existingToken)));
|
|
35
|
+
arcPlaceInfoDict[existingArcId].dataClassInfoDict =
|
|
36
|
+
buildDataClassInfoDict(arcPlaceInfoDict[existingArcId].tokens);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return [arcPlaceInfoDict, exactSynchingArcPlaceInfoDict];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Builds a dictionary mapping data class IDs to their corresponding `DataClassInfo` objects,
|
|
43
|
+
* aggregating token values from the provided array of tokens. If an existing dictionary is supplied,
|
|
44
|
+
* its `isVariable` and `alias` properties are preserved for matching data class IDs.
|
|
45
|
+
*
|
|
46
|
+
* Each token is expected to contain key-value pairs, where keys represent data class identifiers.
|
|
47
|
+
* The function uses `getDataClassFromKey` to resolve the data class from each key.
|
|
48
|
+
* For each data class, unique token values are collected into the `tokenValues` array.
|
|
49
|
+
*
|
|
50
|
+
* @param tokens - An array of `Token` objects containing key-value pairs for data classes.
|
|
51
|
+
* @param existingDataClassInfoDict - An optional dictionary of existing `DataClassInfo` objects,
|
|
52
|
+
* used to preserve `isVariable` and `alias` properties for data classes already present.
|
|
53
|
+
* @returns A dictionary mapping data class IDs to their aggregated `DataClassInfo` objects.
|
|
54
|
+
*/
|
|
55
|
+
function buildDataClassInfoDict(tokens) {
|
|
56
|
+
const dataClassInfoDict = {};
|
|
57
|
+
for (const token of tokens) {
|
|
58
|
+
for (const [dataClassKey, value] of Object.entries(token)) {
|
|
59
|
+
if (!dataClassInfoDict[dataClassKey]) {
|
|
60
|
+
dataClassInfoDict[dataClassKey] = [];
|
|
61
|
+
}
|
|
62
|
+
if (!dataClassInfoDict[dataClassKey].includes(value)) {
|
|
63
|
+
dataClassInfoDict[dataClassKey].push(value);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return dataClassInfoDict;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Builds an `ArcPlaceInfo` object containing detailed information about the relationship
|
|
71
|
+
* between an arc and its associated place, including marking tokens, data class info,
|
|
72
|
+
* variable class, and arc properties.
|
|
73
|
+
*
|
|
74
|
+
* @param arc - The arc object for which to build place information.
|
|
75
|
+
* @returns An `ArcPlaceInfo` object with the following properties:
|
|
76
|
+
* - `arcId`: The unique identifier of the arc.
|
|
77
|
+
* - `placeId`: The unique identifier of the associated place.
|
|
78
|
+
* - `tokens`: An array of custom token objects representing the marking of the place.
|
|
79
|
+
* - `isInhibitorArc`: Indicates if the arc is an inhibitor arc.
|
|
80
|
+
* - `isLinkingPlace`: Indicates if the place links multiple data classes.
|
|
81
|
+
* - `variableClass`: The data class used as a variable in the arc inscription, if any.
|
|
82
|
+
* - `dataClassInfoDict`: A dictionary mapping data class IDs to their info, including
|
|
83
|
+
* variable status, alias, and token values.
|
|
84
|
+
*
|
|
85
|
+
* The function processes the marking tokens of the place, extracts data class information,
|
|
86
|
+
* determines variable classes from arc inscriptions, and constructs a custom marking
|
|
87
|
+
* representation for further simulation or analysis.
|
|
88
|
+
*/
|
|
89
|
+
function buildArcPlaceInfo(arc) {
|
|
90
|
+
var _a, _b, _c, _d;
|
|
91
|
+
const arcObject = arc.businessObject;
|
|
92
|
+
const place = arcObject.source;
|
|
93
|
+
const isInhibitorArc = (arcObject === null || arcObject === void 0 ? void 0 : arcObject.isInhibitorArc) || false;
|
|
94
|
+
const isExactSyncing = (arcObject === null || arcObject === void 0 ? void 0 : arcObject.isExactSynchronization) || false;
|
|
95
|
+
const dataClassInfoDict = {};
|
|
96
|
+
let variableClass = arc.businessObject.variableType;
|
|
97
|
+
const inscriptionElements = (_b = (_a = arc.businessObject.inscription) === null || _a === void 0 ? void 0 : _a.inscriptionElements) !== null && _b !== void 0 ? _b : [];
|
|
98
|
+
for (const element of inscriptionElements) {
|
|
99
|
+
const dataClass = element.dataClass;
|
|
100
|
+
const variableName = element.variableName;
|
|
101
|
+
if ((dataClass === null || dataClass === void 0 ? void 0 : dataClass.id) && variableName) {
|
|
102
|
+
const isVariable = variableClass === dataClass;
|
|
103
|
+
dataClassInfoDict[getDataClassKey(dataClass.id, variableName, isVariable)] = [];
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
const marking = (_c = place.marking) !== null && _c !== void 0 ? _c : [];
|
|
107
|
+
const customMarking = [];
|
|
108
|
+
for (const token of marking) {
|
|
109
|
+
const tokenObj = {};
|
|
110
|
+
const tokenValues = (_d = token.values) !== null && _d !== void 0 ? _d : [];
|
|
111
|
+
for (const { dataClass, value } of tokenValues) {
|
|
112
|
+
Object.keys(dataClassInfoDict)
|
|
113
|
+
.filter((dataClassKey) => getDataClassFromKey(dataClassKey).id === dataClass.id)
|
|
114
|
+
.forEach((dataClassKey) => {
|
|
115
|
+
tokenObj[dataClassKey] = value;
|
|
116
|
+
if (!dataClassInfoDict[dataClassKey].includes(value)) {
|
|
117
|
+
dataClassInfoDict[dataClassKey].push(value);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
customMarking.push(tokenObj);
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
arcId: arc.id,
|
|
125
|
+
placeId: place.id,
|
|
126
|
+
tokens: customMarking,
|
|
127
|
+
isInhibitorArc: isInhibitorArc,
|
|
128
|
+
isLinkingPlace: Object.keys(dataClassInfoDict).length > 1,
|
|
129
|
+
isExactSyncing: isExactSyncing,
|
|
130
|
+
variableClass: variableClass,
|
|
131
|
+
dataClassInfoDict: dataClassInfoDict,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Extracts and aggregates token values for each data class from non-linking arcs in the provided arc-place information dictionary.
|
|
136
|
+
*
|
|
137
|
+
* Iterates through all entries in the `arcPlaceInfoDict`, skipping those marked as linking places.
|
|
138
|
+
* For each non-linking place, it collects token values for each data class, identified by a unique key
|
|
139
|
+
* generated from the data class ID, alias, and variable status. Token values are accumulated per data class.
|
|
140
|
+
*
|
|
141
|
+
* @param arcPlaceInfoDict - A dictionary mapping arc-place identifiers to their corresponding information objects.
|
|
142
|
+
* @returns An object mapping each unique data class key to an array of token values aggregated from non-linking arcs.
|
|
143
|
+
*/
|
|
144
|
+
export function getBindingPerDataClassFromNonLinkingArcs(arcPlaceInfoDict) {
|
|
145
|
+
const bindingCandidatesPerDataClass = {};
|
|
146
|
+
for (const arcPlaceInfo of Object.values(arcPlaceInfoDict)) {
|
|
147
|
+
if (arcPlaceInfo.isLinkingPlace || arcPlaceInfo.isInhibitorArc)
|
|
148
|
+
continue;
|
|
149
|
+
for (const [dataClassKey, tokenValues] of Object.entries(arcPlaceInfo.dataClassInfoDict)) {
|
|
150
|
+
bindingCandidatesPerDataClass[dataClassKey]
|
|
151
|
+
? bindingCandidatesPerDataClass[dataClassKey].push(...tokenValues)
|
|
152
|
+
: (bindingCandidatesPerDataClass[dataClassKey] = [...tokenValues]);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return bindingCandidatesPerDataClass;
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=arcPlaceInfoLogic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arcPlaceInfoLogic.js","sourceRoot":"","sources":["../../../../lib/simulation/binding-utils/arcPlaceInfoLogic.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qCAAqC,EACrC,mBAAmB,EACnB,eAAe,EACf,WAAW,GACZ,MAAM,WAAW,CAAC;AAEnB;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CACnC,YAAmB;IAEnB,MAAM,gBAAgB,GAAqB,EAAE,CAAC;IAC9C,M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,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO;QACL,KAAK,EAAE,GAAG,CAAC,EAAE;QACb,OAAO,EAAE,KAAK,CAAC,EAAE;QACjB,MAAM,EAAE,aAAa;QACrB,cAAc,EAAE,cAAc;QAC9B,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,MAAM,GAAG,CAAC;QACzD,cAAc,EAAE,cAAc;QAC9B,aAAa,EAAE,aAAa;QAC5B,iBAAiB,EAAE,iBAAiB;KACrC,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,wCAAwC,CACtD,gBAAkC;IAElC,MAAM,6BAA6B,GAAwB,EAAE,CAAC;IAC9D,KAAK,MAAM,YAAY,IAAI,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAC3D,IAAI,YAAY,CAAC,cAAc,IAAI,YAAY,CAAC,cAAc;YAAE,SAAS;QAEzE,KAAK,MAAM,CAAC,YAAY,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CACtD,YAAY,CAAC,iBAAiB,CAC/B,EAAE,CAAC;YACF,6BAA6B,CAAC,YAAY,CAAC;gBACzC,CAAC,CAAC,6BAA6B,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC;gBAClE,CAAC,CAAC,CAAC,6BAA6B,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;IACD,OAAO,6BAA6B,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { buildArcPlaceInfoDict, getBindingPerDataClassFromNonLinkingArcs, } from "./arcPlaceInfoLogic";
|
|
2
|
+
import { hasAvailableTokensForAllArcs, isStructurallyIncorrect, } from "./earlyReturnLogic";
|
|
3
|
+
import { checkExactSynchroConstraints } from "./exactSynchro";
|
|
4
|
+
import { getNonInhibitorArcs, filterBindingsByInhibitors, } from "./inhibitorLogic";
|
|
5
|
+
import { cartesianProductBindings, getBiggestLinks, getBindingsForLink, getDataClassesNotInLinks, getTokenPerLink, } from "./linkingLogic";
|
|
6
|
+
export function getValidInputBindings(transition) {
|
|
7
|
+
// Early return: structural incorrect
|
|
8
|
+
if (isStructurallyIncorrect(transition.incoming, transition.outgoing)[0]) {
|
|
9
|
+
// console.log(`Transition ${transition.id} has unbound output variables.`);
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
// Step 1: build arcPlaceInfoDict and tokenStructure
|
|
13
|
+
const [arcPlaceInfoDict, exactSynchingArcPlaceInfoDict] = buildArcPlaceInfoDict(transition.incoming);
|
|
14
|
+
// Early return: missing tokens in non-inhibitor arcs
|
|
15
|
+
if (!hasAvailableTokensForAllArcs(arcPlaceInfoDict)) {
|
|
16
|
+
// console.log(`Transition ${transition.id} has missing tokens in non-inhibitor arcs.`);
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
// Step 2: get biggest exclusive links, link tokens per place, placeId per dataClass alias
|
|
20
|
+
const nonInhibitorArcs = getNonInhibitorArcs(arcPlaceInfoDict);
|
|
21
|
+
const [biggestLinks, allLinks] = getBiggestLinks(nonInhibitorArcs);
|
|
22
|
+
const tokenPerLink = getTokenPerLink(nonInhibitorArcs);
|
|
23
|
+
// Step 3: compute bindings
|
|
24
|
+
const bindingPerDataClassFromNonLinkingArcs = getBindingPerDataClassFromNonLinkingArcs(nonInhibitorArcs);
|
|
25
|
+
let validInputBindings;
|
|
26
|
+
if (biggestLinks.length == 0) {
|
|
27
|
+
// Step 3.1: no links exist, return only bindings from non-linking arcs
|
|
28
|
+
// if there are no incoming arcs, return empty binding
|
|
29
|
+
validInputBindings = [bindingPerDataClassFromNonLinkingArcs];
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
// Step 3.2: links exist, return only bindings that satisfy the links
|
|
33
|
+
const bindingCandidatesPerLink = [];
|
|
34
|
+
for (const link of biggestLinks) {
|
|
35
|
+
// each bindingCandidatesPerLink is a BindingPerDataClass for one link
|
|
36
|
+
// and only contains bindings for data classes used in that link
|
|
37
|
+
const bindingCandidate = getBindingsForLink(link, allLinks, tokenPerLink, bindingPerDataClassFromNonLinkingArcs);
|
|
38
|
+
bindingCandidatesPerLink.push(bindingCandidate);
|
|
39
|
+
}
|
|
40
|
+
// lastly, push all token of arcs which data classes are not used in any link
|
|
41
|
+
const dataClassesNotInLinks = getDataClassesNotInLinks(bindingPerDataClassFromNonLinkingArcs, biggestLinks);
|
|
42
|
+
if (dataClassesNotInLinks.size > 0) {
|
|
43
|
+
const bindingForNonLinkingDataClasses = {};
|
|
44
|
+
dataClassesNotInLinks.forEach((dataClassKey) => {
|
|
45
|
+
bindingForNonLinkingDataClasses[dataClassKey] =
|
|
46
|
+
bindingPerDataClassFromNonLinkingArcs[dataClassKey];
|
|
47
|
+
});
|
|
48
|
+
bindingCandidatesPerLink.push([bindingForNonLinkingDataClasses]);
|
|
49
|
+
}
|
|
50
|
+
// Create Cartesian product of all bindingCandidatesPerLink
|
|
51
|
+
validInputBindings = cartesianProductBindings(bindingCandidatesPerLink);
|
|
52
|
+
}
|
|
53
|
+
// Step 4: eliminate bindings blocked by inhibitors
|
|
54
|
+
const filteredInputBindings = filterBindingsByInhibitors(validInputBindings, arcPlaceInfoDict);
|
|
55
|
+
// Step 5: check for ExactSubsetSynchro constraint
|
|
56
|
+
// This also always enlarges the dataClassKeys to four components
|
|
57
|
+
const synchedInputBindings = checkExactSynchroConstraints(exactSynchingArcPlaceInfoDict, filteredInputBindings);
|
|
58
|
+
return synchedInputBindings;
|
|
59
|
+
}
|
|
60
|
+
export function transitionIsEnabled(transition) {
|
|
61
|
+
const bindings = getValidInputBindings(transition);
|
|
62
|
+
return !!bindings.length;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=bindingUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bindingUtils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AU,CAAC,CAAC;IACnD,OAAO,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { getDataClassKey } from "./helpers";
|
|
2
|
+
/**
|
|
3
|
+
* Checks whether the structure of the provided arcs is incorrect according to several criteria:
|
|
4
|
+
* - Filters out inhibitor arcs from both incoming and outgoing arcs.
|
|
5
|
+
* - Detects arcs without associated data classes.
|
|
6
|
+
* - Identifies duplicate sources and targets among the arcs.
|
|
7
|
+
* - Determines if there are unbound output data class keys (i.e., output keys not present in input keys).
|
|
8
|
+
*
|
|
9
|
+
* @param incomingArcs - The list of incoming arcs to check, excluding inhibitor arcs.
|
|
10
|
+
* @param outgoingArcs - The list of outgoing arcs to check, excluding inhibitor arcs.
|
|
11
|
+
* @returns A tuple where the first element is a boolean indicating structural incorrectness,
|
|
12
|
+
* and the second element is a message describing the reason(s) for incorrectness.
|
|
13
|
+
*/
|
|
14
|
+
export function isStructurallyIncorrect(incomingArcs, outgoingArcs) {
|
|
15
|
+
incomingArcs = incomingArcs.filter((arc) => !arc.businessObject.isInhibitorArc);
|
|
16
|
+
outgoingArcs = outgoingArcs.filter((arc) => !arc.businessObject.isInhibitorArc);
|
|
17
|
+
const sources = [];
|
|
18
|
+
const targets = [];
|
|
19
|
+
let hasArcsWithoutDataClass = false;
|
|
20
|
+
function getDataClassKeysFromArcs(arcs, isOutgoing) {
|
|
21
|
+
var _a;
|
|
22
|
+
const dataClassKeys = new Set();
|
|
23
|
+
for (const arc of arcs) {
|
|
24
|
+
const arcObject = arc.businessObject;
|
|
25
|
+
isOutgoing
|
|
26
|
+
? targets.push({
|
|
27
|
+
id: arcObject.target.id,
|
|
28
|
+
name: arcObject.target.name || "",
|
|
29
|
+
})
|
|
30
|
+
: sources.push({
|
|
31
|
+
id: arcObject.source.id,
|
|
32
|
+
name: arcObject.source.name || "",
|
|
33
|
+
});
|
|
34
|
+
const inscriptionElements = ((_a = arcObject.inscription) === null || _a === void 0 ? void 0 : _a.inscriptionElements) || [];
|
|
35
|
+
const variableType = arcObject.variableType || { id: "", alias: "" };
|
|
36
|
+
if (inscriptionElements.length === 0) {
|
|
37
|
+
hasArcsWithoutDataClass = true;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
for (const el of inscriptionElements) {
|
|
41
|
+
if (el.isGenerated) {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
dataClassKeys.add(getDataClassKey(el.dataClass.id, el.variableName || el.dataClass.alias, el.dataClass.id === variableType.id &&
|
|
45
|
+
el.dataClass.alias === variableType.alias));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return dataClassKeys;
|
|
49
|
+
}
|
|
50
|
+
const inputDataClassKeys = getDataClassKeysFromArcs(incomingArcs, false);
|
|
51
|
+
const outputDataClassKeys = getDataClassKeysFromArcs(outgoingArcs, true);
|
|
52
|
+
const duplicateTargets = targets.filter((target, index) => targets.findIndex((t) => t.id === target.id) !== index);
|
|
53
|
+
const duplicateSources = sources.filter((source, index) => sources.findIndex((s) => s.id === source.id) !== index);
|
|
54
|
+
const unboundOutputDataClassKeys = Array.from(outputDataClassKeys).filter((key) => !inputDataClassKeys.has(key));
|
|
55
|
+
const hasUnboundByDataClassKey = unboundOutputDataClassKeys.length > 0;
|
|
56
|
+
const isStructurallyIncorrect = hasArcsWithoutDataClass ||
|
|
57
|
+
duplicateTargets.length > 0 ||
|
|
58
|
+
duplicateSources.length > 0 ||
|
|
59
|
+
hasUnboundByDataClassKey;
|
|
60
|
+
const message = isStructurallyIncorrect
|
|
61
|
+
? createStructuralIncorrectnessMessage(hasArcsWithoutDataClass, duplicateSources, duplicateTargets, unboundOutputDataClassKeys)
|
|
62
|
+
: "This transition is structurally correct.";
|
|
63
|
+
return [isStructurallyIncorrect, message];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Determines whether all arcs in the provided dictionary have available tokens.
|
|
67
|
+
*
|
|
68
|
+
* For each entry in the `arcPlaceInfoDict`, this function checks if either:
|
|
69
|
+
* - The arc is an inhibitor arc (`isInhibitorArc` is `true`), or
|
|
70
|
+
* - The arc has at least one token (`tokens.length > 0`).
|
|
71
|
+
*
|
|
72
|
+
* @param arcPlaceInfoDict - A dictionary mapping arc identifiers to their corresponding place information.
|
|
73
|
+
* @returns `true` if every arc is either an inhibitor arc or has at least one token; otherwise, `false`.
|
|
74
|
+
*/
|
|
75
|
+
export function hasAvailableTokensForAllArcs(arcPlaceInfoDict) {
|
|
76
|
+
return Object.values(arcPlaceInfoDict).every((arcPlaceInfo) => arcPlaceInfo.isInhibitorArc || arcPlaceInfo.tokens.length > 0);
|
|
77
|
+
}
|
|
78
|
+
function createStructuralIncorrectnessMessage(hasArcsWithoutDataClass, duplicateSources, duplicateTargets, unboundOutputDataClassKeys) {
|
|
79
|
+
let errorMessage = "This transition can structurally never be fired!";
|
|
80
|
+
if (hasArcsWithoutDataClass) {
|
|
81
|
+
errorMessage += "\n\nPlease add at least one data class to all places.";
|
|
82
|
+
}
|
|
83
|
+
if (duplicateSources.length > 0 || duplicateTargets.length > 0) {
|
|
84
|
+
errorMessage += `\n\nEach place should have at most one arc towards and from each transition.`;
|
|
85
|
+
}
|
|
86
|
+
if (duplicateSources.length > 0) {
|
|
87
|
+
errorMessage += `\nThere are multiple incoming arcs from each of: [${Array.from(new Set(duplicateSources.map((s) => (s.name.length > 0 ? s.name : s.id)))).join(", ")}].`;
|
|
88
|
+
}
|
|
89
|
+
if (duplicateTargets.length > 0) {
|
|
90
|
+
errorMessage += `\nThere are multiple outgoing arcs towards each of: [${Array.from(new Set(duplicateTargets.map((t) => (t.name.length > 0 ? t.name : t.id)))).join(", ")}].`;
|
|
91
|
+
}
|
|
92
|
+
if (unboundOutputDataClassKeys.length > 0) {
|
|
93
|
+
const varString = unboundOutputDataClassKeys
|
|
94
|
+
.map((v) => {
|
|
95
|
+
const parts = v.split(":");
|
|
96
|
+
let result = parts[1];
|
|
97
|
+
if (parts[2] === "true") {
|
|
98
|
+
result += "[]";
|
|
99
|
+
}
|
|
100
|
+
return result;
|
|
101
|
+
})
|
|
102
|
+
.join(", ");
|
|
103
|
+
errorMessage += `\n\nThere are unbound output variables: ${varString}.`;
|
|
104
|
+
}
|
|
105
|
+
return errorMessage;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=earlyReturnLogic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"earlyReturnLogic.js","sourceRoot":"","sources":["../../../../lib/simulation/binding-utils/earlyReturnLogic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,uBAAuB,CACrC,YAAmB,EACnB,YAAmB;IAEnB,YAAY,GAAG,YAAY,CAAC,MAAM,CAChC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,cAAc,CAC5C,CAAC;IACF,YAAY,GAAG,YAAY,CAAC,MAAM,CAChC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,cAAc,CAC5C,CAAC;IAEF,MAAM,OAAO,GAAmC,EAAE,CAAC;IACnD,MAAM,OAAO,GAAmC,EAAE,CAAC;IACnD,IAAI,uBAAuB,GAAG,KAAK,CAAC;IAEpC,SAAS,wBAAwB,CAC/B,IAAW,EACX,UAAmB;;QAEnB,MAAM,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;QACxC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,MAAM,SAAS,GAAG,GAAG,CAAC,cAAc,CAAC;YACrC,UAAU;gBACR,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;oBACX,EAAE,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE;oBACvB,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE;iBAClC,CAAC;gBACJ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