Hi,
Thanks for your tollerance of the previous changes.
I have another suggestion. This one will require every Odejava program to be changed - but all you have to change is the package imports. The rest of the API will be unchanged.
Currently the currect way of creating a geom and adding it to a Space is:
Geom g = new GeomBox (…)
space.addGeom(g);
Which behind the scenes (in the Space method) calls g.addToSpace(this);
BUT - and the big but is that the g.addToSpace method is public. It must be public because it’s in a totally different package. This means that you can still do some nonsense code (note: a few changes I made a while back removed most of this ambiguous code but not all).
Geom g = new GeomBox (…)
space1.addGeom(g);
g.removeFromSpace();
space2.addGeom(g);
In this case - both space1 and space2 think they have the Geom when infact only one does.
If these classes were in the same package then the addToSpace method would be protected. Currently the only protection is in the javadoc comments (this is bad).
You may not think this is a big deal - but all those classes are strongly related to each other, and I believe more problems like this will surface.
In my opinion - Odejava the API should be mainly in the one Package to allow such data encapsulation that is needed.
Merging it is easy (and I’ve even already done this on my computer to test it). Upgrading code isn’t too hard either.
In conclusion - I am suggesting that all the related Odejava classes be merged. In other words - all classes from:
org.odejava.geom and
org.odejava.joint would be moved into
org.odejava.
If you want a comparison - the current setup would be a bit like having the Swing text boxes in a different package to the Swing labels.
Please give your feedback.
Cheers,
Will.