ptolemy.kernel
Class Entity.ContainedObjectsIterator

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj.ContainedObjectsIterator
      extended by ptolemy.kernel.Entity.ContainedObjectsIterator
All Implemented Interfaces:
java.util.Iterator
Direct Known Subclasses:
CompositeEntity.ContainedObjectsIterator, LazyTypedCompositeActor.ContainedObjectsIterator
Enclosing class:
Entity

protected class Entity.ContainedObjectsIterator
extends NamedObj.ContainedObjectsIterator

This class is an iterator over all the contained objects (all instances of NamedObj). In this class, the contained objects are attributes first, then ports. In derived classes, they include relations, and entities as well. The user of this class should have read access on the workspace and hold it for the duration of the use of the iterator. Moreover, it should not modify the port or attribute list while using the iterator or it will get a ConcurrentModificationException.


Field Summary
private  java.util.Iterator _portListIterator
           
 
Constructor Summary
Entity.ContainedObjectsIterator()
          Create an iterator over all the contained objects, which for Entities are attributes and then ports.
 
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()
          The remove() method is not supported because is is not supported in NamedObj.ContainedObjectsIterator.remove().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_portListIterator

private java.util.Iterator _portListIterator
Constructor Detail

Entity.ContainedObjectsIterator

public Entity.ContainedObjectsIterator()
Create an iterator over all the contained objects, which for Entities are attributes and then ports.

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 or ports.

Specified by:
hasNext in interface java.util.Iterator
Overrides:
hasNext in class NamedObj.ContainedObjectsIterator
Returns:
True if there are more attributes or ports.

next

public java.lang.Object next()
Return the next element in the iteration. In this base class, this is the next attribute or port.

Specified by:
next in interface java.util.Iterator
Overrides:
next in class NamedObj.ContainedObjectsIterator
Returns:
The next attribute or port.

remove

public void remove()
The remove() method is not supported because is is not supported in NamedObj.ContainedObjectsIterator.remove().

Specified by:
remove in interface java.util.Iterator
Overrides:
remove in class NamedObj.ContainedObjectsIterator