| 1 | /* |
| 2 | * JTiger Unit Testing Framework for J2SE 1.5 |
| 3 | * Copyright (C) 2005 Tony Morris |
| 4 | * |
| 5 | * This software is licenced under the |
| 6 | * Common Public Licence version 1.0 |
| 7 | * http://www.opensource.org/licenses/cpl1.0.php |
| 8 | * |
| 9 | * You received a copy of this licence with this software. |
| 10 | */ |
| 11 | package org.jtiger.report.html; |
| 12 | |
| 13 | /** |
| 14 | * A bean that is used by {@link org.jtiger.report.html.HtmlFixtureResultsHandler the HTML result handler} to produce a report. |
| 15 | * |
| 16 | * @author %javadoc.author.tag% |
| 17 | * @version %version%<br/> |
| 18 | * <i>Build Number %build.number%</i><br/> |
| 19 | * <i>Build Time %build.time% CET (GMT + 1)</i> |
| 20 | */ |
| 21 | public final class OverallResultBeanImpl implements OverallResultBean |
| 22 | { |
| 23 | private static final long serialVersionUID = 2L; |
| 24 | |
| 25 | private String name; |
| 26 | private String href; |
| 27 | private String description; |
| 28 | private String elapsedTime; |
| 29 | private String result; |
| 30 | |
| 31 | /** |
| 32 | * Create a default <tt>OverallResultBeanImpl</tt>. |
| 33 | */ |
| 34 | public OverallResultBeanImpl() |
| 35 | { |
| 36 | |
| 37 | } |
| 38 | |
| 39 | OverallResultBeanImpl(final String name, final String href, final String description, final String elapsedTime, final String result) |
| 40 | { |
| 41 | this.name = name; |
| 42 | this.href = href; |
| 43 | this.description = description; |
| 44 | this.elapsedTime = elapsedTime; |
| 45 | this.result = result; |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Returns the name property of the bean. |
| 50 | * |
| 51 | * @return The name property of the bean. |
| 52 | */ |
| 53 | public String getName() |
| 54 | { |
| 55 | return name; |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Sets the name property of the bean. |
| 60 | * |
| 61 | * @param name The name property of the bean. |
| 62 | */ |
| 63 | public void setName(final String name) |
| 64 | { |
| 65 | this.name = name; |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Returns the href property of the bean. |
| 70 | * |
| 71 | * @return The href property of the bean. |
| 72 | */ |
| 73 | public String getHref() |
| 74 | { |
| 75 | return href; |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * Sets the href property of the bean. |
| 80 | * |
| 81 | * @param href The href property of the bean. |
| 82 | */ |
| 83 | public void setHref(final String href) |
| 84 | { |
| 85 | this.href = href; |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * Returns the href property of the bean. |
| 90 | * |
| 91 | * @return The href property of the bean. |
| 92 | */ |
| 93 | public String getDescription() |
| 94 | { |
| 95 | return description; |
| 96 | } |
| 97 | |
| 98 | /** |
| 99 | * Sets the description property of the bean. |
| 100 | * |
| 101 | * @param description The description property of the bean. |
| 102 | */ |
| 103 | public void setDescription(final String description) |
| 104 | { |
| 105 | this.description = description; |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * Returns the description property of the bean. |
| 110 | * |
| 111 | * @return The description property of the bean. |
| 112 | */ |
| 113 | public String getElapsedTime() |
| 114 | { |
| 115 | return elapsedTime; |
| 116 | } |
| 117 | |
| 118 | /** |
| 119 | * Sets the elapsedTime property of the bean. |
| 120 | * |
| 121 | * @param elapsedTime The elapsedTime property of the bean. |
| 122 | */ |
| 123 | public void setElapsedTime(final String elapsedTime) |
| 124 | { |
| 125 | this.elapsedTime = elapsedTime; |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * Returns the result property of the bean. |
| 130 | * |
| 131 | * @return The result property of the bean. |
| 132 | */ |
| 133 | public String getResult() |
| 134 | { |
| 135 | return result; |
| 136 | } |
| 137 | |
| 138 | /** |
| 139 | * Sets the result property of the bean. |
| 140 | * |
| 141 | * @param result The elapsedTime property of the bean. |
| 142 | */ |
| 143 | public void setResult(final String result) |
| 144 | { |
| 145 | this.result = result; |
| 146 | } |
| 147 | |
| 148 | /** |
| 149 | * Returns a <a href="%j2se.api.spec%/java/lang/String.html">java.lang.String</a> representation of the bean, which |
| 150 | * consists of the name property, the href property, the description property, the elapsedTime property, and the |
| 151 | * result property. |
| 152 | * |
| 153 | * @return A <a href="%j2se.api.spec%/java/lang/String.html">java.lang.String</a> representation of the bean, which |
| 154 | * consists of the name property, the href property, the description property, the elapsedTime property, and the |
| 155 | * result property. |
| 156 | */ |
| 157 | @Override |
| 158 | public String toString() |
| 159 | { |
| 160 | final StringBuilder sb = new StringBuilder(); |
| 161 | |
| 162 | sb.append('['); |
| 163 | sb.append(name); |
| 164 | sb.append("]["); |
| 165 | sb.append(href); |
| 166 | sb.append("]["); |
| 167 | sb.append(description); |
| 168 | sb.append("]["); |
| 169 | sb.append(elapsedTime); |
| 170 | sb.append("]["); |
| 171 | sb.append(result); |
| 172 | sb.append(']'); |
| 173 | |
| 174 | return sb.toString(); |
| 175 | } |
| 176 | |
| 177 | /** |
| 178 | * Compares two instance of <tt>OverallResultBeanImpl</tt> returning <code>true</code> iff the name, href, description, |
| 179 | * elapsedTime, and result properties are equal, <code>false</code> otherwise. |
| 180 | * |
| 181 | * @param o An instance of <tt>OverallResultBeanImpl</tt> to compare for equality. |
| 182 | * @return <code>true</code> iff the name, href, description, elapsedTime, and result properties are equal, |
| 183 | * <code>false</code> otherwise. |
| 184 | */ |
| 185 | @Override |
| 186 | public boolean equals(final Object o) |
| 187 | { |
| 188 | if(this == o) |
| 189 | { |
| 190 | return true; |
| 191 | } |
| 192 | |
| 193 | if(o == null || o.getClass() != OverallResultBeanImpl.class) |
| 194 | { |
| 195 | return false; |
| 196 | } |
| 197 | |
| 198 | final OverallResultBeanImpl f = (OverallResultBeanImpl)o; |
| 199 | |
| 200 | return (name == null ? f.name == null : name.equals(f.name)) && |
| 201 | (href == null ? f.href == null : href.equals(f.href)) && |
| 202 | (description == null ? f.description == null : description.equals(f.description)) && |
| 203 | (elapsedTime == null ? f.elapsedTime == null : elapsedTime.equals(f.elapsedTime)) && |
| 204 | (result == null ? f.result == null : result.equals(f.result)); |
| 205 | } |
| 206 | |
| 207 | /** |
| 208 | * Returns a hash code for this <tt>OverallResultBeanImpl</tt> based on the name, href, description, elapsedTime, and |
| 209 | * result properties. |
| 210 | * |
| 211 | * @return A hash code for this <tt>OverallResultBeanImpl</tt> based on the name, href, description, elapsedTime, and |
| 212 | * result properties. |
| 213 | */ |
| 214 | @Override |
| 215 | public int hashCode() |
| 216 | { |
| 217 | final int oddPrime = 461; |
| 218 | int result = 73; |
| 219 | |
| 220 | if(name != null) |
| 221 | { |
| 222 | result = result * oddPrime + name.hashCode(); |
| 223 | } |
| 224 | |
| 225 | if(href != null) |
| 226 | { |
| 227 | result = result * oddPrime + href.hashCode(); |
| 228 | } |
| 229 | |
| 230 | if(description != null) |
| 231 | { |
| 232 | result = result * oddPrime + description.hashCode(); |
| 233 | } |
| 234 | |
| 235 | if(elapsedTime != null) |
| 236 | { |
| 237 | result = result * oddPrime + elapsedTime.hashCode(); |
| 238 | } |
| 239 | |
| 240 | if(this.result != null) |
| 241 | { |
| 242 | result = result * oddPrime + this.result.hashCode(); |
| 243 | } |
| 244 | |
| 245 | return result; |
| 246 | } |
| 247 | } |