[Jastadd] Feature request: fullCopy() improvements

From: Jesper Mattsson <jesper.mattsson_at_modelon.com>
Date: Tue, 14 Feb 2012 06:26:07 -0800

Hi

I have two feature requests concerning fullCopy():

When a node is copied with fullCopy(), then the parent field is also copied. This means that some inherited attributes work on the copy even before it is placed in a new position in the tree (and some can give wrong values). However, this might not always be desired, and can also mask bugs. I suggest that the parent field is set to null in the copy.

All non-abstract node types override fullCopy(), and thus the following will compile clean:
A newA = getA().fullCopy();
However, for abstract node types it will need a cast, since the return value of fullCopy() will be the nearest non-abstract superclass.
I suggest that the following declaration is added to all abstract node types:
public abstract A fullCopy();
Where A is the name of the node type. This would mean that the return type of B.fullCopy() would be B for all node types B.

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>

[cid:image001.png_at_01CCEB2B.16144510]
________________________________
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/>






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

Received on Tue Feb 14 2012 - 15:26:38 CET

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