Hi all,
Forgive me for my slight ignorance. I searched the forum for the JAVA version of this method (not the Perl one) and found no matches, so I assumed
this' the right place to start.
Whenever I use this method when looping through a BondSet, I get the following exception thrown in Pipeline Pilot:
fromIndex < 0: -1
java.lang.IndexOutOfBoundsException: fromIndex < 0: -1
at java.util.BitSet.nextSetBit(BitSet.java:526)
at com.scitegic.pilot.chem.BondSet.hasMoreBonds(BondSet.java:402)
at com.scitegic.pilot.chem.BondSet\$BondIterator.hasNext(BondSet.java:552)
at ....
in this code, when looping through SGMap objects (from an SGMapper, after calling the init() method, setting query molecules & target molecule):
StringBuilder bInds = new StringBuilder( 50 );
for( Bond b : bonds ) {
if( bonds.hasMoreBonds() ) bInds.append( b.getIndex() + "," );
else bInds.append( b.getIndex() );
bondIndex++;
}
It's interesting to note that when replacing that with this code, I don't get the exception thrown:
int bondIndex = 0;
for( Bond b : bonds ) {
if( bondIndex < bonds.getNumBonds() - 1 ) bInds.append( b.getIndex() + pairSeparator );
else bInds.append( b.getIndex() );
bondIndex++;
}
So, has anyone else found this occur? It baffles me as I do exactly the same thing with AtomSet objects from the same SGMap objects -
using the AtomSet.hasMoreAtoms() method, and don't get this error!
Thanks in advance,
Ed.