[Jastadd] NTAs + fullCopy()

From: Jesper Mattsson <jesper.mattsson_at_modelon.com>
Date: Thu, 23 Aug 2012 14:12:03 +0000

Hi

I'm having some problems with using fullCopy() on a node that has an NTA (a List). The problem is that the NTA is copied as well (with fullCopy()), but the _calculated flag is set to false (in clone()). Thus copying the NTA is wasted work, since it will be recalculated on next access anyway. Also, we would prefer it not being copied.

It might simply be that I have declared the NTA in the wrong way - how should they be declared with JastAdd 2? From reading the manual, I can see 3 possibilities, and the way we have done it in JModelica.org earlier isn't one of them. Each of these ways seems to have some problems (adding a list of X in examples below):

1. "/X*/" in .ast file + "syn nta List getXList()" in .jrag: both _completed and _value fields are added, *and* the NTA is added to children array

2. Nothing in .ast file + "syn nta List getXList()" in .jrag: _completed/_value are added, but other traversal methods are not added, e.g. getNumX()

3. "/X*/" in .ast file + "syn List getXList()" in .jrag: no fields are generated, NTA is recalculated at each access

4. "/X*/" in .ast file + "syn lazy List getXList()" in .jrag: same as 1, except that the value of the NTA is not saved unless the parent is final

What syntax for NTAs should we use?

Is it intended that the NTA values are copied by fullCopy()?

Jesper

Jesper MATTSSON, MSc
Software Developer & IT Administrator

Phone direct: +46 73 324 5909
Email: jesper.mattsson_at_modelon.com<mailto:jesper.mattsson_at_modelon.com>

[Description: Description: Description: Modelon_2011_Gradient_RGB_400]
________________________________
Modelon AB
Ideon Science Park
SE-223 70 Lund, Sweden

Phone: +46 46 286 2200
Fax: +46 46 286 2201


Web: http://www.modelon.com<http://www.modelon.com/>



This email and any attachments are intended solely for the use of the individual or entity to whom it is addressed and may be confidential and/or privileged. If you are not one of the named recipients or have received this email in error, (i) you should not read, disclose, or copy it, (ii) please notify sender of your receipt by reply email and delete this email and all attachments, (iii) Modelon does not accept or assume any liability or responsibility for any use of or reliance on this email.




image001.png
(image/png attachment: image001.png)

Received on Thu Aug 23 2012 - 16:12:48 CEST

This archive was generated by hypermail 2.3.0 : Wed Apr 16 2014 - 17:19:06 CEST