ptolemy.kernel.util
Class NamedObj.ContainedObjectsIterator

java.lang.Object
  extended by 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.


Field Summary
private  java.util.Iterator<?> _attributeListIterator
           
 
Constructor Summary
NamedObj.ContainedObjectsIterator()
          Create an iterator over all the contained objects.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_attributeListIterator

private java.util.Iterator<?> _attributeListIterator
Constructor Detail

NamedObj.ContainedObjectsIterator

public NamedObj.ContainedObjectsIterator()
Create an iterator over all the contained objects.

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 interface java.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 interface java.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 interface java.util.Iterator