Gridarta Editor
net.sf.gridarta.textedit.textarea.Token Class Reference

A linked list of tokens. More...

+ Collaboration diagram for net.sf.gridarta.textedit.textarea.Token:

Public Member Functions

byte getId ()
 Returns the id of this token. More...
 
int getLength ()
 Returns the length of this token. More...
 
void setId (final byte id)
 Sets the id of this token. More...
 
void setLength (final int length)
 Sets the length of this token. More...
 
 Token (final int length, final byte id)
 Creates a new token. More...
 
String toString ()
 Returns a string representation of this token. More...
 

Static Public Attributes

static final byte COMMENT1 = (byte) 1
 Comment 1 token id. More...
 
static final byte COMMENT2 = (byte) 2
 Comment 2 token id. More...
 
static final byte ID_COUNT = (byte) 11
 The total number of defined token ids. More...
 
static final byte INTERNAL_FIRST = (byte) 100
 The first id that can be used for internal state in a token marker. More...
 
static final byte INTERNAL_LAST = (byte) 126
 The last id that can be used for internal state in a token marker. More...
 
static final byte INVALID = (byte) 10
 Invalid token id. More...
 
static final byte KEYWORD1 = (byte) 6
 Keyword 1 token id. More...
 
static final byte KEYWORD2 = (byte) 7
 Keyword 2 token id. More...
 
static final byte KEYWORD3 = (byte) 8
 Keyword 3 token id. More...
 
static final byte LABEL = (byte) 5
 Label token id. More...
 
static final byte LITERAL1 = (byte) 3
 Literal 1 token id. More...
 
static final byte LITERAL2 = (byte) 4
 Literal 2 token id. More...
 
static final byte NULL = (byte) 0
 Normal text token id. More...
 
static final byte OPERATOR = (byte) 9
 Operator token id. More...
 

Private Attributes

byte id
 The id of this token. More...
 
int length
 The length of this token. More...
 

Detailed Description

A linked list of tokens.

Each token has three fields - a token identifier, which is a byte value that can be looked up in the array returned by

SyntaxDocument.getColors()

to get a color value and a length value which is the length of the token in the text.

Author
Slava Pestov
Andreas Kirschbaum

Definition at line 21 of file Token.java.

Constructor & Destructor Documentation

◆ Token()

net.sf.gridarta.textedit.textarea.Token.Token ( final int  length,
final byte  id 
)

Creates a new token.

Parameters
lengththe length of the token
idthe id of the token

Definition at line 116 of file Token.java.

References net.sf.gridarta.textedit.textarea.Token.id, and net.sf.gridarta.textedit.textarea.Token.length.

Member Function Documentation

◆ getId()

byte net.sf.gridarta.textedit.textarea.Token.getId ( )

Returns the id of this token.

Returns
the id of this token

Definition at line 133 of file Token.java.

References net.sf.gridarta.textedit.textarea.Token.id.

◆ getLength()

int net.sf.gridarta.textedit.textarea.Token.getLength ( )

Returns the length of this token.

Returns
the length of this token

Definition at line 149 of file Token.java.

References net.sf.gridarta.textedit.textarea.Token.length.

◆ setId()

void net.sf.gridarta.textedit.textarea.Token.setId ( final byte  id)

Sets the id of this token.

Parameters
idthe new id of this token

Definition at line 141 of file Token.java.

References net.sf.gridarta.textedit.textarea.Token.id.

◆ setLength()

void net.sf.gridarta.textedit.textarea.Token.setLength ( final int  length)

Sets the length of this token.

Parameters
lengththe new length of this token

Definition at line 157 of file Token.java.

References net.sf.gridarta.textedit.textarea.Token.length.

◆ toString()

String net.sf.gridarta.textedit.textarea.Token.toString ( )

Returns a string representation of this token.

Definition at line 125 of file Token.java.

Member Data Documentation

◆ COMMENT1

◆ COMMENT2

final byte net.sf.gridarta.textedit.textarea.Token.COMMENT2 = (byte) 2
static

◆ id

byte net.sf.gridarta.textedit.textarea.Token.id
private

◆ ID_COUNT

final byte net.sf.gridarta.textedit.textarea.Token.ID_COUNT = (byte) 11
static

The total number of defined token ids.

Definition at line 89 of file Token.java.

Referenced by net.sf.gridarta.textedit.textarea.SyntaxUtilities.getDefaultSyntaxStyles().

◆ INTERNAL_FIRST

final byte net.sf.gridarta.textedit.textarea.Token.INTERNAL_FIRST = (byte) 100
static

The first id that can be used for internal state in a token marker.

Definition at line 94 of file Token.java.

Referenced by net.sf.gridarta.textedit.textarea.tokenmarker.TokenMarker.addToken().

◆ INTERNAL_LAST

final byte net.sf.gridarta.textedit.textarea.Token.INTERNAL_LAST = (byte) 126
static

The last id that can be used for internal state in a token marker.

Definition at line 99 of file Token.java.

Referenced by net.sf.gridarta.textedit.textarea.tokenmarker.TokenMarker.addToken().

◆ INVALID

◆ KEYWORD1

◆ KEYWORD2

◆ KEYWORD3

final byte net.sf.gridarta.textedit.textarea.Token.KEYWORD3 = (byte) 8
static

◆ LABEL

final byte net.sf.gridarta.textedit.textarea.Token.LABEL = (byte) 5
static

◆ length

int net.sf.gridarta.textedit.textarea.Token.length
private

◆ LITERAL1

◆ LITERAL2

◆ NULL

◆ OPERATOR

final byte net.sf.gridarta.textedit.textarea.Token.OPERATOR = (byte) 9
static

The documentation for this class was generated from the following file: