@ Override public int lastIndexOf ( Object o ) { IAtomContainer atomContainer = ( IAtomContainer ) o ; if ( ! atomContainer . getTitle ( ) . equals ( title ) ) return - 1 ; if ( atomContainer . getAtomCount ( ) != coordinates . get ( 0 ) . length ) return - 1 ; boolean coordsMatch ; for ( int j = coordinates . size ( ) - 1 ; j >= 0 ; j -- ) { Point3d [ ] coords = coordinates . get ( j ) ; coordsMatch = true ; for ( int i = 0 ; i < atomContainer . getAtomCount ( ) ; i ++ ) { Point3d p = atomContainer . getAtom ( i ) . getPoint3d ( ) ; if ( ! ( p . x == coords [ i ] . x && p . y == coords [ i ] . y && p . z == coords [ i ] . z ) ) { coordsMatch = false ; break ; } } if ( coordsMatch ) return j ; } return - 1 ; }
Returns the highest index at which the specific IAtomContainer appears in the list or - 1 if is not found .