barp
Full Member
Posts: 28
|
Post by barp on Mar 11, 2002 20:20:45 GMT -5
Can anyone help me out.. A) I get lost in the tree..... I don't know how to sift through this ugly tree thing...
B)when I make my URLTree, it creates an empty URLTreeNode..which is what I want.....but, in contains i do the call stuff like.... contains (root, string)...then if n==null.... and it gives me false.....as if n (my root ) is equal to null.. and it's not equal to null.....it's equal to ""....grrrrrrrr..
sorry for the grrrrrrr.....
|
|
|
Post by Evotamer on Mar 11, 2002 21:50:07 GMT -5
Hint: Try using a index key...
Better Hint: Remember when you have a linked list within your class, generally you have something call head = yourNode. Head is just a pointer to that node basically. Therefore if you create a new temporary node, i.e. temp = head. Temp is pointing to what head is pointing to. If you do temp = head.next, it doesn't change the value of head at all, and it just points to the next node.
I'm not quite sure what you are trying to do here, but it looks like you need to make a constructor that sets n==NULL when you create a new URLTreeNode. When Java / C / C++ compiles, it sometimes can set something to NULL automatically but it's safer for you to do so yourself. Hmm is that what your problem is?
|
|
barp
Full Member
Posts: 28
|
Post by barp on Mar 11, 2002 23:38:33 GMT -5
Thanks for the help on part a!
B) sorry for the confusing question... I guess this is sorta my question... I have this; Root = ""; Root!=null this is true...but I tested it and I'm getting false...and I made my test method very simple ...
|
|
barp
Full Member
Posts: 28
|
Post by barp on Mar 12, 2002 11:24:36 GMT -5
I know what I did.....I had a void in the constructor by mistake....doh.......
|
|
|
Post by Brutal_Chicken on Mar 15, 2002 16:11:57 GMT -5
Does anyone know if we're allowed to make the two instance variables in URLTreeNode public? I can make it private and write methods to get and set them but this'll save me from doing so... ok so each method is like one line. Shut up.
On that note, what other methods do you guys have for URLTreeNode? I have a constructor and a compareTo since it implements Comparable.
|
|