Source Code Cross Referenced for JMLValueValuePair.java in  » Testing » KeY » org » jmlspecs » models » 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 » Testing » KeY » org.jmlspecs.models 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // @(#)$Id: JMLValueValuePair.java 1.1 Mon, 02 May 2005 14:31:03 +0200 engelc $
002:
003:        // Copyright (C) 1998, 1999 Iowa State University
004:
005:        // This file is part of JML
006:
007:        // JML is free software; you can redistribute it and/or modify
008:        // it under the terms of the GNU General Public License as published by
009:        // the Free Software Foundation; either version 2, or (at your option)
010:        // any later version.
011:
012:        // JML is distributed in the hope that it will be useful,
013:        // but WITHOUT ANY WARRANTY; without even the implied warranty of
014:        // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
015:        // GNU General Public License for more details.
016:
017:        // You should have received a copy of the GNU General Public License
018:        // along with JML; see the file COPYING.  If not, write to
019:        // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
020:
021:        package org.jmlspecs.models;
022:
023:        /** Pairs of {@link JMLType} and {@link JMLType}, used in the types
024:         * {@link JMLValueToValueRelation} and {@link JMLValueToValueMap}.
025:         *
026:         * <p> In a pair the first element is called the "key" and the second
027:         * the "value". Both the key and the value in a pair must be non-null.
028:         *
029:         * @version $Revision: 1.1 $
030:         * @author Gary T. Leavens
031:         * @author Clyde Ruby
032:         * @see JMLValueToValueRelation
033:         * @see JMLValueToValueMap
034:         */
035:        //-@ immutable
036:        public/*@ pure @*/class JMLValueValuePair implements  JMLType {
037:
038:            /** The key of this pair.
039:             */
040:            public final/*@ non_null @*/JMLType key;
041:
042:            /** The value of this pair.
043:             */
044:            public final/*@ non_null @*/JMLType value;
045:
046:            //@ public invariant owner == null;
047:
048:            /*@  public model_program {
049:              @    assume dv != null && rv != null;
050:              @    set owner = null;
051:              @    key = (JMLType)dv.clone();
052:              @    value = (JMLType)rv.clone();
053:              @  }
054:              @ also
055:              @    ensures dv != null && rv != null;
056:              @    signals (NullPointerException) dv == null || rv == null;
057:              @*/
058:            /** Initialize the key and value of this pair.
059:             */
060:            public JMLValueValuePair(/*@ non_null @*/JMLType dv,
061:            /*@ non_null @*/JMLType rv) throws NullPointerException {
062:                if (dv == null) {
063:                    throw new NullPointerException("Attempt to create a"
064:                            + " JMLValueValuePair with null" + " key");
065:                }
066:                if (rv == null) {
067:                    throw new NullPointerException("Attempt to create a"
068:                            + " JMLValueValuePair with null" + " value");
069:                }
070:                //@ assume dv != null && rv != null;
071:                //@ set owner = null;
072:                key = (JMLType) dv.clone();
073:                value = (JMLType) rv.clone();
074:            }
075:
076:            // inherit javadoc comment
077:            /*@ also
078:              @  public model_program {
079:              @    return new JMLValueValuePair(key, value);
080:              @  }
081:              @*/
082:            public Object clone() {
083:                return new JMLValueValuePair(key, value);
084:            } // nowarn Post;
085:
086:            /** Tell whether this object's key is equal to the given key.
087:             * @see #equals
088:             */
089:            /*@  public normal_behavior
090:              @    ensures \result == (key.equals(dv));
091:              @*/
092:            public boolean keyEquals(JMLType dv) {
093:                return key.equals(dv);
094:            }
095:
096:            /** Tell whether this object's key is equal to the given key.
097:             * @see #equals
098:             */
099:            /*@  public normal_behavior
100:              @    ensures \result == (value.equals(rv));
101:              @*/
102:            public boolean valueEquals(JMLType rv) {
103:                return value.equals(rv);
104:            }
105:
106:            /** Test whether this object's value is equal to the given argument.
107:             * @see #keyEquals
108:             */
109:            /*@ also
110:              @  public normal_behavior
111:              @    requires obj != null && obj instanceof JMLValueValuePair;
112:              @    ensures \result == 
113:              @            ( ((JMLValueValuePair)obj).key.equals(key) 
114:              @              && ((JMLValueValuePair)obj).value.equals(value) );
115:              @ also 
116:              @  public normal_behavior
117:              @    requires obj == null || !(obj instanceof JMLValueValuePair);
118:              @    ensures !\result;
119:              @*/
120:            public boolean equals(Object obj) {
121:                if (obj != null && obj instanceof  JMLValueValuePair) {
122:                    JMLValueValuePair pair = (JMLValueValuePair) obj;
123:                    return pair.key.equals(key) && pair.value.equals(value);
124:                } else {
125:                    return false;
126:                }
127:            }
128:
129:            /** Return a hash code for this object.
130:             */
131:            public int hashCode() {
132:                return key.hashCode() + value.hashCode();
133:            }
134:
135:            /** Return a string representation of this object.
136:             */
137:            /*@ also
138:              @  public normal_behavior
139:              @    ensures (* \result is a string that starts with a '(' followed by
140:              @                the strings representing key and value separated by
141:              @                a comma and ends with a ')' 
142:              @              *);
143:              @ for_example
144:              @   public normal_example
145:              @     requires (* key is 4 and value is 2 *);
146:              @     ensures (*  \result is the string "(4, 2)"  *);
147:              @*/
148:            public String toString() {
149:                return (new String("(") + key + new String(", ") + value + new String(
150:                        ")"));
151:            }
152:        };
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.