|
Post by Tony on Mar 31, 2002 12:42:24 GMT -5
how do we check for this? I mean, how do we "check" if the exception is thrown or not?
|
|
|
Post by Brutal_Chicken on Mar 31, 2002 12:44:29 GMT -5
Remember 'try' and 'catch'? Just 'try' to create a URL and 'catch' if it throws a Malformed whatever.
|
|
|
Post by CooLiBoP on Apr 2, 2002 16:49:48 GMT -5
How are people inserting their dead links into the tree? I'm wondering about this because when I go to write the file how will it know if it is dead or not? Right now i'm inserting my urls in the form http://www.blah.com...should I be inserting tags instead?
|
|
|
Post by Brutal_Chicken on Apr 2, 2002 18:06:19 GMT -5
What I did was copy my toString method and modified it slightly. In your map method you should have an if statement to check if the LinkIterator's hasNext() method returns false.
If it does, that means that it has no links to go on to so you can merely add the 'parent' url to the URLTree BUT you should have some way of marking it as a dead link.
For instance, this isn't what I did but it would work, when you find an ok link then you add it to the tree with the <a href> thingy already there plus the normal String version of the URL so that it looks like the url/title stuff we had to do back then. Well, if you find a dead link, then all you have to do is insert the normal String url.
Instead of insert <a href"deadlink"></a>deadlink /r/n you merely insert deadlink. That should make it easier for your modified toString method to handle.
Hope that helps.
|
|
|
Post by CooLiBoP on Apr 2, 2002 18:26:01 GMT -5
yes but if I insert it without the <href etc... then won't it not be sorted? and it won't be under the proper root...
|
|
|
Post by Brutal_Chicken on Apr 2, 2002 19:25:54 GMT -5
yes but if I insert it without the <href etc... then won't it not be sorted? and it won't be under the proper root... True. That's why I placed the href while I was toStringing it. Putting a marker on it would be your best bet. I dunno how it changes it but I don't think it matters that much.
|
|
|
Post by CooLiBoP on Apr 2, 2002 19:50:25 GMT -5
er I dont like the idea of a marker...because there is the possibility of the marker being part of the url...
|
|
|
Post by Brutal_Chicken on Apr 3, 2002 7:31:39 GMT -5
Not necessarily. I haven't seen any URLs that ended with a '*'.
Your call as to what to do.
|
|
|
Post by CooLiBoP on Apr 3, 2002 14:36:33 GMT -5
There still has to be a better way...I mean that isn't the best coding in the world after all
|
|
|
Post by Brutal_Chicken on Apr 3, 2002 16:31:27 GMT -5
There still has to be a better way...I mean that isn't the best coding in the world after all Now isn't the best time to be debating proper techniques, man. Besides, we had to do the exact same thing with the URLList right? We couldn't separate the url from the title by putting them in seperate links so we had to make them one String but with a marker to set apart each. It's the same principle, just used differently. And from what I've tested, it doesn't affect alphabetical order.
|
|
|
Post by Sylph on Apr 3, 2002 17:34:11 GMT -5
a url can't have a space, right? i'm not implementing it that way, but i'm just saying. or a newline character.
|
|
|
Post by gabbie on Apr 3, 2002 17:44:39 GMT -5
what i did was added " *DEADLINK*" to it i dun fink urls have have a " " or *DEADLINK* in it =) argh.. i duno how 2 take it back out ?? stupid toString.. can someone teach me how to toString a tree ??
|
|
|
Post by CooLiBoP on Apr 3, 2002 17:46:53 GMT -5
Now isn't the best time to be debating proper techniques, man. Besides, we had to do the exact same thing with the URLList right? We couldn't separate the url from the title by putting them in seperate links so we had to make them one String but with a marker to set apart each. It's the same principle, just used differently. And from what I've tested, it doesn't affect alphabetical order. Actually the solution for URLList was make a URLPair object which stores both title and url seperatly...Its much better design because you never know if a URL might have a * or whatever character...I'm just wondering if other people did it differently...I'm thinking that I have to store my URLs as objects which have a boolean called isDead or something along those lines...
|
|
|
Post by Sylph on Apr 3, 2002 17:52:28 GMT -5
|
|
|
Post by Yingster on Apr 3, 2002 17:57:23 GMT -5
must be the extra "/" after .html cuz that doesnt make the url valid then
|
|