Class DB

java.lang.Object
   |
   +----DB

public class DB
extends Object
DB class store all the html files downloaded it has 3 member variables, Hashtable d_table: hash table to store all pages, indexed by its URL int d_max_level: max recursive level String d_keyword: keyword search, if not null, only page containing that key word will be saved


Constructor Index

 o DB(int)
create an empty DB object
 o DB(int, String)
create an empty DB object

Method Index

 o exist(URL)
test if the given URL has already existed in the DB
 o get(URL)
retrieve a HTMLpage object from the database
 o insert(HTMLpage)
insert a HTMLpage ogject to the database index key is the URL of the page
 o load(RunDlg, URL, int)
load (or maybe download is a better name) from a URL, this is a recursive function
 o save(String)
save the DB's content to a given directory

Constructors

 o DB
 public DB(int level)
create an empty DB object

Parameters:
level - max recursive level no keyword search will be performed
 o DB
 public DB(int level,
           String key)
create an empty DB object

Parameters:
level - max recursive level
key - keyword string

Methods

 o get
 public HTMLpage get(URL key)
retrieve a HTMLpage object from the database

Parameters:
key - the complete URL of the page
 o insert
 public boolean insert(HTMLpage apage)
insert a HTMLpage ogject to the database index key is the URL of the page

 o exist
 public boolean exist(URL key)
test if the given URL has already existed in the DB

 o save
 public boolean save(String dir)
save the DB's content to a given directory

Parameters:
dir - the path
 o load
 public void load(RunDlg myrun,
                  URL base,
                  int level)
load (or maybe download is a better name) from a URL, this is a recursive function

Parameters:
RunDlg - the Dialog to show progress
URL - the URL of the page
level - current recursive level