tudresden.ocl.lib
Class OclIterator
java.lang.Object
tudresden.ocl.lib.OclIterator
- public class OclIterator
- extends Object
The OclIterator is needed to transform OCL iterating methods to
Java. An OclIterator can be obtained from an OclCollection and is given
back to the OclCollection as an argument of the iterating method.
This class is a wrapper class around an java.util.Iterator
.
It differs from Iterator
in the ability to set the pointer to
the next element once and then read this element arbitrarily often. In
contrast, Iterator
moves the pointer every time the element
is read.
When constructed, the OclIterator
s pointer is before the first element.
Calling getValue()
would yield null
.
- Author:
- Frank Finger
- See Also:
OclCollection
Method Summary |
OclRoot |
getValue()
This operation is the only one that is called from out of the OCL
class library. |
(package private) boolean |
hasNext()
|
(package private) void |
next()
moves the OclIterator s pointer to the next element |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
iter
private Iterator iter
value
private OclRoot value
OclIterator
protected OclIterator(Collection c)
OclIterator
protected OclIterator(Iterator i)
getValue
public OclRoot getValue()
- This operation is the only one that is called from out of the OCL
class library. It returns the
OclRoot
element that the
OclIterator
is pointing to.
hasNext
boolean hasNext()
- Returns:
true
if the iteration has more elements
next
void next()
- moves the
OclIterator
s pointer to the next element
- Throws:
OclClassCastException
- if the next element that the backing
java.lang.Iterator
returns is not of type
OclRoot
; this means propably that the OclCollection
that returned this OclIterator contains non-OclRoot elements
Submit a bug
Developed at the Dresden University of Technology.
This software is published under the GNU Lesser General Public License.