org.jomc.util
Class Section

Package class diagram package Section
java.lang.Object
  extended by org.jomc.util.Section

public class Section
extends Object

Section of text.

Version:
$Id: Section.java 509 2009-09-21 13:54:49Z schulte2005 $
Author:
Christian Schulte

Field Summary
private  Map<Integer,List<Section>> children
          The child sections of this section.
private  Map<Integer,String> endingLine
          Line marking the end of this section.
private  Map<Integer,StringBuilder> headContent
          The parsed head content of this section.
private  int level
          The level of this section.
private  int mode
          The current parsing mode.
(package private) static int MODE_HEAD
          Constant for the mode when parsing the head of a section.
(package private) static int MODE_TAIL
          Constant for the mode when parsing the tail of a section.
private  String name
          The name of this section.
private  Map<Integer,String> startingLine
          Line marking the start of this section.
private  Map<Integer,StringBuilder> tailContent
          The parsed tail content of this section.
 
Constructor Summary
Section()
          Creates a new Section instance.
 
Method Summary
(package private)  void addContent(String content)
          Adds content to the section.
private static List<Section> collectSections(Section section, List<Section> sections)
          Collects sections recursively.
(package private)  List<Section> getChildren()
          Gets the child sections of this section.
 String getEndingLine()
          Gets the line marking the end of this section.
 StringBuilder getHeadContent()
          Gets the parsed head content of this section.
(package private)  int getLevel()
          Gets the level of the section.
(package private)  int getMode()
          Gets the mode of the section.
 String getName()
          Gets the name of this section.
 List<Section> getSections()
          Gets all sections recursively.
 String getStartingLine()
          Gets the line marking the start of this section.
 StringBuilder getTailContent()
          Gets the parsed tail content of this section.
 void setEndingLine(String value)
          Sets the line marking the end of this section.
(package private)  void setLevel(int value)
          Sets the level of the section.
(package private)  void setMode(int value)
          Sets the mode of the section.
 void setName(String value)
          Sets the name of this section.
 void setStartingLine(String value)
          Sets the line marking the start of this section.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

private String name
The name of this section.


level

private int level
The level of this section.


headContent

private Map<Integer,StringBuilder> headContent
The parsed head content of this section.


tailContent

private Map<Integer,StringBuilder> tailContent
The parsed tail content of this section.


startingLine

private Map<Integer,String> startingLine
Line marking the start of this section.


endingLine

private Map<Integer,String> endingLine
Line marking the end of this section.


children

private Map<Integer,List<Section>> children
The child sections of this section.


MODE_HEAD

static final int MODE_HEAD
Constant for the mode when parsing the head of a section.

See Also:
Constant Field Values

MODE_TAIL

static final int MODE_TAIL
Constant for the mode when parsing the tail of a section.

See Also:
Constant Field Values

mode

private int mode
The current parsing mode.

Constructor Detail

Section

public Section()
Creates a new Section instance.

Method Detail

getName

public String getName()
Gets the name of this section.

Returns:
The name of this section.

setName

public void setName(String value)
Sets the name of this section.

Parameters:
value - The name of this section.

getStartingLine

public String getStartingLine()
Gets the line marking the start of this section.

Returns:
The line marking the start of this section.

setStartingLine

public void setStartingLine(String value)
Sets the line marking the start of this section.

Parameters:
value - The line marking the start of this section.

getEndingLine

public String getEndingLine()
Gets the line marking the end of this section.

Returns:
The line marking the end of this section.

setEndingLine

public void setEndingLine(String value)
Sets the line marking the end of this section.

Parameters:
value - The line marking the end of this section.

getHeadContent

public StringBuilder getHeadContent()
Gets the parsed head content of this section.

Returns:
The parsed head content of this section.

getTailContent

public StringBuilder getTailContent()
Gets the parsed tail content of this section.

Returns:
The parsed tail content of this section.

getSections

public List<Section> getSections()
Gets all sections recursively.

Returns:
A list of all sections collected recursively.

getLevel

int getLevel()
Gets the level of the section.

Returns:
The level of the section.

setLevel

void setLevel(int value)
Sets the level of the section.

Parameters:
value - The new level of the section.

getMode

int getMode()
Gets the mode of the section.

Returns:
The mode of the section.

setMode

void setMode(int value)
Sets the mode of the section.

Parameters:
value - The new mode of the section.

addContent

void addContent(String content)
Adds content to the section.

Parameters:
content - The content to add.
See Also:
getMode(), getLevel()

getChildren

List<Section> getChildren()
Gets the child sections of this section.

Returns:
The child sections of this section.

collectSections

private static List<Section> collectSections(Section section,
                                             List<Section> sections)
Collects sections recursively.

Parameters:
section - A section to collect child sections of.
sections - A list to add any child sections to.
Returns:
sections with any child sections of section added.


Copyright © 2005-2009 The JOMC Project. All Rights Reserved.