org.eclipse.mylyn.wikitext.core.parser.markup
Class ContentState

java.lang.Object
  extended by org.eclipse.mylyn.wikitext.core.parser.markup.ContentState
All Implemented Interfaces:
Locator
Direct Known Subclasses:
TextileContentState

public class ContentState
extends Object
implements Locator

State related to parsing content, propagated to blocks and other processors during the parse phase.

Since:
1.0
Author:
David Green

Constructor Summary
ContentState()
           
 
Method Summary
 void addGlossaryTerm(String term, String definition)
          Add a glossary term (typically an acronym) with its definition.
 int getDocumentOffset()
          get the 0-based character offset of the current character from the start of the document.
 String getFootnoteId(String footnote)
           
 Map<String,String> getGlossaryTerms()
          Get the glossary as a map of definition by acronym or term.
 IdGenerator getIdGenerator()
           
 int getLineCharacterOffset()
          get the 0-based offset of the current character in the current line
 int getLineDocumentOffset()
          get the 0-based character offset of the current line from the start of the document
 int getLineLength()
          get the length of the current line in characters, not including the line terminator
 int getLineNumber()
          Get the 1-based line number of the current line.
 int getLineOffset()
          the 0-based character offset of the current line.
 int getLineSegmentEndOffset()
          Get the 0-based offset of the end of the current line segment being processed, exclusive.
 String getMarkupContent()
           
 void setLineCharacterOffset(int lineCharacterOffset)
           
 void setLineLength(int lineLength)
           
protected  void setLineNumber(int lineNumber)
          the 1-based line number of the current line.
protected  void setLineOffset(int lineOffset)
          the 0-based character offset of the current line.
 void setLineSegmentEndOffset(int lineSegmentEndOffset)
           
protected  void setMarkupContent(String markupContent)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentState

public ContentState()
Method Detail

getMarkupContent

public String getMarkupContent()

setMarkupContent

protected void setMarkupContent(String markupContent)

getFootnoteId

public String getFootnoteId(String footnote)

addGlossaryTerm

public void addGlossaryTerm(String term,
                            String definition)
Add a glossary term (typically an acronym) with its definition. Has no effect if the term is already present in the glossary and the given definition is shorter or equal in length to the existing definition.

Parameters:
term - the term to add
definition - the definition of the term.

getGlossaryTerms

public Map<String,String> getGlossaryTerms()
Get the glossary as a map of definition by acronym or term.


getIdGenerator

public IdGenerator getIdGenerator()

getLineNumber

public int getLineNumber()
Get the 1-based line number of the current line.

Specified by:
getLineNumber in interface Locator
Returns:
the line number or -1 if unknown

setLineNumber

protected void setLineNumber(int lineNumber)
the 1-based line number of the current line.


getLineOffset

public int getLineOffset()
the 0-based character offset of the current line.

Returns:
the offset or -1 if it is unknown.

setLineOffset

protected void setLineOffset(int lineOffset)
the 0-based character offset of the current line.


getLineDocumentOffset

public int getLineDocumentOffset()
Description copied from interface: Locator
get the 0-based character offset of the current line from the start of the document

Specified by:
getLineDocumentOffset in interface Locator
Returns:
the offset or -1 if unknown

getLineCharacterOffset

public int getLineCharacterOffset()
Description copied from interface: Locator
get the 0-based offset of the current character in the current line

Specified by:
getLineCharacterOffset in interface Locator

setLineCharacterOffset

public void setLineCharacterOffset(int lineCharacterOffset)

getDocumentOffset

public int getDocumentOffset()
Description copied from interface: Locator
get the 0-based character offset of the current character from the start of the document. Equivalent to getLineDocumentOffset()+getLineCharacterOffset()

Specified by:
getDocumentOffset in interface Locator

getLineLength

public int getLineLength()
Description copied from interface: Locator
get the length of the current line in characters, not including the line terminator

Specified by:
getLineLength in interface Locator

setLineLength

public void setLineLength(int lineLength)

setLineSegmentEndOffset

public void setLineSegmentEndOffset(int lineSegmentEndOffset)

getLineSegmentEndOffset

public int getLineSegmentEndOffset()
Description copied from interface: Locator
Get the 0-based offset of the end of the current line segment being processed, exclusive. Generally a phrase modifier starts at Locator.getLineCharacterOffset() and ends on the character preceding this offset, [s,e) where s is the start and e is the end.

Specified by:
getLineSegmentEndOffset in interface Locator


Copyright © 2011 FuseSource, Corp.. All Rights Reserved.