org.jmlspecs.jmlunit.strategies
Class NewObjectAbstractStrategy
java.lang.Object
org.jmlspecs.jmlunit.strategies.NewObjectAbstractStrategy
- All Implemented Interfaces:
- StrategyType
- Direct Known Subclasses:
- Account_JML_TestData.Account_JML_TestData$1, Account_JML_TestData.Account_JML_TestData$3, BlankReader_JML_TestData.BlankReader_JML_TestData$1, BoundedStackInterface_JML_TestData.BoundedStackInterface_JML_TestData$2, CollectionStrategy.CollectionStrategy$1, Complex_JML_TestData.Complex_JML_TestData$1, Complex_JML_TestData.Complex_JML_TestData$2, Counter_JML_TestData.Counter_JML_TestData$1, IntegerSetAsHashSet_JML_TestData.IntegerSetAsHashSet_JML_TestData$2, IntegerSetAsTree_JML_TestData.IntegerSetAsTree_JML_TestData$2, JMLChar_JML_TestData.JMLChar_JML_TestData$3, JMLValueObjectPair_JML_TestData.JMLValueObjectPair_JML_TestData$2, LinearSearch_JML_TestData.LinearSearch_JML_TestData$1, ListIterator_JML_TestData.ListIterator_JML_TestData$2, Meter_JML_TestData.Meter_JML_TestData$1, NewObjectAbstractStrategyTest.SingletonNOAS, NewObjectAbstractStrategyTest.SmallestNOAS, OneWayNode_JML_TestData.OneWayNode_JML_TestData$1, Person_JML_TestData.Person_JML_TestData$1, PlusAccount_JML_TestData.PlusAccount_JML_TestData$1, PlusAccount_JML_TestData.PlusAccount_JML_TestData$3, Point2D_JML_TestData.Point2D_JML_TestData$1, PriorityQueue_JML_TestData.PriorityQueue_JML_TestData$1, Proof_JML_TestData.Proof_JML_TestData$3, SearchableDigraph_JML_TestData.SearchableDigraph_JML_TestData$2, TableImplementation_JML_TestData.TableImplementation_JML_TestData$3, TransposableDigraph_JML_TestData.TransposableDigraph_JML_TestData$1, TransposableNode_JML_TestData.TransposableNode_JML_TestData$2, TwoWayIterator_JML_TestData.TwoWayIterator_JML_TestData$1, TwoWayIterator_JML_TestData.TwoWayIterator_JML_TestData$1, TwoWayIterator_JML_TestData.TwoWayIterator_JML_TestData$2, TwoWayIterator_JML_TestData.TwoWayIterator_JML_TestData$2, TwoWayNode_JML_TestData.TwoWayNode_JML_TestData$1, UnboundedStackAsArrayList_JML_TestData.UnboundedStackAsArrayList_JML_TestData$1
- public abstract class NewObjectAbstractStrategy
- extends Object
- implements StrategyType
A strategy that provides test data by creating (in general) the
objects each time the make() method is called for a particular
argument. The idea is to prevent aliasing without cloning.
Hoewver, If you want to have aliasing, arrange it so that the
same object is returned multiple times by make().
This strategy provides null by default, so users
never need to return null in the body of the #make()
method
they provide.
- Author:
- Gary T. Leavens
Specifications inherited from class Object |
represents objectState <- org.jmlspecs.lang.JMLDataGroup.IT;
public represents _getClass <- \typeof(this); |
Method Summary |
IndefiniteIterator |
iterator()
Compute a fresh indefinite iterator, which can be used to
provide test data of some reference type. |
protected abstract Object |
make(int n)
Return the nth test data item. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NewObjectAbstractStrategy
public NewObjectAbstractStrategy()
iterator
public IndefiniteIterator iterator()
- Description copied from interface:
StrategyType
- Compute a fresh indefinite iterator, which can be used to
provide test data of some reference type. The indefinite
iterator returned should be freshly created. Usually it should
not be at its end. However, in rare cases it might make sense
to have an empty iterator be computed (e.g., by filtering).
- Specified by:
iterator
in interface StrategyType
- Specifications: non_null
- Specifications inherited from overridden method in interface StrategyType:
non_null -
assignable objectState;
ensures \fresh(\result );
ensures_redundantly \result != null;
make
protected abstract Object make(int n)
- Return the nth test data item.
- Specifications: nullable
-
protected behavior
requires 0 <= n;
assignable objectState;
signals_only java.util.NoSuchElementException;
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.