What you post makes
alot of sense. I implemented compareTo as you suggested, and I even made a little
test like yours with my Node, and it passed with flying colors. However, (And I have the output to prove it!), in the context of my program, I have a TreeSet printing out the following list:
[
(-11,-17,0.0), (-12,-17,1.0), (-11,-18,1.0), (-11,-16,1.0), (-10,-17,1.0), (-12,-18,1.4), (-12,-16,1.4), (-10,-18,1.4), (-10,-16,1.4), (-13,-17,2.0), (-11,-19,2.0),
(-11,-17,2.0), (-11,-15,2.0), (-10,-16,2.0), (-9,-17,2.0), (-13,-18,2.4), (-13,-16,2.4), (-12,-19,2.4), (-12,-15,2.4), (-11,-18,2.4), (-11,-16,2.4), (-10,-19,2.4), (-10,-17,2.4), (-10,-15,2.4), (-9,-18,2.4), (-9,-16,2.4), (-13,-19,2.8), (-13,-17,2.8), (-13,-15,2.8), (-11,-19,2.8),
(-11,-17,2.8), (-11,-15,2.8), (-9,-19,2.8), (-9,-17,2.8), (-9,-15,2.8), (-14,-17,3.0), (-13,-16,3.0)]
The crazy part is that when I put those same nodes into the test program, it will only accept one of them, yet here it is, the very same class, with all three accepted. How is this possible?
Now, I know i'm being a bit vague, but the problem is that to post any more code would be extremely difficult, as the the Node is a very small part of a rather large project. Even to post the class that it is encapsulated in would be extremely difficult, as it refers to various interfaces, is called upon by an entirely differnt class, etc...
[ May 02, 2004: Message edited by: Joseph George ]