Behavior aspect problem

Hi,

I am seeing some unexpected behavior in Behavior aspect which is explained as follow:

Root Node concept: Constants
Constants children concept: Constant

Now in constant_behavior Constructor
info "" + this —-> constant
info "" + this.parent  —-> Null

this.parent gives null where it should print Constants
6 comments
The constructor is invoked before a node is inserted into the AST, so the parent will always be null in constructors.

Vaclav
0
Thanks for the quick reply.
So is there any way to access the parent node in the Constructor because i want to set a value based on its parent in constructor.
0
No, you cannot.
You may, however, use NodeFactories (in the Actions aspect), to customise already constructed nodes.

Vaclav
0
Problem is not fully solved yet.

If adding node by auto-completion menu then NodeFactories are useful to customise already constructed nodes
But if adding same node by using Intentions then NodeFactories not work and does not customise the intialised node.

Lokesh
0
It depends on how you add nodes through intentions.
If you use the "initialised" constructs, then the factory will get called.
E.g. new initialised node<>, add new initialised node<> or replace with new initialized node<>
you will need the j.m.lang.actions language to be used in your intentions

Vaclav
0

Please sign in to leave a comment.