#1295 Start shape and handling of setting a unique start id per cluster level

This commit is contained in:
Knut Sveidqvist
2020-03-25 20:16:27 +01:00
parent c7aa67b07a
commit 159a3a3706
7 changed files with 129 additions and 372 deletions

View File

@@ -8,6 +8,28 @@ const setRootDoc = o => {
const getRootDoc = () => rootDoc;
const docTranslator = (parent, node, first) => {
if (node.stmt === 'relation') {
docTranslator(parent, node.state1, true);
docTranslator(parent, node.state2, false);
} else {
if (node.stmt === 'state') {
if (node.id === '[*]') {
node.id = first ? parent.id + '_start' : parent.id + '_end';
node.start = first;
}
}
if (node.doc) {
node.doc.forEach(docNode => docTranslator(node, docNode, true));
}
}
};
const getRootDocV2 = () => {
docTranslator({ id: 'root' }, rootDoc, true);
return rootDoc;
};
const extract = doc => {
// const res = { states: [], relations: [] };
clear();
@@ -175,5 +197,6 @@ export default {
logDocuments,
getRootDoc,
setRootDoc,
getRootDocV2,
extract
};