Package org.apache.maven.doxia.index
Class IndexingSink
java.lang.Object
org.apache.maven.doxia.sink.impl.AbstractSink
org.apache.maven.doxia.sink.impl.SinkAdapter
org.apache.maven.doxia.index.IndexingSink
- All Implemented Interfaces:
LogEnabled,Markup,Sink
A sink implementation for index.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stack<IndexEntry> The stack.private StringThe current title.private static final intTitle.private intThe current type.private static final intDefined term.private static final intFigure.private static final intSection 1.private static final intSection 2.private static final intSection 3.private static final intSection 4.private static final intSection 5.private static final intTable.private final Map<String, AtomicInteger> A map containing all used ids of index entries as key and how often they are used as value (0-based, i.e.Fields inherited from interface org.apache.maven.doxia.markup.Markup
COLON, EOL, EQUAL, GREATER_THAN, LEFT_CURLY_BRACKET, LEFT_SQUARE_BRACKET, LESS_THAN, MINUS, PLUS, QUOTE, RIGHT_CURLY_BRACKET, RIGHT_SQUARE_BRACKET, SEMICOLON, SLASH, SPACE, STARFields inherited from interface org.apache.maven.doxia.sink.Sink
JUSTIFY_CENTER, JUSTIFY_LEFT, JUSTIFY_RIGHT, NUMBERING_DECIMAL, NUMBERING_LOWER_ALPHA, NUMBERING_LOWER_ROMAN, NUMBERING_UPPER_ALPHA, NUMBERING_UPPER_ROMAN, ROLE, SECTION_LEVEL_1, SECTION_LEVEL_2, SECTION_LEVEL_3, SECTION_LEVEL_4, SECTION_LEVEL_5, SECTION_LEVEL_6 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the writer or the stream, if needed.getTitle()Getter for the fieldtitle.(package private) StringgetUniqueId(String id) Converts the given id into a unique one by potentially suffixing it with an index value.protected voidinit()This is called inSink.head()or inSink.close(), and can be used to set the sink into a clear state so it can be re-used.peek()peek.voidpop()Removes the IndexEntry at the top of this stack.voidpush(IndexEntry entry) Pushes an IndexEntry onto the top of this stack.voidCreates and pushes a new IndexEntry onto the top of this stack.voidsection1()Starts a first heading element which contains the topic of the section.voidEnds a first heading element.voidsection2()Starts a second heading element which contains the topic of the section.voidEnds a second heading element.voidsection3()Starts a third heading element which contains the topic of the section.voidEnds a third heading element.voidsection4()Starts a 4th heading element which contains the topic of the section.voidEnds a 4th heading element.voidsection5()Starts a 5th heading element which contains the topic of the section.voidEnds a 5th heading element.voidStarts a first title heading element.voidsectionTitle1_.voidStarts a second title heading element.voidsectionTitle2_.voidStarts a third title heading element.voidsectionTitle3_.voidStarts a 4th title heading element.voidsectionTitle4_.voidStarts a 5th title heading element.voidsectionTitle5_.voidAdding a text.voidtitle()Starts the title element.voidtitle_()Ends the title element.Methods inherited from class org.apache.maven.doxia.sink.impl.SinkAdapter
address, address, address_, anchor, anchor, anchor_, article, article, article_, author, author, author_, blockquote, blockquote, blockquote_, body, body, body_, bold, bold_, comment, content, content, content_, data, data, data_, date, date, date_, definedTerm, definedTerm, definedTerm_, definition, definition, definition_, definitionList, definitionList, definitionList_, definitionListItem, definitionListItem, definitionListItem_, division, division, division_, figure, figure, figure_, figureCaption, figureCaption, figureCaption_, figureGraphics, figureGraphics, flush, footer, footer, footer_, head, head, head_, header, header, header_, horizontalRule, horizontalRule, inline, inline, inline_, italic, italic_, lineBreak, lineBreak, lineBreakOpportunity, lineBreakOpportunity, link, link, link_, list, list, list_, listItem, listItem, listItem_, monospaced, monospaced_, navigation, navigation, navigation_, nonBreakingSpace, numberedList, numberedList, numberedList_, numberedListItem, numberedListItem, numberedListItem_, pageBreak, paragraph, paragraph, paragraph_, rawText, section, section_, section6, section6_, sectionTitle, sectionTitle, sectionTitle_, sectionTitle_, sectionTitle6, sectionTitle6_, sidebar, sidebar, sidebar_, table, table, table_, tableCaption, tableCaption, tableCaption_, tableCell, tableCell, tableCell, tableCell_, tableHeaderCell, tableHeaderCell, tableHeaderCell, tableHeaderCell_, tableRow, tableRow, tableRow_, tableRows, tableRows_, text, time, time, time_, title, unknown, verbatim, verbatim, verbatim_Methods inherited from class org.apache.maven.doxia.sink.impl.AbstractSink
enableLogging, getLog, unifyEOLs
-
Field Details
-
TYPE_SECTION_1
private static final int TYPE_SECTION_1Section 1.- See Also:
-
TYPE_SECTION_2
private static final int TYPE_SECTION_2Section 2.- See Also:
-
TYPE_SECTION_3
private static final int TYPE_SECTION_3Section 3.- See Also:
-
TYPE_SECTION_4
private static final int TYPE_SECTION_4Section 4.- See Also:
-
TYPE_SECTION_5
private static final int TYPE_SECTION_5Section 5.- See Also:
-
TYPE_DEFINED_TERM
private static final int TYPE_DEFINED_TERMDefined term.- See Also:
-
TYPE_FIGURE
private static final int TYPE_FIGUREFigure.- See Also:
-
TYPE_TABLE
private static final int TYPE_TABLETable.- See Also:
-
TITLE
private static final int TITLETitle.- See Also:
-
type
private int typeThe current type. -
title
The current title. -
stack
The stack. -
usedIds
A map containing all used ids of index entries as key and how often they are used as value (0-based, i.e. 0 means used 1 time).AtomicIntegeris only used here as it implements a mutable integer (not for its atomicity).
-
-
Constructor Details
-
IndexingSink
Default constructor.- Parameters:
sectionEntry- The first index entry.
-
-
Method Details
-
getTitle
Getter for the field
title.- Returns:
- the title
-
title
public void title()Starts the title element.- Specified by:
titlein interfaceSink- Overrides:
titlein classSinkAdapter- See Also:
-
section1
public void section1()Starts a first heading element which contains the topic of the section.- Specified by:
section1in interfaceSink- Overrides:
section1in classSinkAdapter- See Also:
-
sectionTitle1
public void sectionTitle1()Starts a first title heading element. This element is optional, but if it exists, it has to be contained, and be the first element, within aSink.section1()element.- Specified by:
sectionTitle1in interfaceSink- Overrides:
sectionTitle1in classSinkAdapter- See Also:
-
title_
public void title_()Ends the title element.- Specified by:
title_in interfaceSink- Overrides:
title_in classSinkAdapter
-
sectionTitle1_
public void sectionTitle1_()sectionTitle1_.
- Specified by:
sectionTitle1_in interfaceSink- Overrides:
sectionTitle1_in classSinkAdapter
-
section1_
public void section1_()Ends a first heading element.- Specified by:
section1_in interfaceSink- Overrides:
section1_in classSinkAdapter
-
section2
public void section2()Starts a second heading element which contains the topic of the section. This has to be contained within aSink.section1()element.- Specified by:
section2in interfaceSink- Overrides:
section2in classSinkAdapter- See Also:
-
sectionTitle2
public void sectionTitle2()Starts a second title heading element. This element is optional, but if it exists, it has to be contained, and be the first element, within aSink.section2()element.- Specified by:
sectionTitle2in interfaceSink- Overrides:
sectionTitle2in classSinkAdapter- See Also:
-
sectionTitle2_
public void sectionTitle2_()sectionTitle2_.
- Specified by:
sectionTitle2_in interfaceSink- Overrides:
sectionTitle2_in classSinkAdapter
-
section2_
public void section2_()Ends a second heading element.- Specified by:
section2_in interfaceSink- Overrides:
section2_in classSinkAdapter
-
section3
public void section3()Starts a third heading element which contains the topic of the section. This has to be contained within aSink.section2()element.- Specified by:
section3in interfaceSink- Overrides:
section3in classSinkAdapter- See Also:
-
sectionTitle3
public void sectionTitle3()Starts a third title heading element. This element is optional, but if it exists, it has to be contained, and be the first element, within aSink.section3()element.- Specified by:
sectionTitle3in interfaceSink- Overrides:
sectionTitle3in classSinkAdapter- See Also:
-
sectionTitle3_
public void sectionTitle3_()sectionTitle3_.
- Specified by:
sectionTitle3_in interfaceSink- Overrides:
sectionTitle3_in classSinkAdapter
-
section3_
public void section3_()Ends a third heading element.- Specified by:
section3_in interfaceSink- Overrides:
section3_in classSinkAdapter
-
section4
public void section4()Starts a 4th heading element which contains the topic of the section. This has to be contained within aSink.section3()element.- Specified by:
section4in interfaceSink- Overrides:
section4in classSinkAdapter- See Also:
-
sectionTitle4
public void sectionTitle4()Starts a 4th title heading element. This element is optional, but if it exists, it has to be contained, and be the first element, within aSink.section4()element.- Specified by:
sectionTitle4in interfaceSink- Overrides:
sectionTitle4in classSinkAdapter- See Also:
-
sectionTitle4_
public void sectionTitle4_()sectionTitle4_.
- Specified by:
sectionTitle4_in interfaceSink- Overrides:
sectionTitle4_in classSinkAdapter
-
section4_
public void section4_()Ends a 4th heading element.- Specified by:
section4_in interfaceSink- Overrides:
section4_in classSinkAdapter
-
section5
public void section5()Starts a 5th heading element which contains the topic of the section. This has to be contained within aSink.section4()element.- Specified by:
section5in interfaceSink- Overrides:
section5in classSinkAdapter- See Also:
-
sectionTitle5
public void sectionTitle5()Starts a 5th title heading element. This element is optional, but if it exists, it has to be contained, and be the first element, within aSink.section5()element.- Specified by:
sectionTitle5in interfaceSink- Overrides:
sectionTitle5in classSinkAdapter- See Also:
-
sectionTitle5_
public void sectionTitle5_()sectionTitle5_.
- Specified by:
sectionTitle5_in interfaceSink- Overrides:
sectionTitle5_in classSinkAdapter
-
section5_
public void section5_()Ends a 5th heading element.- Specified by:
section5_in interfaceSink- Overrides:
section5_in classSinkAdapter
-
text
Adding a text.- Specified by:
textin interfaceSink- Overrides:
textin classSinkAdapter- Parameters:
text- The text to write.- See Also:
-
getUniqueId
Converts the given id into a unique one by potentially suffixing it with an index value.- Parameters:
id-- Returns:
- the unique id
-
pushNewEntry
public void pushNewEntry()Creates and pushes a new IndexEntry onto the top of this stack. -
push
Pushes an IndexEntry onto the top of this stack.- Parameters:
entry- to put.
-
pop
public void pop()Removes the IndexEntry at the top of this stack. -
peek
peek.
- Returns:
- Looks at the IndexEntry at the top of this stack.
-
close
public void close()Close the writer or the stream, if needed. Closing a previously-closed Sink has no effect.- Specified by:
closein interfaceSink- Overrides:
closein classSinkAdapter
-
init
protected void init()This is called inSink.head()or inSink.close(), and can be used to set the sink into a clear state so it can be re-used.- Overrides:
initin classAbstractSink
-