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
>();
19 * Create a new {@link Chapter} with the given information.
22 * the chapter number, or 0 for the description/resume.
26 public Chapter(int number
, String name
) {
36 public String
getName() {
46 public void setName(String name
) {
51 * The chapter number, or 0 for the description/resume.
55 public int getNumber() {
60 * The chapter number, or 0 for the description/resume.
65 public void setNumber(int number
) {
70 * The included paragraphs.
72 * @return the paragraphs
74 public List
<Paragraph
> getParagraphs() {
79 * The included paragraphs.
82 * the paragraphs to set
84 public void setParagraphs(List
<Paragraph
> paragraphs
) {
85 this.paragraphs
= paragraphs
;
89 * Get an iterator on the {@link Paragraph}s.
91 public Iterator
<Paragraph
> iterator() {
92 return paragraphs
== null ? empty
.iterator() : paragraphs
.iterator();
96 * Display a DEBUG {@link String} representation of this object.
99 public String
toString() {
100 return "Chapter " + number
+ ": " + name
;