JML

org.jmlspecs.jmlunit
Class TestClassGenerator.MethodsIterator

java.lang.Object
  extended byorg.jmlspecs.jmlunit.TestClassGenerator.MethodsIterator
All Implemented Interfaces:
Iterator
Enclosing class:
TestClassGenerator

protected class TestClassGenerator.MethodsIterator
extends Object
implements Iterator

A composite control abstraction useful in this class.


Class Specifications
private represents moreElements <- this.cache != null;

Specifications inherited from class Object
represents objectState <- org.jmlspecs.lang.JMLDataGroup.IT;
public represents _getClass <- \typeof(this);

Specifications inherited from interface Iterator
public invariant this.moreElements == this.hasNext(0);

Model Field Summary
 
Model fields inherited from class java.lang.Object
_getClass, objectState, theString
 
Model fields inherited from interface java.util.Iterator
moreElements
 
Ghost Field Summary
 
Ghost fields inherited from class java.lang.Object
objectTimesFinalized, owner
 
Ghost fields inherited from interface java.util.Iterator
elementType, remove_called_since, returnsNull
 
Field Summary
private  TestClassGenerator.MethodInfo cache
          Cached method to return next, null if none
private  Iterator inheritedMethods
          The inherited methods.
private  Iterator methods
          The non-inherited methods.
 
Constructor Summary
TestClassGenerator.MethodsIterator(List methods, List inhMeths)
          Initialize this methods iter.
 
Model Method Summary
 
Model methods inherited from class java.lang.Object
hashValue
 
Model methods inherited from interface java.util.Iterator
hasNext, nthNextElement
 
Method Summary
private  void cacheNext()
          Advance the state of the iteration to point to the next testable method declaration.
private  boolean compositeHasNext()
          Does the composition have more elements?
private  Object compositeNextMethod()
          Return the next element in the composition
 boolean hasNext()
           
 Object next()
           
 TestClassGenerator.MethodInfo nextMethod()
          Return the next testable method
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

methods

private Iterator methods
The non-inherited methods.

Specifications: non_null
is in groups: objectState
maps methods.objectState \into objectState

inheritedMethods

private Iterator inheritedMethods
The inherited methods.

Specifications: non_null
is in groups: objectState
maps inheritedMethods.objectState \into objectState

cache

private TestClassGenerator.MethodInfo cache
Cached method to return next, null if none

Specifications:
is in groups: objectState
Constructor Detail

TestClassGenerator.MethodsIterator

public TestClassGenerator.MethodsIterator(List methods,
                                          List inhMeths)
Initialize this methods iter.

Specifications:
requires methods != null;
assignable objectState;
Method Detail

compositeHasNext

private boolean compositeHasNext()
Does the composition have more elements?

Specifications:
assignable objectState;
ensures \result <==> this.methods.moreElements||this.inheritedMethods.moreElements;

compositeNextMethod

private Object compositeNextMethod()
Return the next element in the composition

Specifications:
assignable methods.objectState, inheritedMethods.objectState;

cacheNext

private void cacheNext()
Advance the state of the iteration to point to the next testable method declaration.

Specifications:
assignable objectState;

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator
Specifications: pure
Specifications inherited from overridden method in interface Iterator:
public normal_behavior
assignable objectState;
ensures \result <==> this.moreElements;

next

public Object next()
Specified by:
next in interface Iterator
Specifications:
     also
assignable objectState;
Specifications inherited from overridden method in interface Iterator:
public normal_behavior
requires this.moreElements;
requires_redundantly this.hasNext(0);
assignable objectState, remove_called_since, moreElements;
ensures !this.remove_called_since;
ensures (\result == null)||\typeof(\result ) <: this.elementType;
ensures !this.returnsNull ==> (\result != null);
     also
public exceptional_behavior
requires !this.moreElements;
assignable \nothing;
signals_only java.util.NoSuchElementException;

nextMethod

public TestClassGenerator.MethodInfo nextMethod()
Return the next testable method

Specifications:
assignable objectState;

remove

public void remove()
Specified by:
remove in interface Iterator
Specifications inherited from overridden method in interface Iterator:
public behavior
assignable objectState, remove_called_since;
ensures !\old(this.remove_called_since)&&this.remove_called_since;
signals_only java.lang.UnsupportedOperationException, java.lang.IllegalStateException;
signals (java.lang.UnsupportedOperationException) (* if this iterator does not support removing elements *);
signals (java.lang.IllegalStateException) \old(this.remove_called_since);

JML

JML is Copyright (C) 1998-2002 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This release depends on code from the MultiJava project and is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.