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.
23 // for serialisation purposes
27 * Create a new {@link Chapter} with the given information.
30 * the chapter number, or 0 for the description/resume.
34 public Chapter(int number
, String name
) {
44 public String
getName() {
54 public void setName(String name
) {
59 * The chapter number, or 0 for the description/resume.
63 public int getNumber() {
68 * The chapter number, or 0 for the description/resume.
73 public void setNumber(int number
) {
78 * The included paragraphs.
80 * @return the paragraphs
82 public List
<Paragraph
> getParagraphs() {
87 * The included paragraphs.
90 * the paragraphs to set
92 public void setParagraphs(List
<Paragraph
> paragraphs
) {
93 this.paragraphs
= paragraphs
;
97 * Get an iterator on the {@link Paragraph}s.
99 public Iterator
<Paragraph
> iterator() {
100 return paragraphs
== null ? empty
.iterator() : paragraphs
.iterator();
104 * The number of words in this {@link Chapter}.
106 * @return the number of words
108 public long getWords() {
113 * The number of words in this {@link Chapter}.
116 * the number of words to set
118 public void setWords(long words
) {
123 * Display a DEBUG {@link String} representation of this object.
126 public String
toString() {
127 return "Chapter " + number
+ ": " + name
;