|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.sdsc.mbt.StructureComponentIterator
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 );
StructureComponentFilter
,
Structure
,
,
Serialized FormConstructor 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 |
public StructureComponentIterator(Structure structure, StructureComponentFilter filter) throws java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessException
Method Detail |
public boolean hasMore()
public int nextIndex()
public void next(StructureComponent structureComponent) throws java.util.NoSuchElementException
java.util.NoSuchElementException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |