final DfState lstate = new DfState(this); return new Iterator<int[]>() { boolean hasNext;
private DfPattern(IQueryAtomContainer query) { this.query = query; determineFilters(query); state = new DfState(query); }
/** * {@inheritDoc} */ @Override public Mappings matchAll(IAtomContainer mol) { if (mol.getAtomCount() < query.getAtomCount()) return new Mappings(query, mol, Collections.<int[]>emptySet()); if (mol.getAtomCount() > 0) checkCompatibleAPI(mol.getAtom(0)); DfState local = new DfState(state); local.setMol(mol); return filter(new Mappings(query, mol, local), query, mol); }
/** * Match the pattern at the provided root. * * @param root the root atom of the molecule * @return mappings * @see Mappings */ Mappings matchRoot(IAtom root) { checkCompatibleAPI(root); IAtomContainer mol = root.getContainer(); if (query.getAtomCount() > 0 && ((IQueryAtom) query.getAtom(0)).matches(root)) { DfState local = new DfState(state); local.setRoot(root); return filter(new Mappings(query, mol, local), query, mol); } else { return new Mappings(query, mol, Collections.<int[]>emptySet()); } }