edu.sdsc.mbt
Class StructureComponentIterator

java.lang.Object
  extended byedu.sdsc.mbt.StructureComponentIterator
All Implemented Interfaces:
java.io.Serializable

public class StructureComponentIterator
extends java.lang.Object
implements java.io.Serializable

Defines a standard interface to describe a filter implementation class. A filter is repsonsible for implementing two methods which should return values according to what subset of StructureComponent objects it will accept or reject. The "type" method should return the StructureComponentRegistry TYPE that it will process (this will also automatically limit the type of StructureComponent objects passed to its "accept" method). The "accept" method should return TRUE if the given StructureComponent object should be accepted or FALSE if it should be rejected.

For example, to define a filter which filters Atom components which only accepts C-Alpha atoms, one could declare the following class (in this example, its declared as an internal class):

     StructureComponentFilter filter = new StructureComponentFilter( )
     {
         public String type( )
         {
             return StructureComponentRegistry.TYPE_ATOM;
         }

         public boolean accept( StructureComponent sc )
         {
             return ((Atom)sc).name.startsWith( "CA" );
         }
     };
     StructureComponentIterator iterator =
        structure.getStructureComponentIterator( filter );
  

Author:
John L. Moreland
See Also:
StructureComponentFilter, Structure,

, Serialized Form


Constructor Summary
StructureComponentIterator(Structure structure, StructureComponentFilter filter)
          Construct a StructureComponentIterator for the given structure using the given filter to describe the desired subset.
 
Method Summary
 boolean hasMore()
          Return true if the Iterator has more matches or false otherwise.
 void next(StructureComponent structureComponent)
          Iterates through a set of StructureComponent objects.
 int nextIndex()
          Returns the index of the next match or -1 if there are no more matches.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StructureComponentIterator

public StructureComponentIterator(Structure structure,
                                  StructureComponentFilter filter)
                           throws java.lang.ClassNotFoundException,
                                  java.lang.InstantiationException,
                                  java.lang.IllegalAccessException
Construct a StructureComponentIterator for the given structure using the given filter to describe the desired subset.

Method Detail

hasMore

public boolean hasMore()
Return true if the Iterator has more matches or false otherwise.


nextIndex

public int nextIndex()
Returns the index of the next match or -1 if there are no more matches.


next

public void next(StructureComponent structureComponent)
          throws java.util.NoSuchElementException
Iterates through a set of StructureComponent objects.

Throws:
java.util.NoSuchElementException