Coverage Test Results


Class sampleproject.coins.Coin

NameProbesExecutedCoverage
Coin1313100.00%

Methods

NameProbesExecutedCoverage
<init>(Lsampleproject/util/UniqueString;Lsampleproject/util/UniqueString;ILsampleproject/util/UniqueString;Ljava/net/URL;)V11100.00%
equals(Ljava/lang/Object;)Z22100.00%
hashCode()I44100.00%
toString()Ljava/lang/String;11100.00%
getImageURL()Ljava/net/URL;11100.00%
getCountry()Lsampleproject/util/UniqueString;11100.00%
getDenomination()Lsampleproject/util/UniqueString;11100.00%
getYear()I11100.00%
getSubType()Lsampleproject/util/UniqueString;11100.00%

Source

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
package sampleproject.coins;
79

80
import sampleproject.util.UniqueString;
81
/**
82
 *
83
 * @author  jkf
84
 * @version 
85
 */
86
public class Coin implements java.io.Serializable {
87

88
    UniqueString myCountry;
89
    
90
    UniqueString myDenomination;
91
    
92
    int myYear;
93
    
94
    UniqueString mySubType;
95
    
96
    java.net.URL myImageLocation;
97
    
98
    /** 
99
     * Creates new Coin 
100
     * @param country Country for this coin.
101
     * @param denomination Value of this coin.
102
     * @param year The year of issue.
103
     * @param subType A subtype indicator.
104
     * @param imageLocation The location of an image of this coin.
105
     */
106
    public Coin(UniqueString country, UniqueString denomination, int year, 
107
                UniqueString subType, java.net.URL imageLocation)
108
    {
109
        myCountry = country;
110
        myDenomination = denomination;
111
        myYear = year;
112
        mySubType = subType;
113
        myImageLocation = imageLocation;
114
    }
115

116
    public boolean equals(java.lang.Object obj) 
117
    {
118
        boolean retval = false;
119
        
120
        if (obj instanceof Coin) {
121
            
122
            Coin coin = (Coin) obj;
123
            
124
            if (coin.myCountry == myCountry &&
125
                coin.myDenomination == myDenomination &&
126
                coin.myYear == myYear &&
127
                coin.mySubType == mySubType)
128
            {
129
                retval = true;
130
            } 
131
            
132
        }
133
        
134
        return retval;
135
        
136
    }
137
    
138
    public int hashCode() {
139
        
140
        int result = myYear;
141
        
142
        if(myCountry != null) 
143
        {
144
            result += myCountry.hashCode();
145
        }
146
        
147
        if(myDenomination != null) 
148
        {
149
            result += myDenomination.hashCode();
150
        }
151
        
152
        if(mySubType != null) 
153
        {
154
            result += mySubType.hashCode();
155
        }
156
        
157
        return result;
158
        
159
    }
160
    
161
    public java.lang.String toString() {
162
        return "<Coin=" + myCountry.toString() + "," + 
163
               myDenomination.toString() + "," + myYear + "," + mySubType + "/>";
164
    }
165
    
166
    public java.net.URL getImageURL() {
167
        return myImageLocation;
168
    }
169
    
170
    public UniqueString getCountry() {
171
        return myCountry;
172
    }
173
    
174
    public UniqueString getDenomination() {
175
        return myDenomination;
176
    }
177
    
178
    public int getYear() {
179
        return myYear;
180
    }
181
    
182
    public UniqueString getSubType() {
183
        return mySubType;
184
    }
185
    
186
}