1 |
/* Created or Modified by J.M. Kruithof jmkf@users.sourceforge.net (c) 2002,
|
2 |
* This software may be based in whole, in part or not at all on software
|
3 |
* contributed to the Apache Software Foundation. It is licensed under exact
|
4 |
* the same license.
|
5 |
* The Apache Software foundation may or may not consider this software
|
6 |
* a voluntary contribution. This is at the opinion of the Apache Software
|
7 |
* foundation.
|
8 |
*
|
9 |
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
10 |
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
11 |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
12 |
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS OF THIS SOFTWARE
|
13 |
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
14 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
15 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
16 |
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
17 |
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
18 |
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
19 |
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
20 |
* SUCH DAMAGE.
|
21 |
*
|
22 |
* Licensed under the following conditions:
|
23 |
*/
|
24 |
/*
|
25 |
* The Apache Software License, Version 1.1
|
26 |
*
|
27 |
* Copyright (c) 2000 The Apache Software Foundation. All rights
|
28 |
* reserved.
|
29 |
*
|
30 |
* Redistribution and use in source and binary forms, with or without
|
31 |
* modification, are permitted provided that the following conditions
|
32 |
* are met:
|
33 |
*
|
34 |
* 1. Redistributions of source code must retain the above copyright
|
35 |
* notice, this list of conditions and the following disclaimer.
|
36 |
*
|
37 |
* 2. Redistributions in binary form must reproduce the above copyright
|
38 |
* notice, this list of conditions and the following disclaimer in
|
39 |
* the documentation and/or other materials provided with the
|
40 |
* distribution.
|
41 |
*
|
42 |
* 3. The end-user documentation included with the redistribution, if
|
43 |
* any, must include the following acknowlegement:
|
44 |
* "This product includes software developed by the
|
45 |
* Apache Software Foundation (http://www.apache.org/)."
|
46 |
* Alternately, this acknowlegement may appear in the software itself,
|
47 |
* if and wherever such third-party acknowlegements normally appear.
|
48 |
*
|
49 |
* 4. The names "The Jakarta Project", "Ant", and "Apache Software
|
50 |
* Foundation" must not be used to endorse or promote products derived
|
51 |
* from this software without prior written permission. For written
|
52 |
* permission, please contact apache@apache.org.
|
53 |
*
|
54 |
* 5. Products derived from this software may not be called "Apache"
|
55 |
* nor may "Apache" appear in their names without prior written
|
56 |
* permission of the Apache Group.
|
57 |
*
|
58 |
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
59 |
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
60 |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
61 |
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
62 |
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
63 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
64 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
65 |
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
66 |
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
67 |
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
68 |
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
69 |
* SUCH DAMAGE.
|
70 |
* ====================================================================
|
71 |
*
|
72 |
* This software consists of voluntary contributions made by many
|
73 |
* individuals on behalf of the Apache Software Foundation. For more
|
74 |
* information on the Apache Software Foundation, please see
|
75 |
* <http://www.apache.org/>.
|
76 |
*/
|
77 |
|
78 |
import sampleproject.util.UniqueString;
|
79 |
/**
|
80 |
*
|
81 |
* @author jkf
|
82 |
* @version
|
83 |
*/
|
84 |
public class Coin2 implements java.io.Serializable {
|
85 |
|
86 |
UniqueString myCountry;
|
87 |
|
88 |
UniqueString myDenomination;
|
89 |
|
90 |
int myYear;
|
91 |
|
92 |
UniqueString mySubType;
|
93 |
|
94 |
java.net.URL myImageLocation;
|
95 |
|
96 |
/**
|
97 |
* Creates new Coin2
|
98 |
* @param country Country for this coin.
|
99 |
* @param denomination Value of this coin.
|
100 |
* @param year The year of issue.
|
101 |
* @param subType A subtype indicator.
|
102 |
* @param imageLocation The location of an image of this coin.
|
103 |
*/
|
104 |
public Coin2(UniqueString country, UniqueString denomination, int year,
|
105 |
UniqueString subType, java.net.URL imageLocation)
|
106 |
{
|
107 |
myCountry = country;
|
108 |
myDenomination = denomination;
|
109 |
myYear = year;
|
110 |
mySubType = subType;
|
111 |
myImageLocation = imageLocation;
|
112 |
}
|
113 |
|
114 |
public boolean equals(java.lang.Object obj)
|
115 |
{
|
116 |
boolean retval = false;
|
117 |
|
118 |
if (obj instanceof Coin2) {
|
119 |
|
120 |
Coin2 coin = (Coin2) obj;
|
121 |
|
122 |
if (coin.myCountry == myCountry &&
|
123 |
coin.myDenomination == myDenomination &&
|
124 |
coin.myYear == myYear &&
|
125 |
coin.mySubType == mySubType)
|
126 |
{
|
127 |
retval = true;
|
128 |
}
|
129 |
|
130 |
}
|
131 |
|
132 |
return retval;
|
133 |
|
134 |
}
|
135 |
|
136 |
public int hashCode() {
|
137 |
|
138 |
int result = myYear;
|
139 |
|
140 |
if(myCountry != null)
|
141 |
{
|
142 |
result += myCountry.hashCode();
|
143 |
}
|
144 |
|
145 |
if(myDenomination != null)
|
146 |
{
|
147 |
result += myDenomination.hashCode();
|
148 |
}
|
149 |
|
150 |
if(mySubType != null)
|
151 |
{
|
152 |
result += mySubType.hashCode();
|
153 |
}
|
154 |
|
155 |
return result;
|
156 |
|
157 |
}
|
158 |
|
159 |
public java.lang.String toString() {
|
160 |
return "<Coin2=" + myCountry.toString() + "," +
|
161 |
myDenomination.toString() + "," + myYear + "," + mySubType + "/>";
|
162 |
}
|
163 |
|
164 |
public java.net.URL getImageURL() {
|
165 |
return myImageLocation;
|
166 |
}
|
167 |
|
168 |
public UniqueString getCountry() {
|
169 |
return myCountry;
|
170 |
}
|
171 |
|
172 |
public UniqueString getDenomination() {
|
173 |
return myDenomination;
|
174 |
}
|
175 |
|
176 |
public int getYear() {
|
177 |
return myYear;
|
178 |
}
|
179 |
|
180 |
public UniqueString getSubType() {
|
181 |
return mySubType;
|
182 |
}
|
183 |
|
184 |
}
|