Package org.htmlparser.lexer
Class Cursor
- java.lang.Object
-
- org.htmlparser.lexer.Cursor
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,Ordered
public class Cursor extends java.lang.Object implements java.io.Serializable, Ordered, java.lang.Cloneable
A bookmark in a page. This class remembers the page it came from and its position within the page.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadvance()Move the cursor position ahead one character.intcompare(java.lang.Object that)Compare one reference to another.Cursordup()Make a new cursor just like this one.PagegetPage()Get this cursor's page.intgetPosition()Get the position of this cursor.voidretreat()Move the cursor position back one character.voidsetPosition(int position)Set the position of this cursor.java.lang.StringtoString()Return a string representation of this cursor
-
-
-
Field Detail
-
mPosition
protected int mPosition
This cursor's position.
-
mPage
protected Page mPage
This cursor's page.
-
-
Constructor Detail
-
Cursor
public Cursor(Page page, int offset)
Construct aCursorfrom the page and position given.- Parameters:
page- The page this cursor is on.offset- The character offset within the page.
-
-
Method Detail
-
getPage
public Page getPage()
Get this cursor's page.- Returns:
- The page associated with this cursor.
-
getPosition
public int getPosition()
Get the position of this cursor.- Returns:
- The cursor position.
-
setPosition
public void setPosition(int position)
Set the position of this cursor.- Parameters:
position- The new cursor position.
-
advance
public void advance()
Move the cursor position ahead one character.
-
retreat
public void retreat()
Move the cursor position back one character.
-
dup
public Cursor dup()
Make a new cursor just like this one.- Returns:
- The new cursor positioned where
thisone is, and referring to the same page.
-
toString
public java.lang.String toString()
Return a string representation of this cursor- Overrides:
toStringin classjava.lang.Object- Returns:
- A string of the form "n[r,c]", where n is the character position, r is the row (zero based) and c is the column (zero based) on the page.
-
compare
public int compare(java.lang.Object that)
Compare one reference to another.
-
-