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

java.lang.Object
  extended by org.eclipse.mylyn.wikitext.core.parser.markup.Processor
      extended by org.eclipse.mylyn.wikitext.core.parser.markup.PatternBasedElementProcessor
All Implemented Interfaces:
Cloneable, Matcher
Direct Known Subclasses:
EntityReplacementTokenProcessor, LineBreakReplacementTokenProcessor, LiteralPhraseModifierProcessor, LiteralReplacementTokenProcessor, MonospacePhraseModifier.MonospaceElementProcessor

public abstract class PatternBasedElementProcessor
extends Processor
implements Matcher

A processor that is capable of processing a specific type of markup element

Author:
David Green

Field Summary
protected  Map<Integer,org.eclipse.mylyn.wikitext.core.parser.markup.PatternBasedElementProcessor.Group> groupByIndex
           
protected  int lineEndOffset
           
protected  int lineStartOffset
           
 
Fields inherited from class org.eclipse.mylyn.wikitext.core.parser.markup.Processor
builder, markupLanguage, parser, state
 
Constructor Summary
PatternBasedElementProcessor()
           
 
Method Summary
abstract  void emit()
          Emit the content of the element
 int end(int groupNumber)
          Get the end offset of a capturing group, or -1 if the group did not match any text.
 int getLineEndOffset()
          Get the offset within the line at which this element ended
 int getLineStartOffset()
          Get the offset within the line at which this element was started
 String group(int groupNumber)
          Get the capturing group text, or null if the group did not match any text.
 void setGroup(int group, String capturedText, int start, int end)
          Set the captured text for the given group.
 void setLineEndOffset(int lineEndOffset)
           
 void setLineStartOffset(int lineStartOffset)
           
 int start(int groupNumber)
          Get the start offset of a capturing group, or -1 if the group did not match any text.
 
Methods inherited from class org.eclipse.mylyn.wikitext.core.parser.markup.Processor
clone, getBuilder, getMarkupLanguage, getParser, getState, setParser, setState
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lineStartOffset

protected int lineStartOffset

lineEndOffset

protected int lineEndOffset

groupByIndex

protected Map<Integer,org.eclipse.mylyn.wikitext.core.parser.markup.PatternBasedElementProcessor.Group> groupByIndex
Constructor Detail

PatternBasedElementProcessor

public PatternBasedElementProcessor()
Method Detail

setGroup

public void setGroup(int group,
                     String capturedText,
                     int start,
                     int end)
Set the captured text for the given group.

Parameters:
group - the 1-based group
capturedText - the text that was captured
See Also:
group(int)

getLineStartOffset

public int getLineStartOffset()
Get the offset within the line at which this element was started

See Also:
Matcher.start()

setLineStartOffset

public void setLineStartOffset(int lineStartOffset)

getLineEndOffset

public int getLineEndOffset()
Get the offset within the line at which this element ended

See Also:
Matcher.end()

setLineEndOffset

public void setLineEndOffset(int lineEndOffset)

group

public String group(int groupNumber)
Get the capturing group text, or null if the group did not match any text.

Specified by:
group in interface Matcher
Parameters:
groupNumber - the 1-based group
Returns:
the text, or null if the group did not match any text
See Also:
Matcher.group(int)

start

public int start(int groupNumber)
Get the start offset of a capturing group, or -1 if the group did not match any text.

Specified by:
start in interface Matcher
Parameters:
groupNumber - the 1-based group
Returns:
the start offset, or -1 if the group did not match any text
See Also:
Matcher.start(int)

end

public int end(int groupNumber)
Get the end offset of a capturing group, or -1 if the group did not match any text.

Specified by:
end in interface Matcher
Parameters:
groupNumber - the 1-based group
Returns:
the end offset, or -1 if the group did not match any text
See Also:
Matcher.start(int)

emit

public abstract void emit()
Emit the content of the element



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