Source Code Cross Referenced for JMLEnumerationToIterator.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: JMLEnumerationToIterator.java 1.1.1.1 Mon, 09 May 2005 15:27:50 +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:        /** A wrapper that makes any {@link JMLEnumeration} into a {@link
024:         * JMLIterator} that does not support the remove operation.
025:         *
026:         * @version $Revision: 1.1.1.1 $
027:         * @author Gary T. Leavens
028:         * @see JMLEnumeration
029:         * @see JMLIterator
030:         * @see java.util.Iterator
031:         */
032:        //-@ immutable
033:        public class JMLEnumerationToIterator implements  JMLIterator {
034:
035:            protected final/*@ spec_public non_null @*/JMLEnumeration theEnumeration;
036:
037:            //@            maps theEnumeration.objectState \into objectState;
038:
039:            /*@ public represents moreElements <- theEnumeration.hasMoreElements();
040:              @ public represents_redundantly
041:              @                   moreElements <- theEnumeration.moreElements;
042:              @*/
043:
044:            /** Initialize this iterator with the given Enumeration.  The
045:             * enumeration is cloned.
046:             */
047:            /*@ public normal_behavior
048:              @   requires e != null;
049:              @   assignable owner, theEnumeration, elementType, moreElements;
050:              @   assignable returnsNull;
051:              @   ensures theEnumeration.equals(e);
052:              @   ensures owner == null;
053:              @*/
054:            public JMLEnumerationToIterator(/*@ non_null @*/JMLEnumeration e) {
055:                Object o = e.clone();
056:                theEnumeration = (JMLEnumeration) o;
057:            }
058:
059:            /** Tells whether this has more uniterated elements.
060:             */
061:            /*@ also
062:              @   public normal_behavior
063:              @     ensures \result == theEnumeration.moreElements;
064:              @     ensures_redundantly \result == theEnumeration.moreElements;
065:              @*/
066:            public/*@ pure @*/boolean hasNext() {
067:                return theEnumeration.hasMoreElements();
068:            }
069:
070:            /** Return the next element in this, if there is one.
071:             *  @exception JMLNoSuchElementException when this is empty.
072:             */
073:            /*@ also
074:              @   public normal_behavior
075:              @     requires moreElements;
076:              @     requires_redundantly hasNext();
077:              @     assignable objectState, moreElements, remove_called_since;
078:              @ also
079:              @   public exceptional_behavior
080:              @     requires !moreElements;
081:              @     requires_redundantly !hasNext();
082:              @     assignable \nothing;
083:              @     signals (JMLNoSuchElementException);
084:              @*/
085:            public Object next() throws JMLNoSuchElementException {
086:                Object result = theEnumeration.nextElement();
087:                return result;
088:            }
089:
090:            /** The remove operation is not supported in this type.
091:             * So remove always throws an UnsupportedOperationException.
092:             */
093:            /*@ also
094:              @    signals (UnsupportedOperationException);
095:              @*/
096:            public void remove() throws UnsupportedOperationException {
097:                throw new UnsupportedOperationException();
098:            }
099:
100:            /** Return a clone of this iterator.
101:             */
102:            public/*@ pure @*/Object clone() {
103:                Object o = theEnumeration.clone();
104:                return new JMLEnumerationToIterator((JMLEnumeration) o);
105:            }
106:
107:            /** Return true just when this iterator has the same state as
108:             * the given argument.
109:             */
110:            /*@ also
111:              @    public normal_behavior
112:              @      ensures \result <==> oth != null
113:              @           && oth instanceof JMLEnumerationToIterator
114:              @           && theEnumeration.equals(((JMLEnumerationToIterator) oth)
115:              @                                  .theEnumeration);
116:              @*/
117:            public/*@ pure @*/boolean equals(Object oth) {
118:                return oth != null
119:                        && oth instanceof  JMLEnumerationToIterator
120:                        && theEnumeration
121:                                .equals(((JMLEnumerationToIterator) oth).theEnumeration);
122:            }
123:
124:            /** Return a hash code for this iterator.
125:             */
126:            public/*@ pure @*/int hashCode() {
127:                return theEnumeration.hashCode();
128:            }
129:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.