Node factories
If I have Concept with Child. Child has ordinal number. Concrete syntax is like this:
1.message 1
2.message 2
3.message 3
I want to implement in my language that ordinal number (step) is set automatically. It is not problem if I put new message at the end. I use node factories for this purpose, calculate the number of messages and increase for 1.
But, I have some problem if I put new message somewhere between 1 and 3 message.
node factories insertNewMessage
node concept: Messages
description : <none>
set-up : (sampleNode, newNode, model, enclosingNode)->void {
node<Step> ss = new node<Step>();
node<Message> aa;
aa = (node<Message>) newNode;
if (aa.isInstanceOf(Messages)) {
// increase step
...
newNode.step = ss;
} else {
}
//update all messages number
node<RootConcept> ms = (node<RootConcept>) enclosingNode;
ms.updateSteps();
}
Updates work when I insert next message.
How can I get information where I want to insert new message, what is the message before? or
how to update message steps.
1.message 1
2.message 2
3.message 3
I want to implement in my language that ordinal number (step) is set automatically. It is not problem if I put new message at the end. I use node factories for this purpose, calculate the number of messages and increase for 1.
But, I have some problem if I put new message somewhere between 1 and 3 message.
node factories insertNewMessage
node concept: Messages
description : <none>
set-up : (sampleNode, newNode, model, enclosingNode)->void {
node<Step> ss = new node<Step>();
node<Message> aa;
aa = (node<Message>) newNode;
if (aa.isInstanceOf(Messages)) {
// increase step
...
newNode.step = ss;
} else {
}
//update all messages number
node<RootConcept> ms = (node<RootConcept>) enclosingNode;
ms.updateSteps();
}
Updates work when I insert next message.
How can I get information where I want to insert new message, what is the message before? or
how to update message steps.
Please sign in to leave a comment.
Into the Concept Editor of Message add a new cell where you prefere, and select read only model access, then specify String.valueOf(node.index); into the Value function that you find into the Inspection editor.
node.index will give you the order number of a node in a collection.
Additionally, previous/next-sibling may help you touch the immediate neighbours of your node.
Vaclav