EMMA Coverage Report (generated Tue Jan 19 17:53:40 UTC 2010)
[all classes][org.jomc.util]

COVERAGE SUMMARY FOR SOURCE FILE [Section.java]

nameclass, %method, %block, %line, %
Section.java100% (1/1)100% (12/12)100% (67/67)100% (24/24)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Section100% (1/1)100% (12/12)100% (67/67)100% (24/24)
Section (): void 100% (1/1)100% (6/6)100% (3/3)
getEndingLine (): String 100% (1/1)100% (3/3)100% (1/1)
getHeadContent (): StringBuilder 100% (1/1)100% (11/11)100% (3/3)
getMode (): int 100% (1/1)100% (3/3)100% (1/1)
getName (): String 100% (1/1)100% (3/3)100% (1/1)
getSections (): List 100% (1/1)100% (11/11)100% (3/3)
getStartingLine (): String 100% (1/1)100% (3/3)100% (1/1)
getTailContent (): StringBuilder 100% (1/1)100% (11/11)100% (3/3)
setEndingLine (String): void 100% (1/1)100% (4/4)100% (2/2)
setMode (int): void 100% (1/1)100% (4/4)100% (2/2)
setName (String): void 100% (1/1)100% (4/4)100% (2/2)
setStartingLine (String): void 100% (1/1)100% (4/4)100% (2/2)

1/*
2 *   Copyright (c) 2009 The JOMC Project
3 *   Copyright (c) 2005 Christian Schulte <cs@jomc.org>
4 *   All rights reserved.
5 *
6 *   Redistribution and use in source and binary forms, with or without
7 *   modification, are permitted provided that the following conditions
8 *   are met:
9 *
10 *     o Redistributions of source code must retain the above copyright
11 *       notice, this list of conditions and the following disclaimer.
12 *
13 *     o Redistributions in binary form must reproduce the above copyright
14 *       notice, this list of conditions and the following disclaimer in
15 *       the documentation and/or other materials provided with the
16 *       distribution.
17 *
18 *   THIS SOFTWARE IS PROVIDED BY THE JOMC PROJECT AND CONTRIBUTORS "AS IS"
19 *   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20 *   THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 *   PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE JOMC PROJECT OR
22 *   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 *   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 *   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 *   OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 *   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 *   ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 *   $Id: Section.java 891 2009-11-02 03:40:00Z schulte2005 $
31 *
32 */
33package org.jomc.util;
34 
35import java.util.ArrayList;
36import java.util.List;
37 
38/**
39 * Section of text.
40 *
41 * @author <a href="mailto:cs@jomc.org">Christian Schulte</a>
42 * @version $Id: Section.java 891 2009-11-02 03:40:00Z schulte2005 $
43 */
44public class Section
45{
46 
47    /** Constant for the mode during parsing the head content of a section. */
48    static final int MODE_HEAD = 1;
49 
50    /** Constant for the mode during parsing the tail content of a section. */
51    static final int MODE_TAIL = 2;
52 
53    /** The current parsing mode. */
54    private int mode = MODE_HEAD;
55 
56    /** The name of this section. */
57    private String name;
58 
59    /** The parsed head content of this section. */
60    private StringBuilder headContent;
61 
62    /** The parsed tail content of this section. */
63    private StringBuilder tailContent;
64 
65    /** Line marking the start of this section. */
66    private String startingLine;
67 
68    /** Line marking the end of this section. */
69    private String endingLine;
70 
71    /** The child sections of this section. */
72    private List<Section> sections;
73 
74    /** Creates a new {@code Section} instance. */
75    public Section()
76    {
77        super();
78    }
79 
80    /**
81     * Gets the name of this section.
82     *
83     * @return The name of this section or {@code null}.
84     */
85    public String getName()
86    {
87        return this.name;
88    }
89 
90    /**
91     * Sets the name of this section.
92     *
93     * @param value The new name of this section or {@code null}.
94     */
95    public void setName( final String value )
96    {
97        this.name = value;
98    }
99 
100    /**
101     * Gets the line marking the start of this section.
102     *
103     * @return The line marking the start of this section.
104     */
105    public String getStartingLine()
106    {
107        return this.startingLine;
108    }
109 
110    /**
111     * Sets the line marking the start of this section.
112     *
113     * @param value The new line marking the start of this section.
114     */
115    public void setStartingLine( final String value )
116    {
117        this.startingLine = value;
118    }
119 
120    /**
121     * Gets the line marking the end of this section.
122     *
123     * @return The line marking the end of this section.
124     */
125    public String getEndingLine()
126    {
127        return this.endingLine;
128    }
129 
130    /**
131     * Sets the line marking the end of this section.
132     *
133     * @param value The new line marking the end of this section.
134     */
135    public void setEndingLine( final String value )
136    {
137        this.endingLine = value;
138    }
139 
140    /**
141     * Gets the content of this section preceding any child section content.
142     *
143     * @return The content of this section preceding any child section content.
144     */
145    public StringBuilder getHeadContent()
146    {
147        if ( this.headContent == null )
148        {
149            this.headContent = new StringBuilder();
150        }
151 
152        return this.headContent;
153    }
154 
155    /**
156     * Gets the content of this section succeeding any child section content.
157     *
158     * @return The content of this section succeeding any child section content.
159     */
160    public StringBuilder getTailContent()
161    {
162        if ( this.tailContent == null )
163        {
164            this.tailContent = new StringBuilder();
165        }
166 
167        return this.tailContent;
168    }
169 
170    /**
171     * Gets the child sections of this section.
172     *
173     * @return A list of child sections of this section.
174     */
175    public List<Section> getSections()
176    {
177        if ( this.sections == null )
178        {
179            this.sections = new ArrayList<Section>();
180        }
181 
182        return this.sections;
183    }
184 
185    /**
186     * Gets the parsing mode of the instance.
187     *
188     * @return The parsing mode of the instance.
189     *
190     * @see #MODE_HEAD
191     * @see #MODE_TAIL
192     */
193    int getMode()
194    {
195        return this.mode;
196    }
197 
198    /**
199     * Sets the parsing mode of the instance.
200     *
201     * @param value The new parsing mode of the instance.
202     *
203     * @see #MODE_HEAD
204     * @see #MODE_TAIL
205     */
206    void setMode( final int value )
207    {
208        this.mode = value;
209    }
210 
211}

[all classes][org.jomc.util]
EMMA 2.0.5312 (C) Vladimir Roubtsov