Source Code Cross Referenced for JMLSetEnumerator.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: JMLSetEnumerator.java 1.1 Mon, 02 May 2005 14:31:03 +0200 engelc $
002:
003:        // Copyright (C) 1998, 1999, 2002 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:        import java.util.Enumeration;
024:
025:        /** An enumerator for sets of _ElemType_English_s.
026:         *
027:         * @version $Revision: 1.1 $
028:         * @author Gary T. Leavens, with help from Albert Baker, Clyde Ruby,
029:         * and others.
030:         * @see JMLEnumeration
031:         * @see _SuperType_
032:         * @see JML_Elem_Set
033:         * @see JMLEnumerationToIterator
034:         */
035:        //-@ immutable
036:        public class JML_Elem_SetEnumerator implements  JMLEnumeration,
037:                _SuperType_ {
038:
039:            /** The elements that have not yet been returned by nextElement.
040:             */
041:            //@ public model JML_Elem_Set uniteratedElems;        in objectState;
042:            //@ public invariant uniteratedElems != null;
043:            /** The list representing the elements that have not yet been
044:             * returned by this enumerator.
045:             */
046:            protected JMLList_Elem_Node currentNode;
047:
048:            //@                               in uniteratedElems;
049:
050:            //@ protected represents uniteratedElems <- new JML_Elem_Set(currentNode);
051:
052:            //@ protected invariant moreElements <==> currentNode != null;
053:
054:            //@ public invariant elementType <: \type(_ElemType_);
055:
056:            /*@ public invariant
057:              @       !uniteratedElems.isEmpty()
058:              @        ==> uniteratedElems.elementType <: elementType;
059:              @*/
060:
061:            //@ public constraint returnsNull == \old(returnsNull);
062:            /*@ public invariant
063:              @       !returnsNull
064:              @         ==> uniteratedElems.isEmpty() || !uniteratedElems.containsNull;
065:              @*/
066:
067:            /** Initialize this with the given set.
068:             */
069:            /*@ normal_behavior
070:              @   requires s != null;
071:              @   assignable uniteratedElems;
072:              @   modifies moreElements, elementType, returnsNull, owner;
073:              @   ensures uniteratedElems.equals(s);
074:              @   ensures owner == null;
075:              @   ensures elementType == s.elementType;
076:              @   ensures returnsNull == s.containsNull;
077:              @*/
078:            JML_Elem_SetEnumerator(/*@ non_null @*/JML_Elem_Set s) {
079:                //@ set owner = null;
080:                //@ set elementType = s.elementType;
081:                //@ set returnsNull = s.containsNull;
082:                currentNode = s.the_list;
083:            }
084:
085:            /** Tells whether this enumerator has more uniterated elements.
086:             */
087:            /*@ also
088:              @   public normal_behavior
089:              @     ensures \result == !uniteratedElems.isEmpty();
090:              @*/
091:            public/*@ pure @*/boolean hasMoreElements() {
092:                return currentNode != null;
093:            }
094:
095:            /** Return the next element in this, if there is one.
096:             *  @exception JMLNoSuchElementException when this is empty.
097:             */
098:            /*@ also
099:              @   public normal_behavior
100:              @     requires hasMoreElements();
101:              @     assignable uniteratedElems, moreElements;
102:              @     ensures
103:              @        (\result == null
104:              @           ==> \old(uniteratedElems).has(null)
105:              @               && uniteratedElems.equals(\old(uniteratedElems)
106:              @                                      .remove(null)))
107:              @       && (\result != null
108:              @           ==> \old(uniteratedElems).has(_elem_downcast_\result)
109:              @               && uniteratedElems.equals(\old(uniteratedElems)
110:              @                                      .remove(_elem_downcast_\result)));
111:              @ also
112:              @   public exceptional_behavior
113:              @     requires !hasMoreElements();
114:              @     assignable \nothing;
115:              @     signals (JMLNoSuchElementException);
116:              @*/
117:            public Object nextElement() throws JMLNoSuchElementException {
118:                if (currentNode != null) {
119:                    _ElemType_ retValue = currentNode.val;
120:                    //@ assume retValue != null ==> \typeof(retValue) <: elementType;
121:                    //@ assume retValue == null ==> returnsNull;
122:                    currentNode = currentNode.next;
123:                    return retValue;
124:                } else {
125:                    throw new JMLNoSuchElementException(
126:                            "Tried to .nextElement() " + "with JML_Elem_Set "
127:                                    + "Enumerator `off the end'");
128:                }
129:            }
130:
131:            /** Return a clone of this enumerator.
132:             */
133:            public Object clone() {
134:                return new JML_Elem_SetEnumerator(new JML_Elem_Set(currentNode));
135:            } //@ nowarn Post;
136:
137:            /** Return true just when this enumerator has the same state as
138:             * the given argument.
139:             */
140:            public/*@ pure @*/boolean equals(Object oth) {
141:                if (oth == null || !(oth instanceof  JML_Elem_SetEnumerator)) {
142:                    return false;
143:                } else {
144:                    JML_Elem_SetEnumerator js = (JML_Elem_SetEnumerator) oth;
145:                    if (currentNode == null) {
146:                        return js.currentNode == null;
147:                    } else {
148:                        return currentNode.equals(js.currentNode);
149:                    }
150:                }
151:            }
152:
153:            /** Return a hash code for this enumerator.
154:             */
155:            public int hashCode() {
156:                return currentNode == null ? 0 : currentNode.hashCode();
157:            }
158:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.