1 package be
.nikiroo
.fanfix
.data
;
3 import java
.util
.ArrayList
;
4 import java
.util
.Iterator
;
8 * A chapter in the story (or the resume/description).
12 public class Chapter
implements Iterable
<Paragraph
> {
15 private List
<Paragraph
> paragraphs
= new ArrayList
<Paragraph
>();
16 private List
<Paragraph
> empty
= new ArrayList
<Paragraph
>();
20 * Empty constructor, not to use.
22 @SuppressWarnings("unused")
24 // for serialisation purposes
28 * Create a new {@link Chapter} with the given information.
31 * the chapter number, or 0 for the description/resume.
35 public Chapter(int number
, String name
) {
45 public String
getName() {
55 public void setName(String name
) {
60 * The chapter number, or 0 for the description/resume.
64 public int getNumber() {
69 * The chapter number, or 0 for the description/resume.
74 public void setNumber(int number
) {
79 * The included paragraphs.
81 * @return the paragraphs
83 public List
<Paragraph
> getParagraphs() {
88 * The included paragraphs.
91 * the paragraphs to set
93 public void setParagraphs(List
<Paragraph
> paragraphs
) {
94 this.paragraphs
= paragraphs
;
98 * Get an iterator on the {@link Paragraph}s.
101 public Iterator
<Paragraph
> iterator() {
102 return paragraphs
== null ? empty
.iterator() : paragraphs
.iterator();
106 * The number of words (or images) in this {@link Chapter}.
108 * @return the number of words
110 public long getWords() {
115 * The number of words (or images) in this {@link Chapter}.
118 * the number of words to set
120 public void setWords(long words
) {
125 * Display a DEBUG {@link String} representation of this object.
128 public String
toString() {
129 return "Chapter " + number
+ ": " + name
;