7d0a51b306b62bfc7f821065a0c10e358be82075
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 * Create a new {@link Chapter} with the given information.
23 * the chapter number, or 0 for the description/resume.
27 public Chapter(int number
, String name
) {
37 public String
getName() {
47 public void setName(String name
) {
52 * The chapter number, or 0 for the description/resume.
56 public int getNumber() {
61 * The chapter number, or 0 for the description/resume.
66 public void setNumber(int number
) {
71 * The included paragraphs.
73 * @return the paragraphs
75 public List
<Paragraph
> getParagraphs() {
80 * The included paragraphs.
83 * the paragraphs to set
85 public void setParagraphs(List
<Paragraph
> paragraphs
) {
86 this.paragraphs
= paragraphs
;
90 * Get an iterator on the {@link Paragraph}s.
92 public Iterator
<Paragraph
> iterator() {
93 return paragraphs
== null ? empty
.iterator() : paragraphs
.iterator();
97 * The number of words in this {@link Chapter}.
99 * @return the number of words
101 public long getWords() {
106 * The number of words in this {@link Chapter}.
109 * the number of words to set
111 public void setWords(long words
) {
116 * Display a DEBUG {@link String} representation of this object.
119 public String
toString() {
120 return "Chapter " + number
+ ": " + name
;