View Javadoc

1   /*
2    * Copyright 2000-2001,2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.apache.jetspeed.webservices.finance.stockmarket;
18  
19  /***
20      BaseStockQuote implements StockQuote, 
21      holding the information for one company's quote.
22          
23      @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
24      @version $Id: BaseStockQuote.java,v 1.2 2004/02/23 03:15:29 jford Exp $
25  */
26  
27  public class BaseStockQuote implements StockQuote
28  {
29      String price = "";
30      String name = "";
31      String symbol = "";
32      String time = "";
33      String date = "";
34      String high = "";
35      String volume = "";
36      String change = "";
37      String opening = "";
38      String low = "";
39  
40      public void setPrice(String v) 
41      {
42          price = v;
43      }
44  
45      public String getPrice() 
46      {
47          return price;
48      }
49  
50      public void setName(String v) 
51      {
52          name = v;
53      }
54  
55      public String getName() 
56      {
57          return name;
58      }
59  
60      public void setSymbol(String v) 
61      {
62          symbol = v;
63      }
64  
65      public String getSymbol() 
66      {
67          return symbol;
68      }
69  
70      public void setTime(String v)
71      {
72          time = v;
73      }
74  
75      public String getTime() 
76      {
77          return time;
78      }
79  
80      public void setDate(String v) 
81      {
82          date = v;
83      }
84  
85      public String getDate() 
86      {
87          return date;
88      }
89  
90      public void setHigh(String v) 
91      {
92          high = v;
93      }
94  
95      public String getHigh() // subliminal
96      {
97          return high;
98      }
99  
100     public void setVolume(String v) 
101     {
102         volume = v;
103     }
104 
105     public String getVolume() 
106     {
107         return volume;
108     }
109 
110     public void setChange(String v) 
111     {
112         change = v;
113     }
114 
115     public String getChange() 
116     {
117         return change;
118     }
119 
120     public void setOpening(String v) 
121     {
122         opening = v;
123     }
124 
125     public String getOpening() 
126     {
127         return opening;
128     }
129 
130     public void setLow(String v) 
131     {
132         low = v;
133     }
134 
135     public String getLow() 
136     {
137         return low;
138     }
139 
140     public String toString() 
141     {
142         return toXML();
143     }
144 
145     public String toXML() 
146     {
147         StringBuffer buffer = new StringBuffer();
148         buffer.append("        <Price>");
149         buffer.append(price);
150         buffer.append("</Price>\n");
151         buffer.append("        <Name>");
152         buffer.append(name);
153         buffer.append("</Name>\n");
154         buffer.append("        <Symbol>");
155         buffer.append(symbol);
156         buffer.append("</Symbol>\n");
157         buffer.append("        <Time>");
158         buffer.append(time);
159         buffer.append("</Time>\n");
160         buffer.append("        <Date>");
161         buffer.append(date);
162         buffer.append("</Date>\n");
163         buffer.append("        <High>");
164         buffer.append(high);
165         buffer.append("</High>\n");
166         buffer.append("        <Volume>");
167         buffer.append(volume);
168         buffer.append("</Volume>\n");
169         buffer.append("        <Change>");
170         buffer.append(change);
171         buffer.append("</Change>\n");
172         buffer.append("        <Low>");
173         buffer.append(low);
174         buffer.append("</Low>\n");
175         return buffer.toString();
176     }
177 
178 }