Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
DocumentTOC |
|
| 2.090909090909091;2,091 |
1 | /* | |
2 | =================== DO NOT EDIT THIS FILE ==================== | |
3 | Generated by Modello 1.4.1 on 2012-04-13 21:33:05, | |
4 | any modifications will be overwritten. | |
5 | ============================================================== | |
6 | */ | |
7 | ||
8 | package org.apache.maven.doxia.document; | |
9 | ||
10 | /** | |
11 | * A Table Of Content for the document. | |
12 | * | |
13 | * @version $Revision$ $Date$ | |
14 | */ | |
15 | @SuppressWarnings( "all" ) | |
16 | 4 | public class DocumentTOC |
17 | implements java.io.Serializable | |
18 | { | |
19 | ||
20 | //--------------------------/ | |
21 | //- Class/Member Variables -/ | |
22 | //--------------------------/ | |
23 | ||
24 | /** | |
25 | * | |
26 | * The name to use for the Table of Contents. | |
27 | * | |
28 | */ | |
29 | private String name; | |
30 | ||
31 | /** | |
32 | * | |
33 | * The level up to which toc items are included by | |
34 | * default. | |
35 | * Defaults to 0 which means only top-level element | |
36 | * entries are included. | |
37 | * A depth of 1 includes one level of sub-items | |
38 | * (sub-sections), etc. | |
39 | * This may be overridden for individual entries by | |
40 | * using the collapse | |
41 | * attribute of the corresponding toc item. | |
42 | * | |
43 | */ | |
44 | 4 | private int depth = 0; |
45 | ||
46 | /** | |
47 | * Field items. | |
48 | */ | |
49 | private java.util.List<DocumentTOCItem> items; | |
50 | ||
51 | ||
52 | //-----------/ | |
53 | //- Methods -/ | |
54 | //-----------/ | |
55 | ||
56 | /** | |
57 | * Method addItem. | |
58 | * | |
59 | * @param documentTOCItem | |
60 | */ | |
61 | public void addItem( DocumentTOCItem documentTOCItem ) | |
62 | { | |
63 | 4 | getItems().add( documentTOCItem ); |
64 | 4 | } //-- void addItem( DocumentTOCItem ) |
65 | ||
66 | /** | |
67 | * Method equals. | |
68 | * | |
69 | * @param other | |
70 | * @return boolean | |
71 | */ | |
72 | public boolean equals( Object other ) | |
73 | { | |
74 | 2 | if ( this == other ) |
75 | { | |
76 | 0 | return true; |
77 | } | |
78 | ||
79 | 2 | if ( !( other instanceof DocumentTOC ) ) |
80 | { | |
81 | 0 | return false; |
82 | } | |
83 | ||
84 | 2 | DocumentTOC that = (DocumentTOC) other; |
85 | 2 | boolean result = true; |
86 | ||
87 | 2 | result = result && ( getName() == null ? that.getName() == null : getName().equals( that.getName() ) ); |
88 | 2 | result = result && depth == that.depth; |
89 | 2 | result = result && ( getItems() == null ? that.getItems() == null : getItems().equals( that.getItems() ) ); |
90 | ||
91 | 2 | return result; |
92 | } //-- boolean equals( Object ) | |
93 | ||
94 | /** | |
95 | * Get the level up to which toc items are included by default. | |
96 | * Defaults to 0 which means only top-level element | |
97 | * entries are included. | |
98 | * A depth of 1 includes one level of sub-items | |
99 | * (sub-sections), etc. | |
100 | * This may be overridden for individual entries by | |
101 | * using the collapse | |
102 | * attribute of the corresponding toc item. | |
103 | * | |
104 | * @return int | |
105 | */ | |
106 | public int getDepth() | |
107 | { | |
108 | 6 | return this.depth; |
109 | } //-- int getDepth() | |
110 | ||
111 | /** | |
112 | * Method getItems. | |
113 | * | |
114 | * @return List | |
115 | */ | |
116 | public java.util.List<DocumentTOCItem> getItems() | |
117 | { | |
118 | 24 | if ( this.items == null ) |
119 | { | |
120 | 4 | this.items = new java.util.ArrayList<DocumentTOCItem>(); |
121 | } | |
122 | ||
123 | 24 | return this.items; |
124 | } //-- java.util.List<DocumentTOCItem> getItems() | |
125 | ||
126 | /** | |
127 | * Get the name to use for the Table of Contents. | |
128 | * | |
129 | * @return String | |
130 | */ | |
131 | public String getName() | |
132 | { | |
133 | 18 | return this.name; |
134 | } //-- String getName() | |
135 | ||
136 | /** | |
137 | * Method hashCode. | |
138 | * | |
139 | * @return int | |
140 | */ | |
141 | public int hashCode() | |
142 | { | |
143 | 4 | int result = 17; |
144 | ||
145 | 4 | result = 37 * result + ( name != null ? name.hashCode() : 0 ); |
146 | 4 | result = 37 * result + (int) depth; |
147 | 4 | result = 37 * result + ( items != null ? items.hashCode() : 0 ); |
148 | ||
149 | 4 | return result; |
150 | } //-- int hashCode() | |
151 | ||
152 | /** | |
153 | * Method removeItem. | |
154 | * | |
155 | * @param documentTOCItem | |
156 | */ | |
157 | public void removeItem( DocumentTOCItem documentTOCItem ) | |
158 | { | |
159 | 0 | getItems().remove( documentTOCItem ); |
160 | 0 | } //-- void removeItem( DocumentTOCItem ) |
161 | ||
162 | /** | |
163 | * Set the level up to which toc items are included by default. | |
164 | * Defaults to 0 which means only top-level element | |
165 | * entries are included. | |
166 | * A depth of 1 includes one level of sub-items | |
167 | * (sub-sections), etc. | |
168 | * This may be overridden for individual entries by | |
169 | * using the collapse | |
170 | * attribute of the corresponding toc item. | |
171 | * | |
172 | * @param depth | |
173 | */ | |
174 | public void setDepth( int depth ) | |
175 | { | |
176 | 0 | this.depth = depth; |
177 | 0 | } //-- void setDepth( int ) |
178 | ||
179 | /** | |
180 | * Set tOC item. | |
181 | * | |
182 | * @param items | |
183 | */ | |
184 | public void setItems( java.util.List<DocumentTOCItem> items ) | |
185 | { | |
186 | 0 | this.items = items; |
187 | 0 | } //-- void setItems( java.util.List ) |
188 | ||
189 | /** | |
190 | * Set the name to use for the Table of Contents. | |
191 | * | |
192 | * @param name | |
193 | */ | |
194 | public void setName( String name ) | |
195 | { | |
196 | 4 | this.name = name; |
197 | 4 | } //-- void setName( String ) |
198 | ||
199 | /** | |
200 | * Method toString. | |
201 | * | |
202 | * @return String | |
203 | */ | |
204 | public java.lang.String toString() | |
205 | { | |
206 | 4 | StringBuilder buf = new StringBuilder( 128 ); |
207 | ||
208 | 4 | buf.append( "name = '" ); |
209 | 4 | buf.append( getName() ); |
210 | 4 | buf.append( "'" ); |
211 | 4 | buf.append( "\n" ); |
212 | 4 | buf.append( "depth = '" ); |
213 | 4 | buf.append( getDepth() ); |
214 | 4 | buf.append( "'" ); |
215 | 4 | buf.append( "\n" ); |
216 | 4 | buf.append( "items = '" ); |
217 | 4 | buf.append( getItems() ); |
218 | 4 | buf.append( "'" ); |
219 | ||
220 | 4 | return buf.toString(); |
221 | } //-- java.lang.String toString() | |
222 | ||
223 | } |