syntaxhighlight
Class ParseResult

java.lang.Object
  extended by syntaxhighlight.ParseResult

public class ParseResult
extends java.lang.Object

The parser parsed result. This class include the information needed to highlight the syntax. Information includes where the content located in the document (offset and length) and what style(s) should be applied on that segment of content.

Author:
Chan Wai Shing

Field Summary
protected  int length
          The length of the content.
protected  int offset
          The start position of the content.
protected  java.util.List<java.lang.String> styleKeys
          The style keys of the content.
 
Constructor Summary
ParseResult(int offset, int length, java.util.List<java.lang.String> styleKeys)
          Constructor.
 
Method Summary
 boolean addStyleKey(java.lang.String styleKey)
          The style keys of the content.
 void clearStyleKeys()
          The style keys of the content.
 int getLength()
          The length of the content.
 int getOffset()
          The start position of the content.
 java.util.List<java.lang.String> getStyleKeys()
          The style keys for this matched result, see syntaxhighlighter.theme.
 java.lang.String getStyleKeysString()
          Get the style keys represented by one string key, see Theme.getStylesAttributeSet(String).
 boolean removeStyleKey(java.lang.String styleKey)
          The style keys of the content.
 void setLength(int length)
          The length of the content.
 void setOffset(int offset)
          The start position of the content.
 void setStyleKeys(java.util.List<java.lang.String> styleKeys)
          The style keys of the content.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

offset

protected int offset
The start position of the content.


length

protected int length
The length of the content.


styleKeys

protected java.util.List<java.lang.String> styleKeys
The style keys of the content. The style at higher index of the list will override the style of the lower index.

Constructor Detail

ParseResult

public ParseResult(int offset,
                   int length,
                   java.util.List<java.lang.String> styleKeys)
Constructor.

Parameters:
offset - the start position of the content
length - the length of the content
styleKeys - the style keys of the content
Method Detail

getOffset

public int getOffset()
The start position of the content.

Returns:
the start position of the content

setOffset

public void setOffset(int offset)
The start position of the content.

Parameters:
offset - the start position of the content

getLength

public int getLength()
The length of the content.

Returns:
the length of the content

setLength

public void setLength(int length)
The length of the content.

Parameters:
length - the length of the content

getStyleKeysString

public java.lang.String getStyleKeysString()
Get the style keys represented by one string key, see Theme.getStylesAttributeSet(String).

Returns:
the style keys of the content

setStyleKeys

public void setStyleKeys(java.util.List<java.lang.String> styleKeys)
The style keys of the content.

Parameters:
styleKeys - the style keys of the content

addStyleKey

public boolean addStyleKey(java.lang.String styleKey)
The style keys of the content.

Parameters:
styleKey - the style key
Returns:
see the return value of List.add(Object)

removeStyleKey

public boolean removeStyleKey(java.lang.String styleKey)
The style keys of the content.

Parameters:
styleKey - the style key
Returns:
see the return value of List.remove(Object)

clearStyleKeys

public void clearStyleKeys()
The style keys of the content.


getStyleKeys

public java.util.List<java.lang.String> getStyleKeys()
The style keys for this matched result, see syntaxhighlighter.theme.

Returns:
the style keys

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object