Source code: com/eireneh/bible/book/BasicVersion.java
1
2 package com.eireneh.bible.book;
3
4 import java.util.Date;
5 import java.net.URL;
6
7 import com.eireneh.util.StringUtil;
8
9 /**
10 * BasicVersion is the default and probably only implementation of the
11 * Version interface.
12 *
13 * <table border='1' cellPadding='3' cellSpacing='0' width="100%">
14 * <tr><td bgColor='white'class='TableRowColor'><font size='-7'>
15 * Distribution Licence:<br />
16 * Project B is free software; you can redistribute it
17 * and/or modify it under the terms of the GNU General Public License,
18 * version 2 as published by the Free Software Foundation.<br />
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * General Public License for more details.<br />
23 * The License is available on the internet
24 * <a href='http://www.gnu.org/copyleft/gpl.html'>here</a>, by writing to
25 * <i>Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
26 * MA 02111-1307, USA</i>, Or locally at the Licence link below.<br />
27 * The copyright to this program is held by it's authors.
28 * </font></td></tr></table>
29 * @see <a href='http://www.eireneh.com/servlets/Web'>Project B Home</a>
30 * @see docs.Licence
31 * @author Joe Walker
32 * @version D0.I0.T0
33 */
34 public class BasicVersion extends Version
35 {
36 /**
37 * Basic constructor
38 */
39 protected BasicVersion(String name, String edition, String initials, Date pub, int open, URL licence)
40 {
41 this.name = name;
42 this.edition = edition;
43 this.pub = pub;
44 this.open = open;
45 this.licence = licence;
46
47 if (initials == null || initials.trim().length() == 0)
48 this.initials = StringUtil.getInitials(name);
49 else
50 this.initials = initials;
51 }
52
53 /**
54 * The name of the version, for example "King James Version" or
55 * "Bible in Basic English" or "Greek". In general it should be
56 * possible to deduce the initials from the name by removing all the
57 * non-capital letters.
58 * @return The name of this version
59 */
60 public String getName()
61 {
62 return name;
63 }
64
65 /**
66 * The edition of this version, for example "Anglicised" (NIV),
67 * "Stephanus" (Greek). For 2 versions to be equal both the name and
68 * the edition must be equal.
69 */
70 public String getEdition()
71 {
72 return edition;
73 }
74
75 /**
76 * The initials of the version - how most people will know it, for
77 * example "NIV", "KJV"
78 * @return The versions initials
79 */
80 public String getInitials()
81 {
82 return initials;
83 }
84
85 /**
86 * The date of first publishing. This does not need to be accurate and
87 * 2 versions can be considered equal even if they have different
88 * first publishing dates for that reason. In general "1 Jan 1970"
89 * means published in 1970, and so on.
90 * @return The date of first publishing
91 */
92 public Date getFirstPublished()
93 {
94 return pub;
95 }
96
97 /**
98 * Is this version sold for commercial profit like the NIV, or kept
99 * open like the NET version.
100 * @return A STATUS_* constant
101 */
102 public int getOpenness()
103 {
104 return open;
105 }
106
107 /**
108 * Not sure about this one - Do we need a way of getting at the dist.
109 * licence? Are we going to be able to tie it down to a single Version
110 * policy like this?
111 * @return String detailing the users right to distribute this version
112 */
113 public URL getLicence()
114 {
115 return licence;
116 }
117
118 /** The name of the version */
119 private String name;
120
121 /** The edition of this version */
122 private String edition;
123
124 /** The common initials of the version name */
125 private String initials;
126
127 /** The approximate date of first publishing */
128 private Date pub;
129
130 /** The openness of the version */
131 private int open;
132
133 /** The URL of the distribution licence */
134 private URL licence;
135 }