Source Code Cross Referenced for LongValue.java in  » J2EE » wicket » wicket » util » value » 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 » J2EE » wicket » wicket.util.value 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: LongValue.java 457783 2005-10-02 10:06:33Z jcompagner $ $Revision:
003:         * 1.4 $ $Date: 2005-10-02 12:06:33 +0200 (Sun, 02 Oct 2005) $
004:         * 
005:         * ==============================================================================
006:         * Licensed under the Apache License, Version 2.0 (the "License"); you may not
007:         * use this file except in compliance with the License. You may obtain a copy of
008:         * the License at
009:         * 
010:         * http://www.apache.org/licenses/LICENSE-2.0
011:         * 
012:         * Unless required by applicable law or agreed to in writing, software
013:         * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
014:         * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
015:         * License for the specific language governing permissions and limitations under
016:         * the License.
017:         */
018:        package wicket.util.value;
019:
020:        import java.io.Serializable;
021:
022:        import wicket.util.lang.Primitives;
023:
024:        /**
025:         * A base class for value classes based on a Java long primitive which want to
026:         * implement standard operations on that value without the pain of aggregating a
027:         * Long object.
028:         * 
029:         * @author Jonathan Locke
030:         */
031:        public class LongValue implements  Comparable, Serializable {
032:            private static final long serialVersionUID = 1L;
033:
034:            /** The long value */
035:            protected final long value;
036:
037:            /**
038:             * Constructor
039:             * 
040:             * @param value
041:             *            The long value
042:             */
043:            public LongValue(final long value) {
044:                this .value = value;
045:            }
046:
047:            /**
048:             * @param object
049:             *            The object to compare with
050:             * @return 0 if equal, -1 if less than or 1 if greater than
051:             */
052:            public final int compareTo(final Object object) {
053:                final LongValue that = (LongValue) object;
054:
055:                if (this .value < that.value) {
056:                    return -1;
057:                }
058:
059:                if (this .value > that.value) {
060:                    return 1;
061:                }
062:
063:                return 0;
064:            }
065:
066:            /**
067:             * @param that
068:             *            The value to compare against
069:             * @return True if this value is equal to that value
070:             */
071:            public final boolean equals(final Object that) {
072:                if (that instanceof  LongValue) {
073:                    return this .value == ((LongValue) that).value;
074:                }
075:
076:                return false;
077:            }
078:
079:            /**
080:             * @param value
081:             *            The value to compare against
082:             * @return True if this value is greater than the given value
083:             */
084:            public final boolean greaterThan(final long value) {
085:                return this .value > value;
086:            }
087:
088:            /**
089:             * @param that
090:             *            The value to compare against
091:             * @return True if this value is greater than that value
092:             */
093:            public final boolean greaterThan(final LongValue that) {
094:                return this .value > that.value;
095:            }
096:
097:            /**
098:             * @return Hashcode for this object
099:             */
100:            public final int hashCode() {
101:                return Primitives.hashCode(value);
102:            }
103:
104:            /**
105:             * @param that
106:             *            The value to compare against
107:             * @return True if this value is less than that value
108:             */
109:            public final boolean lessThan(final long that) {
110:                return this .value < that;
111:            }
112:
113:            /**
114:             * @param that
115:             *            The value to compare against
116:             * @return True if this value is less than that value
117:             */
118:            public final boolean lessThan(final LongValue that) {
119:                return this .value < that.value;
120:            }
121:
122:            /**
123:             * Converts this value to a string
124:             * 
125:             * @return The string for this value
126:             */
127:            public String toString() {
128:                return String.valueOf(value);
129:            }
130:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.