|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcs132.webSpider.WebPage
public class WebPage
This class provides an abstraction for a web page in a web crawler. For each web page, we record the URL of the web page, whether or not the crawled has visited the web page, and a set of hypertext links from the web page to other web pages.
| Constructor Summary | |
|---|---|
WebPage(java.net.URL u)
Create a new WebPage |
|
| Method Summary | |
|---|---|
void |
addLink(WebPage w)
Adds a link to the WebPage |
java.util.Set<WebPage> |
getLinks()
Returns a set of Webpages linked to by this web page |
java.net.URL |
getURL()
Gets the URL associated with this web page |
boolean |
isVisited()
Reports whether the web page has been visited. |
java.lang.String |
toString()
|
void |
visit()
Make the web page as visited |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public WebPage(java.net.URL u)
u - -
the URL of this WebPage| Method Detail |
|---|
public java.lang.String toString()
toString in class java.lang.Objectpublic java.net.URL getURL()
public boolean isVisited()
public void visit()
java.lang.IllegalStateException - if this web page has already been marked as visitedpublic void addLink(WebPage w)
w - -
WebPage that this WebPage links to
java.lang.IllegalStateException - -
if the page referenced by this is not already marked as
visited (we don't care whether or not w has already been
visited)public java.util.Set<WebPage> getLinks()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||