/** * Returns the minimum bond order that this atom currently has in the context of this * AtomContainer. * * @param atom The atom * @return The minimum bond order that this atom currently has */ public Order getMinimumBondOrder(IAtom atom) { IBond.Order min = IBond.Order.QUADRUPLE; for (int i = 0; i < bondCount; i++) { if (bonds[i].contains(atom) && bonds[i].getOrder().numeric() < min.numeric()) { min = bonds[i].getOrder(); } } return min; }
/** * Returns the maximum bond order that this atom currently has in the context of this * AtomContainer. * * @param atom The atom * @return The maximum bond order that this atom currently has */ public Order getMaximumBondOrder(IAtom atom) { IBond.Order max = IBond.Order.SINGLE; for (int i = 0; i < bondCount; i++) { if (bonds[i].contains(atom) && bonds[i].getOrder().numeric() > max.numeric()) { max = bonds[i].getOrder(); } } return max; }
/** * Returns the sum of the bond orders for a given Atom. * * @param atom The atom * @return The number of bond orders for this atom * @deprecated Replaced by <code>AtomContainerManipulator#getBondOrderSum(IAtomContainer, IAtom) * </code> */ public double getBondOrderSum(IAtom atom) { double count = 0; for (int i = 0; i < bondCount; i++) { if (bonds[i].contains(atom)) { IBond.Order order = bonds[i].getOrder(); if (order != null) { count += order.numeric(); } } } return count; }
@Test public void testAnyOrder() { AnyOrderQueryBond matcher = new AnyOrderQueryBond(mock(IChemObjectBuilder.class)); IBond testBond = new Bond(); for (IBond.Order order : IBond.Order.values()) { testBond.setOrder(order); Assert.assertTrue(matcher.matches(testBond)); } }