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.IteratorThis 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 booleanhasNext()Return true if the iteration has more elements.java.lang.Objectnext()Return the next element in the iteration.voidremove()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:
hasNextin 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:
nextin 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:
removein interfacejava.util.Iterator
-
-