Changeset 11645
- Timestamp:
- 2006-04-12T09:22:10+12:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/java/org/nzdl/gsdl/GsdlCollageApplet/DownloadUrls.java
r11563 r11645 65 65 int verbosity_ = 0; 66 66 67 protected boolean busy_ = false; 68 67 /** Records all images which have already been examined */ 68 Hashtable visited_images_ = null; 69 69 70 MediaTracker tracker; 70 71 … … 99 100 System.err.println("starting_url_ " + starting_url +"\n"+ 100 101 "href_musthave_ " + href_musthave +"\n"+ 101 "image_mustnothave_ " + image_mustnothave+"\n"+102 "image_mustnothave_ " + image_mustnothave+"\n"+ 102 103 "image_ignore_ "+ image_ignore+"\n"+ 103 104 "image_type_ "+ image_type+"\n"+ … … 110 111 } 111 112 112 public boolean getStatus(){ 113 return busy_; 114 115 } 116 113 117 114 /** Determines whether or not a url has already been examined 118 115 * … … 128 125 } 129 126 130 // if the url has been visited before, return true127 // if the url has been visited before, return true 131 128 if (visited_url_.containsKey(url_string)) 132 129 { … … 142 139 return false; 143 140 } 141 142 /** Determines whether or not an images or its screenview has been visited) 143 * has already been examined 144 * 145 * @param url_string the url to check 146 * @param img_name the image to check 147 * @return true if the url has been visited, false if not */ 148 public boolean image_visited(String url_string, String img_name) 149 { 150 String hash_dir = url_string.substring(0,url_string.lastIndexOf("/")); 151 152 if ( visited_images_.containsKey(hash_dir)){ 153 Hashtable hashed_images = (Hashtable)visited_images_.get(hash_dir); 154 155 if (img_name.startsWith("screenview")){ 156 return true; 157 } 158 159 if (hashed_images.containsKey(img_name)){ 160 return true; 161 } 162 163 Enumeration enu = hashed_images.keys(); 164 for(;enu.hasMoreElements();){ 165 String name = (String)enu.nextElement(); 166 if(name.startsWith("screenview")){ 167 return true; 168 } 169 } 170 171 hashed_images.put(img_name,"visited"); 172 } 173 else{ 174 Hashtable hashed_images = new Hashtable(); 175 hashed_images.put(img_name,"visited"); 176 visited_images_.put(hash_dir,hashed_images); 177 } 178 179 return false; 180 } 181 182 183 184 144 185 145 186 /** Restricts the type of images that can be included in the collage … … 328 369 } 329 370 371 //System.out.println("add image**"+url.toString()); 372 //System.out.println("***** URL Path**"+from_url); 373 //System.out.println("*** imagename**"+img_name); 374 375 if (image_visited(url.toString(),img_name)) return; 376 330 377 int size = download_images_.downloadImage(tracker,url, from_url, img_name); 331 378 … … 386 433 URL url = (URL)src_links.get(i); 387 434 String url_string = url.toString(); 388 435 389 436 //System.err.println(" source links " + i + " [" + url_string +"]"); 390 437 … … 442 489 URL url = (URL)href_links.get(i); 443 490 String url_string = url.toString(); 444 445 //System.err.println(" href links " + i + "[" + url_string +"]"); 446 491 //System.err.println(" href links " + i + "[" + url_string +"]"); 447 492 448 493 if (image_file_extension(url_string)) 449 494 { 450 495 451 496 if (filter_image(url_string)) 452 497 453 498 { 499 454 500 img_name = url_string.substring(url_string.lastIndexOf("/") + 1, url_string.length()); 455 501 … … 543 589 System.err.println("Starting download thread."); 544 590 visited_url_ = new Hashtable(); 545 591 visited_images_ = new Hashtable(); 592 546 593 rec_add_images(starting_url_,1); 547 594 download_images_.stopDownload();
Note:
See TracChangeset
for help on using the changeset viewer.