Skip to content

Commit

Permalink
show inhibitors in snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
stackdump committed Nov 21, 2023
1 parent da27953 commit a974698
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
5 changes: 3 additions & 2 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@ WIP
---

- [ ] add better tests for all net types (workflows, etc)
- [ ] build comparison of the statefulness of radio buttons... odly this would make good blog
- [ ] fix snapshot to work with inhibitor arcs


ICEBOX
------
- [ ] build comparison of the stateful-ness of radio buttons... oddly this would make good blog
- [ ] something wrong w/ src map in @pflow-dev/metamodel


DONE
----
- [x] build/test browser targ
- [x] build/test browser target
- [x] fix build scripts & publish to NPM
- [x] support SVG generation & output
- [x] support Stream of multiple models
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pflow-dev/metamodel",
"version": "0.3.3",
"version": "0.3.4",
"main": "/index.js",
"types": "/index.d.ts",
"description": "create workflows and petriNets with a DSL",
Expand Down
10 changes: 5 additions & 5 deletions snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,16 @@ export function snapshot(model: Model, options?: { hashChar?: HashChar }) {
});
let arcTags = "";
transitions.forEach((t) => {
for (const label in t.guards) {
const place = places.get(label);
const pts = getArcPoints({source: t, target: place});
t.guards.forEach((v, k) => {
const place = places.get(k);
const pts = getArcPoints({source: place, target: t});
arcTags += arcTemplate({
...pts,
stroke: "black",
markerEnd: `url(${hashChar}markerInhibit1)`,
weight: Math.abs(t.guards.get(label).delta[place.offset])
weight: Math.abs(v.delta[place.offset])
});
}
});
});
// TODO: support snapshot while running
transitions.forEach((t) => {
Expand Down
4 changes: 2 additions & 2 deletions test/snapshot.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {newModel, snapshot} from "../";
import {tictactoe} from "./examples";
import {inhibitTest} from "./examples";

it("should render a snapshot", () => {
const m = newModel({schema: "game", declaration: tictactoe});
const m = newModel({schema: "game", declaration: inhibitTest});
const svg = snapshot(m);
expect(svg.startsWith("<svg")).toBeTruthy();
expect(svg.endsWith("</svg>")).toBeTruthy();
Expand Down

0 comments on commit a974698

Please sign in to comment.