Package ptolemy.kernel.util
Class NamedObj.ContainedObjectsIterator
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj.ContainedObjectsIterator
-
- All Implemented Interfaces:
java.util.Iterator
- Direct Known Subclasses:
Entity.ContainedObjectsIterator
- Enclosing class:
- NamedObj
protected class NamedObj.ContainedObjectsIterator extends java.lang.Object implements java.util.Iterator
This class is an iterator over all the contained objects (all instances of NamedObj). In this base class, the contained objects are attributes. In derived classes, they include ports, relations, and entities as well.
-
-
Constructor Summary
Constructors Constructor Description ContainedObjectsIterator()
Create an iterator over all the contained objects.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
Return true if the iteration has more elements.java.lang.Object
next()
Return the next element in the iteration.void
remove()
Throw a UnsupportedOperationException because remove() is not supported.
-
-
-
Method Detail
-
hasNext
public boolean hasNext()
Return true if the iteration has more elements. In this base class, this returns true if there are more attributes.- Specified by:
hasNext
in interfacejava.util.Iterator
- Returns:
- True if there are more attributes.
-
next
public java.lang.Object next()
Return the next element in the iteration. In this base class, this is the next attribute.- Specified by:
next
in interfacejava.util.Iterator
- Returns:
- The next attribute.
-
remove
public void remove()
Throw a UnsupportedOperationException because remove() is not supported. The reason is because this iterator calls attributeList().iterator(), which returns a NamedList that is unmodifiable.- Specified by:
remove
in interfacejava.util.Iterator
-
-