1 /***
2 * Book.java
3 *
4 * $Author: mballesteros $ $Date: 2003/11/28 19:18:03 $ $Revision: 1.1 $
5 */
6 package net.sf.jec;
7
8 /***
9 * @author mballesteros
10 */
11 public class Book {
12
13 /*** Holds value of property name. */
14 protected String name;
15
16 /*** Holds value of property creationDate. */
17 protected java.util.Date creationDate;
18
19 /*** Holds value of property pages. */
20 protected java.util.List pages;
21
22 /*** Holds value of property value. */
23 protected double value;
24
25 protected boolean original;
26
27 public String toString() {
28 return "\n---------------------\n"
29 + name
30 + (original ? " (ORIGINAL)" : " (COPY) ")
31 + ", "
32 + creationDate
33 + "\n---------------------\n"
34 + pages;
35 }
36
37 /*** Creates a new instance of Book */
38 public Book(String name) {
39 this.name = name;
40 this.creationDate = new java.util.Date();
41 this.pages = new java.util.ArrayList();
42 }
43
44 /***
45 * Getter for property name.
46 *
47 * @return Value of property name.
48 */
49 public String getName() {
50 return this.name;
51 }
52
53 /***
54 * Setter for property name.
55 *
56 * @param name
57 * New value of property name.
58 */
59 public void setName(String name) {
60 this.name = name;
61 }
62
63 /***
64 * Getter for property creationDate.
65 *
66 * @return Value of property creationDate.
67 */
68 public java.util.Date getCreationDate() {
69 return this.creationDate;
70 }
71
72 /***
73 * Setter for property creationDate.
74 *
75 * @param creationDate
76 * New value of property creationDate.
77 */
78 public void setCreationDate(java.util.Date creationDate) {
79 this.creationDate = creationDate;
80 }
81
82 /***
83 * Getter for property pages.
84 *
85 * @return Value of property pages.
86 */
87 public java.util.List getPages() {
88 return this.pages;
89 }
90
91 public Page newPage() {
92 Page page = new Page(this);
93 this.pages.add(page);
94 return page;
95 }
96
97 /***
98 * Getter for property value.
99 *
100 * @return Value of property value.
101 */
102 public double getValue() {
103 return this.value;
104 }
105
106 /***
107 * Setter for property value.
108 *
109 * @param value
110 * New value of property value.
111 */
112 public void setValue(double value) {
113 this.value = value;
114 }
115
116 /***
117 * Getter for property original.
118 *
119 * @return Value of property original.
120 */
121 public boolean isOriginal() {
122 return original;
123 }
124
125 /***
126 * Setter for property original.
127 *
128 * @param original
129 * New value of property original.
130 */
131 public void setOriginal(boolean original) {
132 this.original = original;
133 }
134
135 public static Book getExample() {
136 Page page;
137
138 Book book = new Book("El Quijote");
139
140 page = book.newPage();
141 page.newParagraph("En un lugar de la mancha");
142 page.newParagraph("de cuyo nombre no quiero acordarme");
143 page.newParagraph("vivía un hidalgo caballero");
144
145 page = book.newPage();
146 page.newParagraph("de nombre Don Quijote.");
147
148 page = book.newPage();
149 page.newParagraph("Don Quijote amaba a Dulcinea,");
150 page.newParagraph("la más bella entre las mujeres del Toboso");
151
152 return book;
153 }
154 }
This page was automatically generated by Maven