libpetri 2.10.2 → 2.10.4
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/dist/index.js +33 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1130,6 +1130,8 @@ function mergeTransitions(caller, instance, mergedName) {
|
|
|
1130
1130
|
const mergedTiming = mergeTimings(caller.timing, instance.timing, mergedName);
|
|
1131
1131
|
const mergedPriority = pickPriority(caller.priority, instance.priority);
|
|
1132
1132
|
const mergedAction = composeActions(caller.action, instance.action);
|
|
1133
|
+
const mergedMatch = mergeMatchSpecs(caller.matchSpec, instance.matchSpec, mergedName);
|
|
1134
|
+
const mergedAlias = mergePlaceAlias(caller.placeAlias, instance.placeAlias, mergedName);
|
|
1133
1135
|
const builder = Transition.builder(mergedName).timing(mergedTiming).priority(mergedPriority);
|
|
1134
1136
|
if (mergedAction !== void 0) {
|
|
1135
1137
|
builder.action(mergedAction);
|
|
@@ -1155,8 +1157,36 @@ function mergeTransitions(caller, instance, mergedName) {
|
|
|
1155
1157
|
for (const rs of unionArcs(caller.resets, instance.resets, keyOfReset)) {
|
|
1156
1158
|
builder.reset(rs.place);
|
|
1157
1159
|
}
|
|
1160
|
+
if (mergedMatch !== null) {
|
|
1161
|
+
builder.match(mergedMatch);
|
|
1162
|
+
}
|
|
1163
|
+
if (mergedAlias.size > 0) {
|
|
1164
|
+
builder.placeAlias(mergedAlias);
|
|
1165
|
+
}
|
|
1158
1166
|
return builder.build();
|
|
1159
1167
|
}
|
|
1168
|
+
function mergeMatchSpecs(caller, instance, channelName) {
|
|
1169
|
+
if (caller === null) return instance;
|
|
1170
|
+
if (instance === null) return caller;
|
|
1171
|
+
throw new Error(
|
|
1172
|
+
`Channel composition '${channelName}': both the caller-side and instance-side transition carry a \u03BD-net match \u2014 refusing to fuse two independent correlations into one transition (NU-060). Resolve explicitly by keeping the match on a single side.`
|
|
1173
|
+
);
|
|
1174
|
+
}
|
|
1175
|
+
function mergePlaceAlias(caller, instance, channelName) {
|
|
1176
|
+
if (caller.size === 0) return instance;
|
|
1177
|
+
if (instance.size === 0) return caller;
|
|
1178
|
+
const merged = new Map(caller);
|
|
1179
|
+
for (const [declared, actual] of instance) {
|
|
1180
|
+
const existing = merged.get(declared);
|
|
1181
|
+
if (existing !== void 0 && existing.name !== actual.name) {
|
|
1182
|
+
throw new Error(
|
|
1183
|
+
`Channel composition '${channelName}': conflicting declared\u2192actual place alias for declared place '${declared}' \u2014 caller-side maps to '${existing.name}', instance-side to '${actual.name}' (MOD-031). Resolve explicitly.`
|
|
1184
|
+
);
|
|
1185
|
+
}
|
|
1186
|
+
merged.set(declared, actual);
|
|
1187
|
+
}
|
|
1188
|
+
return merged;
|
|
1189
|
+
}
|
|
1160
1190
|
function mergeTimings(caller, instance, channelName) {
|
|
1161
1191
|
if (caller.type === "immediate" && instance.type === "immediate") {
|
|
1162
1192
|
return { type: "immediate" };
|
|
@@ -2298,6 +2328,9 @@ function rebuildWithAction(t, action) {
|
|
|
2298
2328
|
for (const r of t.resets) {
|
|
2299
2329
|
builder.reset(r.place);
|
|
2300
2330
|
}
|
|
2331
|
+
if (t.matchSpec !== null) {
|
|
2332
|
+
builder.match(t.matchSpec);
|
|
2333
|
+
}
|
|
2301
2334
|
return builder.build();
|
|
2302
2335
|
}
|
|
2303
2336
|
|