can define multiple properties. can see detailed view of chosen property.

This commit is contained in:
Joeri Exelmans 2025-11-06 16:25:48 +01:00
parent 1660b06064
commit c7e661eb61
31 changed files with 502 additions and 307 deletions

View file

@ -64,6 +64,8 @@ export type Statechart = {
uid2State: Map<string, ConcreteState|UnstableState>;
label2State: Map<string, ConcreteState>;
historyStates: HistoryState[];
}
@ -88,6 +90,7 @@ export const emptyStatechart: Statechart = {
internalEvents: [],
outputEvents: new Set(),
uid2State: new Map([["root", emptyRoot]]),
label2State: new Map([]),
historyStates: [],
};

View file

@ -5,7 +5,7 @@ import { Action, EventTrigger, Expression, ParsedText } from "./label_ast";
import { parse as parseLabel, SyntaxError } from "./label_parser";
import { Connections } from "./detect_connections";
import { HISTORY_RADIUS } from "../App/parameters";
import { ConcreteSyntax, VisualEditorState } from "@/App/VisualEditor/VisualEditor";
import { ConcreteSyntax } from "@/App/VisualEditor/VisualEditor";
import { memoize } from "@/util/util";
export type TraceableError = {
@ -52,6 +52,7 @@ export function parseStatechart(state: ConcreteSyntax, conns: Connections): [Sta
}
const uid2State = new Map<string, ConcreteState|UnstableState>([["root", root]]);
const label2State = new Map<string, ConcreteState>();
const historyStates: HistoryState[] = [];
// we will always look for the smallest parent rountangle
@ -329,6 +330,9 @@ export function parseStatechart(state: ConcreteSyntax, conns: Connections): [Sta
}
else if (parsed.kind === "comment") {
// just append comments to their respective states
if (!label2State.has(parsed.text)) {
label2State.set(parsed.text, belongsToState);
}
belongsToState.comments.push([text.uid, parsed.text]);
}
}
@ -384,6 +388,7 @@ export function parseStatechart(state: ConcreteSyntax, conns: Connections): [Sta
internalEvents,
outputEvents,
uid2State,
label2State,
historyStates,
}, errors];
}

View file

@ -194,12 +194,13 @@ export function coupledExecution<T extends {[name: string]: any}>(models: {[name
throw new Error("cannot make intTransition - timeAdvance is infinity");
},
extTransition: (simtime, c, e) => {
if (!Object.hasOwn(conns, e.name)) {
if (conns[e.name] === undefined) {
console.warn('input event', e.name, 'goes to nowhere');
return [[], c];
}
else {
const [model, eventName] = conns[e.name];
// console.log(conns);
if (model !== null) {
console.log('input event', e.name, 'goes to', `${model}.${eventName}`);
const inputEvent: InputEvent = {