|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--PageLexer
A lexical analyzer for web documents, based on a finite-state machine. This code is incomplete. For Part 1 of HW5, you are to finish writing the code for this class. This class implements a lexical analyzer for web documents. Instances of this class are Iterators that produce PageElement objects (each of which is a keyword, number, or hyperlink). Bad hyperlinks are discarded.
| Nested Class Summary | |
private class |
PageLexer.Action
a private class that do the action |
| Field Summary | |
private PageLexer.Action |
action
The action table. action.doit(state) performs the action for the given state. |
private int[][] |
delta
The state-transition table. |
private java.util.Vector |
elts
|
private HttpTokenizer |
tokenStream
|
private java.net.URL |
url
|
| Constructor Summary | |
PageLexer(java.io.Reader page,
java.net.URL u)
Creates a new web page lexer. |
|
| Method Summary | |
boolean |
hasNext()
Determine whether there are more PageElements in the page. |
java.lang.Object |
next()
Return the next PageElement in the page. |
void |
remove()
Unimplemented |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private java.net.URL url
private java.util.Vector elts
private HttpTokenizer tokenStream
private int[][] delta
private PageLexer.Action action
| Constructor Detail |
public PageLexer(java.io.Reader page,
java.net.URL u)
throws java.io.IOException
page - A reader for the web pageu - The URL of this page| Method Detail |
public boolean hasNext()
hasNext in interface java.util.Iteratorpublic java.lang.Object next()
next in interface java.util.Iteratorpublic void remove()
remove in interface java.util.Iterator
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||