Source Code Cross Referenced for OHLCDataItem.java in  » Chart » jfreechart » org » jfree » data » xy » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Chart » jfreechart » org.jfree.data.xy 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* ===========================================================
002:         * JFreeChart : a free chart library for the Java(tm) platform
003:         * ===========================================================
004:         *
005:         * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
006:         *
007:         * Project Info:  http://www.jfree.org/jfreechart/index.html
008:         *
009:         * This library is free software; you can redistribute it and/or modify it 
010:         * under the terms of the GNU Lesser General Public License as published by 
011:         * the Free Software Foundation; either version 2.1 of the License, or 
012:         * (at your option) any later version.
013:         *
014:         * This library is distributed in the hope that it will be useful, but 
015:         * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
016:         * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 
017:         * License for more details.
018:         *
019:         * You should have received a copy of the GNU Lesser General Public
020:         * License along with this library; if not, write to the Free Software
021:         * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
022:         * USA.  
023:         *
024:         * [Java is a trademark or registered trademark of Sun Microsystems, Inc. 
025:         * in the United States and other countries.]
026:         *
027:         * -----------------
028:         * OHLCDataItem.java
029:         * -----------------
030:         * (C) Copyright 2003-2005, by Object Refinery Limited.
031:         *
032:         * Original Author:  David Gilbert (for Object Refinery Limited);
033:         * Contributor(s):   -;
034:         *
035:         * $Id: OHLCDataItem.java,v 1.6.2.1 2005/10/25 21:36:51 mungady Exp $
036:         *
037:         * Changes
038:         * -------
039:         * 03-Dec-2003 : Version 1 (DG);
040:         * 29-Apr-2005 : Added equals() method (DG);
041:         *
042:         */
043:
044:        package org.jfree.data.xy;
045:
046:        import java.io.Serializable;
047:        import java.util.Date;
048:
049:        /**
050:         * Represents a single (open-high-low-close) data item in 
051:         * an {@link DefaultOHLCDataset}.  This data item is commonly used 
052:         * to summarise the trading activity of a financial commodity for 
053:         * a fixed period (most often one day).
054:         */
055:        public class OHLCDataItem implements  Comparable, Serializable {
056:
057:            /** For serialization. */
058:            private static final long serialVersionUID = 7753817154401169901L;
059:
060:            /** The date. */
061:            private Date date;
062:
063:            /** The open value. */
064:            private Number open;
065:
066:            /** The high value. */
067:            private Number high;
068:
069:            /** The low value. */
070:            private Number low;
071:
072:            /** The close value. */
073:            private Number close;
074:
075:            /** The trading volume (number of shares, contracts or whatever). */
076:            private Number volume;
077:
078:            /**
079:             * Creates a new item.
080:             * 
081:             * @param date  the date (<code>null</code> not permitted).
082:             * @param open  the open value.
083:             * @param high  the high value.
084:             * @param low  the low value.
085:             * @param close  the close value.
086:             * @param volume  the volume.
087:             */
088:            public OHLCDataItem(Date date, double open, double high,
089:                    double low, double close, double volume) {
090:                if (date == null) {
091:                    throw new IllegalArgumentException("Null 'date' argument.");
092:                }
093:                this .date = date;
094:                this .open = new Double(open);
095:                this .high = new Double(high);
096:                this .low = new Double(low);
097:                this .close = new Double(close);
098:                this .volume = new Double(volume);
099:            }
100:
101:            /**
102:             * Returns the date that the data item relates to.
103:             * 
104:             * @return The date (never <code>null</code>).
105:             */
106:            public Date getDate() {
107:                return this .date;
108:            }
109:
110:            /**
111:             * Returns the open value.
112:             * 
113:             * @return The open value.
114:             */
115:            public Number getOpen() {
116:                return this .open;
117:            }
118:
119:            /**
120:             * Returns the high value.
121:             * 
122:             * @return The high value.
123:             */
124:            public Number getHigh() {
125:                return this .high;
126:            }
127:
128:            /**
129:             * Returns the low value.
130:             * 
131:             * @return The low value.
132:             */
133:            public Number getLow() {
134:                return this .low;
135:            }
136:
137:            /**
138:             * Returns the close value.
139:             * 
140:             * @return The close value.
141:             */
142:            public Number getClose() {
143:                return this .close;
144:            }
145:
146:            /**
147:             * Returns the volume.
148:             * 
149:             * @return The volume.
150:             */
151:            public Number getVolume() {
152:                return this .volume;
153:            }
154:
155:            /**
156:             * Checks this instance for equality with an arbitrary object.
157:             * 
158:             * @param obj  the object (<code>null</code> permitted).
159:             * 
160:             * @return A boolean.
161:             */
162:            public boolean equals(Object obj) {
163:                if (obj == this ) {
164:                    return true;
165:                }
166:                if (!(obj instanceof  OHLCDataItem)) {
167:                    return false;
168:                }
169:                OHLCDataItem that = (OHLCDataItem) obj;
170:                if (!this .date.equals(that.date)) {
171:                    return false;
172:                }
173:                if (!this .high.equals(that.high)) {
174:                    return false;
175:                }
176:                if (!this .low.equals(that.low)) {
177:                    return false;
178:                }
179:                if (!this .open.equals(that.open)) {
180:                    return false;
181:                }
182:                if (!this .close.equals(that.close)) {
183:                    return false;
184:                }
185:                return true;
186:            }
187:
188:            /**
189:             * Compares this object with the specified object for order. Returns a 
190:             * negative integer, zero, or a positive integer as this object is less 
191:             * than, equal to, or greater than the specified object.
192:             * 
193:             * @param object  the object to compare to.
194:             * 
195:             * @return A negative integer, zero, or a positive integer as this object 
196:             *         is less than, equal to, or greater than the specified object.
197:             */
198:            public int compareTo(Object object) {
199:                if (object instanceof  OHLCDataItem) {
200:                    OHLCDataItem item = (OHLCDataItem) object;
201:                    return this .date.compareTo(item.date);
202:                } else {
203:                    throw new ClassCastException("OHLCDataItem.compareTo().");
204:                }
205:            }
206:
207:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.