1 package indyjug.jboss.ejb;
2
3 public class StockValue implements java.io.Serializable
4 {
5 private String exchange;
6 private String symbol;
7 private String name;
8 private Double price;
9
10 public StockValue()
11 {
12 }
13
14 public StockValue(String exchange, String symbol, String name, double price)
15 {
16 this(exchange, symbol, name, new Double(price));
17 }
18
19 public StockValue(String exchange, String symbol, String name, Double price)
20 {
21 setExchange(exchange);
22 setSymbol(symbol);
23 setName(name);
24 setPrice(price);
25 }
26
27 public String getExchange()
28 {
29 return exchange;
30 }
31
32 public void setExchange(String exchange)
33 {
34 this.exchange = exchange;
35 }
36
37 public String getSymbol()
38 {
39 return symbol;
40 }
41
42 public void setSymbol(String symbol)
43 {
44 this.symbol = symbol;
45 }
46
47 public String getName()
48 {
49 return name;
50 }
51
52 public void setName(String name)
53 {
54 this.name = name;
55 }
56
57 public Double getPrice()
58 {
59 return price;
60 }
61
62 public void setPrice(Double price)
63 {
64 this.price = price;
65 }
66
67 public String toString()
68 {
69 StringBuffer str = new StringBuffer("[");
70
71 str.append("exchange=" + getExchange() + " " + "symbol=" + getSymbol() +
72 " " + "name=" + getName() + " " + "price=" + getPrice());
73 str.append(']');
74
75 return (str.toString());
76 }
77
78 public boolean equals(Object other)
79 {
80 if (this == other)
81 {
82 return true;
83 }
84
85 if (other instanceof StockValue)
86 {
87 StockValue that = (StockValue)other;
88 boolean lEquals = true;
89
90 return lEquals;
91 }
92 else
93 {
94 return false;
95 }
96 }
97
98 public int hashCode()
99 {
00 int result = 17;
01 result = (37 * result) +
02 ((this.exchange != null) ? this.exchange.hashCode() : 0);
03
04 result = (37 * result) +
05 ((this.symbol != null) ? this.symbol.hashCode() : 0);
06
07 result = (37 * result) +
08 ((this.name != null) ? this.name.hashCode() : 0);
09
10 result = (37 * result) +
11 ((this.price != null) ? this.price.hashCode() : 0);
12
13 return result;
14 }
15}
16