Source Code Cross Referenced for KeyedValue.java in  » Development » jgap » org » jgap » audit » 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 » Development » jgap » org.jgap.audit 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * This file is part of JGAP.
003:         *
004:         * JGAP offers a dual license model containing the LGPL as well as the MPL.
005:         *
006:         * For licencing information please see the file license.txt included with JGAP
007:         * or have a look at the top of class org.jgap.Chromosome which representatively
008:         * includes the JGAP license policy applicable for any file delivered with JGAP.
009:         */
010:        package org.jgap.audit;
011:
012:        import java.io.Serializable;
013:        import org.jgap.util.*;
014:
015:        /**
016:         * A (key, value) tupel.
017:         *
018:         * @author Klaus Meffert
019:         * @since 2.3
020:         */
021:        public class KeyedValue implements  ICloneable, Serializable {
022:            /** String containing the CVS revision. Read out via reflection!*/
023:            private static final String CVS_REVISION = "$Revision: 1.3 $";
024:
025:            private Comparable m_key;
026:
027:            private Number m_value;
028:
029:            /**
030:             * Creates a new (key, value) tupel.
031:             *
032:             * @param a_key the key
033:             * @param a_value the value, could be null
034:             *
035:             * @author Klaus Meffert
036:             * @since 2.3
037:             */
038:            public KeyedValue(final Comparable a_key, final Number a_value) {
039:                m_key = a_key;
040:                m_value = a_value;
041:            }
042:
043:            /**
044:             * @return key of the tupel
045:             *
046:             * @author Klaus Meffert
047:             * @since 2.3
048:             */
049:            public Comparable getKey() {
050:                return m_key;
051:            }
052:
053:            /**
054:             * @return value of the tupel
055:             *
056:             * @author Klaus Meffert
057:             * @since 2.3
058:             */
059:            public synchronized Number getValue() {
060:                return m_value;
061:            }
062:
063:            /**
064:             * Sets the value for the key
065:             *
066:             * @param a_value the value to set for the key
067:             *
068:             * @author Klaus Meffert
069:             * @since 2.3
070:             */
071:            public synchronized void setValue(final Number a_value) {
072:                m_value = a_value;
073:            }
074:
075:            /**
076:             * Tests if this object is equal to another.
077:             *
078:             * @param a_object the other object
079:             *
080:             * @return true: this object is equal to other one
081:             *
082:             * @author Klaus Meffert
083:             * @since 2.3
084:             */
085:            public boolean equals(final Object a_object) {
086:                if (this  == a_object) {
087:                    return true;
088:                }
089:                if (!(a_object instanceof  KeyedValue)) {
090:                    return false;
091:                }
092:                final KeyedValue defaultKeyedValue = (KeyedValue) a_object;
093:                if (m_key != null ? !m_key.equals(defaultKeyedValue.m_key)
094:                        : defaultKeyedValue.m_key != null) {
095:                    return false;
096:                }
097:                if (m_value != null ? !m_value
098:                        .equals(defaultKeyedValue.m_value)
099:                        : defaultKeyedValue.m_value != null) {
100:                    return false;
101:                }
102:                return true;
103:            }
104:
105:            /**
106:             * @return hash code of the instance
107:             *
108:             * @author Klaus Meffert
109:             * @since 2.3
110:             */
111:            public int hashCode() {
112:                int result;
113:                if (m_key == null) {
114:                    result = -37;
115:                } else {
116:                    result = m_key.hashCode();
117:                }
118:                result = 41 * result;
119:                if (m_value == null) {
120:                    result += -3;
121:                } else {
122:                    result += m_value.hashCode();
123:                }
124:                return result;
125:            }
126:
127:            /**
128:             * @return clone of the current instance
129:             *
130:             * @author Klaus Meffert
131:             * @since 2.3
132:             */
133:            public Object clone() {
134:                try {
135:                    KeyedValue clone = (KeyedValue) super .clone();
136:                    return clone;
137:                } catch (CloneNotSupportedException cex) {
138:                    throw new CloneException(cex);
139:                }
140:            }
141:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.