FreeHEP API
Version current

hep.graphics.heprep.ref
Class DefaultHepRepIterator

java.lang.Object
  extended byhep.graphics.heprep.ref.DefaultHepRepIterator
All Implemented Interfaces:
HepRepIterator, Iterator

public class DefaultHepRepIterator
extends Object
implements HepRepIterator

Fast iterator, which allows for iteration of all HepRepInstances in a HepRepInstanceTree or for iteration of a specific layer. It also features a callback to a HepRepListener to signal changes in attributes.

Version:
$Id: DefaultHepRepIterator.java,v 1.32 2005/02/27 22:58:49 duns Exp $
Author:
M.Donszelmann
Source Code:
DefaultHepRepIterator.java

Constructor Summary
DefaultHepRepIterator(List instanceTrees)
          Creates a HepRepIterator for the given list of InstanceTrees.
DefaultHepRepIterator(List instanceTrees, List layers)
          Creates a HepRepIterator for the given list of InstanceTrees and set of layers.
DefaultHepRepIterator(List instanceTrees, List layers, boolean iterateFrames)
          Creates a HepRepIterator for the given list of InstanceTrees and set of layers.
DefaultHepRepIterator(List instanceTrees, List layers, Set types, boolean iterateFrames)
          Creates a HepRepIterator for the given list of InstanceTrees and set of layers.
 
Method Summary
 void addHepRepAttributeListener(String name, HepRepAttributeListener l)
          Add a listener to be informed about a certain attribute's changes while the iteration is ongoing.
 void addHepRepFrameListener(HepRepFrameListener l)
          Adds a listener to be informed about attribute changes while iterating.
 boolean drawAsFrame()
          Returns true if the current instance, just delivered by nextInstance(), is to be drawn as a frame.
 boolean hasNext()
          Prepares the next instance and returns true if exists.
 Object next()
           
 HepRepInstance nextInstance()
          Returns next instance.
 void remove()
          Removes the current instance, however this is not permitted.
 void removeHepRepAttributeListener(String name, HepRepAttributeListener l)
          Remove a listener for a certain attribute.
 void removeHepRepFrameListener(HepRepFrameListener l)
          Removes a listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultHepRepIterator

public DefaultHepRepIterator(List instanceTrees)
Creates a HepRepIterator for the given list of InstanceTrees. Layer changes are reported but ignored.

Parameters:
instanceTrees - to be iterated over.

DefaultHepRepIterator

public DefaultHepRepIterator(List instanceTrees,
                             List layers)
Creates a HepRepIterator for the given list of InstanceTrees and set of layers.

Parameters:
instanceTrees - to be iterated over.
layers - to be used in iteration.

DefaultHepRepIterator

public DefaultHepRepIterator(List instanceTrees,
                             List layers,
                             boolean iterateFrames)
Creates a HepRepIterator for the given list of InstanceTrees and set of layers.

Parameters:
instanceTrees - to be iterated over.
layers - to be used in iteration.
iterateFrames - iterate separately over a frame layer for each layer.

DefaultHepRepIterator

public DefaultHepRepIterator(List instanceTrees,
                             List layers,
                             Set types,
                             boolean iterateFrames)
Creates a HepRepIterator for the given list of InstanceTrees and set of layers.

Parameters:
instanceTrees - to be iterated over.
layers - to be used in iteration.
types - to be used in iteration.
iterateFrames - iterate separately over a frame layer for each layer.
Method Detail

addHepRepAttributeListener

public void addHepRepAttributeListener(String name,
                                       HepRepAttributeListener l)
Add a listener to be informed about a certain attribute's changes while the iteration is ongoing. Only one listener per attribute is allowed.

Specified by:
addHepRepAttributeListener in interface HepRepIterator
Parameters:
name - attribute name
l - listener to be added.

removeHepRepAttributeListener

public void removeHepRepAttributeListener(String name,
                                          HepRepAttributeListener l)
Remove a listener for a certain attribute.

Specified by:
removeHepRepAttributeListener in interface HepRepIterator
Parameters:
name - attribute name
l - listener to be removed.

addHepRepFrameListener

public void addHepRepFrameListener(HepRepFrameListener l)
Description copied from interface: HepRepIterator
Adds a listener to be informed about attribute changes while iterating.

Specified by:
addHepRepFrameListener in interface HepRepIterator
Parameters:
l - to be added.

removeHepRepFrameListener

public void removeHepRepFrameListener(HepRepFrameListener l)
Description copied from interface: HepRepIterator
Removes a listener.

Specified by:
removeHepRepFrameListener in interface HepRepIterator
Parameters:
l - to be removed.

nextInstance

public HepRepInstance nextInstance()
Description copied from interface: HepRepIterator
Returns next instance.

Specified by:
nextInstance in interface HepRepIterator
Returns:
the next HepRepInstance

next

public Object next()
Specified by:
next in interface Iterator
Returns:
the next HepRepInstance

hasNext

public boolean hasNext()
Prepares the next instance and returns true if exists. Successive calls to hasNext() without calling next() or nextInstance() are ignored. The instances are walked through the tree in in-order traversal.

Specified by:
hasNext in interface HepRepIterator
Returns:
true if there exists a next HepRepInstance

drawAsFrame

public boolean drawAsFrame()
Returns true if the current instance, just delivered by nextInstance(), is to be drawn as a frame.

Specified by:
drawAsFrame in interface HepRepIterator

remove

public void remove()
            throws UnsupportedOperationException
Removes the current instance, however this is not permitted.

Specified by:
remove in interface Iterator
Throws:
UnsupportedOperationException - in all cases.

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.