/**{@inheritDoc} */ @Override public boolean matches(IBond bond1, IBond bond2) { return ((IQueryBond) bond1).matches(bond2); } }
IQueryAtom qbeg = (IQueryAtom) qbond.getBegin(); IQueryAtom qend = (IQueryAtom) qbond.getEnd(); IBond bond = biter.next(); IAtom end = bond.getOther(beg); if (qbond.matches(bond) && feasible(bidx + 1, qend, end)) continue main; IBond bond = biter.next(); IAtom beg = bond.getOther(end); if (qbond.matches(bond) && feasible(bidx + 1, qbeg, beg)) continue main;
/** * {@inheritDoc} */ @Override public boolean matches(IBond bond1, IBond bond2) { return ((IQueryBond) bond1).matches(bond2); }
@Override public boolean matches(IBond bond) { boolean matchesLeft = left.matches(bond); if (right != null) { boolean matchesRight = right.matches(bond); if ("and".equals(operator)) { return matchesLeft && matchesRight; } else if ("or".equals(operator)) { return matchesLeft || matchesRight; } else { return false; } } else { if ("not".equals(operator)) { return (!matchesLeft); } else { return matchesLeft; } } }
@Override public boolean matches(IBond bond) { return ((IQueryBond) deref()).matches(bond); } }
@Override public boolean matches(IBond bond) { return ((IQueryBond) deref()).matches(bond); } }
@Override public boolean matches(IBond bond) { return ((IQueryBond) deref()).matches(bond); } }
@Override public boolean matches(IBond bond) { return ((IQueryBond) deref()).matches(bond); } }
/** * Determine if a bond from the molecule exists and if it is matched * by the query bond. If the match is feasible the current query bond index * is increment and stored on the stack. * * @param qbond bond from the query * @param bond bond from the molecule * @return the match was feasible and the state was stored */ private boolean feasible(IQueryBond qbond, IBond bond) { if (bond == null || !qbond.matches(bond)) return false; store(currBondIdx() + 1, null); return true; }
@Test public void queryMatch() { BondMatcher matcher = BondMatcher.forQuery(); IQueryBond bond1 = mock(IQueryBond.class); IBond bond2 = mock(IBond.class); IBond bond3 = mock(IBond.class); when(bond1.matches(bond2)).thenReturn(true); when(bond1.matches(bond3)).thenReturn(false); assertTrue(matcher.matches(bond1, bond2)); assertFalse(matcher.matches(bond1, bond3)); } }
IQueryAtom a2 = (IQueryAtom) b1.getAtom(1); for (IBond b2 : targetClone.bonds()) { boolean matches = bond.matches(b2); if (a1.matches(b2.getAtom(0)) && a2.matches(b2.getAtom(1)) && !matches) { bondRemovedT.add(b2);
IQueryAtom a2 = (IQueryAtom) b1.getAtom(1); for (IBond b2 : targetClone.bonds()) { boolean matches = bond.matches(b2); if (a1.matches(b2.getAtom(0)) && a2.matches(b2.getAtom(1)) && !matches) { bondRemovedT.add(b2);
/** {@inheritDoc} * * @param targetConatiner target container * @param targetBond target bond * @return true if bonds match */ @Override public boolean matches(TargetProperties targetConatiner, IBond targetBond) { if (this.smartQueryBond != null) { return smartQueryBond.matches(targetBond); } else { if (!isBondMatchFlag()) { return true; } if (isBondMatchFlag() && isBondTypeMatch(targetBond)) { return true; } if (isBondMatchFlag() && this.unsaturation == getUnsaturation(targetConatiner, targetBond)) { return true; } } return false; }
IQueryAtom a2 = (IQueryAtom) b1.getAtom(1); for (IBond b2 : targetClone.bonds()) { boolean matches = bond.matches(b2); if (a1.matches(b2.getAtom(0)) && a2.matches(b2.getAtom(1)) && !matches) { bondRemovedT.add(b2);
/** {@inheritDoc} * * @param targetContainer target container * @param targetBond target bond * @return true if bonds match */ @Override public boolean matches(IAtomContainer targetContainer, IBond targetBond) { if (this.smartQueryBond != null && queryBond == null) { return smartQueryBond.matches(targetBond); } else { if (!isBondMatchFlag()) { return true; } if (isBondMatchFlag() && isBondTypeMatch(targetBond)) { return true; } if (isBondMatchFlag() && this.unsaturation == getUnsaturation(targetContainer, targetBond)) { return true; } } return false; }
if (((IQueryBond) bond1).matches(bond2)) { IQueryAtom atom1 = (IQueryAtom) (bond1.getAtom(0)); IQueryAtom atom2 = (IQueryAtom) (bond1.getAtom(1));
/** * {@inheritDoc} * * @param targetBond target bond * @return true if bonds match */ @Override public boolean matches(IBond targetBond) { if (this.queryBond != null && queryBond instanceof IQueryBond) { return ((IQueryBond) queryBond).matches(targetBond); } else if ((queryBond != null && targetBond != null) && isBondMatchFlag() && isBondTypeMatch(targetBond)) { return true; } else if ((queryBond != null && targetBond != null) && !isBondMatchFlag() && isShouldMatchRings()) { if (queryBond.getFlag(CDKConstants.ISAROMATIC) && targetBond.getFlag(CDKConstants.ISAROMATIC)) { return true; } else if (!queryBond.getFlag(CDKConstants.ISAROMATIC) && !targetBond.getFlag(CDKConstants.ISAROMATIC)) { return true; } } else if ((queryBond != null && targetBond != null) && !isBondMatchFlag() && !isShouldMatchRings()) { return true; } return false; }