rabbit.html
Class Token

java.lang.Object
  extended byrabbit.html.Token

public class Token
extends java.lang.Object

This class is used to describe a small part of a html page. A small part is the text between the tags, a tag, a comment or a script.


Field Summary
static int COMMENT
          This token is a comment.
static int EMPTY
          This token is empty
static int SCRIPT
          This token is a script
static int TAG
          This token is a tag.
static int TEXT
          This token is text.
 
Constructor Summary
Token(byte[] page, int type, int startindex, int len)
          Create a new Token with given arguments.
Token(java.lang.String text)
          Create a new Token of type TEXT with given text.
Token(java.lang.String text, int type, int startindex)
          Create a new Token with given arguments.
Token(Tag tag)
          Create a new Token of type Tag with given Tag.
Token(Tag tag, boolean changed)
          Create a new Token of type Tag with given Tag.
Token(Tag tag, int startindex)
          Create a new Token with given arguments and of type TAG.
 
Method Summary
 void empty()
          Empty this token, That is set its type to EMPTY and set the text and tag to null.
 boolean getChanged()
          Has this Token changed since it was created?
 int getStartIndex()
          Get the start index of this Token.
 Tag getTag()
          Get the tag of this token.
 java.lang.String getText()
          Get the text of this token.
 int getType()
          Get the type of this token.
 void setChanged(boolean changed)
          Set the change value of this Token.
 void setStartIndex(int startindex)
          Set the start index of this Token.
 void setTag(Tag tag)
          Set the tag of this token, also set the type to TAG.
 void setText(java.lang.String text)
          Set the text of this Token, also sets the type to TEXT.
 java.lang.String toString()
          Get the String representation of this object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY

public static final int EMPTY
This token is empty

See Also:
Constant Field Values

TEXT

public static final int TEXT
This token is text.

See Also:
Constant Field Values

TAG

public static final int TAG
This token is a tag.

See Also:
Constant Field Values

COMMENT

public static final int COMMENT
This token is a comment.

See Also:
Constant Field Values

SCRIPT

public static final int SCRIPT
This token is a script

See Also:
Constant Field Values
Constructor Detail

Token

public Token(java.lang.String text)
Create a new Token of type TEXT with given text.

Parameters:
text - the String of this Token.

Token

public Token(Tag tag)
Create a new Token of type Tag with given Tag.

Parameters:
tag - the Tag of this Token.

Token

public Token(Tag tag,
             boolean changed)
Create a new Token of type Tag with given Tag.

Parameters:
tag - the Tag of this Token.

Token

public Token(java.lang.String text,
             int type,
             int startindex)
Create a new Token with given arguments.

Parameters:
text - the text of this Token.
type - the type of this token.
startindex - the start index of this token.

Token

public Token(byte[] page,
             int type,
             int startindex,
             int len)
Create a new Token with given arguments.

Parameters:
page - the page this token is from.
type - the type of this token.
startindex - the start index of this token.
len - the length of this token.

Token

public Token(Tag tag,
             int startindex)
Create a new Token with given arguments and of type TAG.

Parameters:
tag - the Tag of this Token.
startindex - the start index of this token.
Method Detail

getTag

public Tag getTag()
Get the tag of this token.

Returns:
the Tag or null if type is other than TAG.

setTag

public void setTag(Tag tag)
Set the tag of this token, also set the type to TAG.

Parameters:
tag - the Tag to hold.

getText

public java.lang.String getText()
Get the text of this token.

Returns:
the text or null if type is other than TEXT.

setText

public void setText(java.lang.String text)
Set the text of this Token, also sets the type to TEXT.

Parameters:
text - the text of this token.

getType

public int getType()
Get the type of this token.

Returns:
the type of this token.

getChanged

public boolean getChanged()
Has this Token changed since it was created?

Returns:
true if this Token has changed, false otherwise.

setChanged

public void setChanged(boolean changed)
Set the change value of this Token.

Parameters:
changed - the new change value of this Token.

getStartIndex

public int getStartIndex()
Get the start index of this Token.

Returns:
the start index.

setStartIndex

public void setStartIndex(int startindex)
Set the start index of this Token.

Parameters:
startindex - the new startindex.

empty

public void empty()
Empty this token, That is set its type to EMPTY and set the text and tag to null.


toString

public java.lang.String toString()
Get the String representation of this object.

Returns:
a String representation of this object.