Esempio n. 1
0
        /// <summary>
        /// Create a pattern which can be used to find molecules which contain the
        /// <paramref name="query"/> structure.
        /// </summary>
        /// <param name="query">the substructure to find</param>
        /// <returns>a pattern for finding the <paramref name="query"/></returns>
        public static new Pattern CreateSubstructureFinder(IAtomContainer query)
        {
            bool isQuery = query is IQueryAtomContainer;

            return(new Ullmann(query, isQuery ? AtomMatcher.CreateQueryMatcher() : AtomMatcher.CreateElementMatcher(),
                               isQuery ? BondMatcher.CreateQueryMatcher() : BondMatcher.CreateOrderMatcher()));
        }
Esempio n. 2
0
        /// <summary>
        /// Create a pattern which can be used to find molecules which are the same
        /// as the <paramref name="query"/> structure.
        /// </summary>
        /// <param name="query">the substructure to find</param>
        /// <returns>a pattern for finding the <paramref name="query"/></returns>
        public static new Pattern FindIdentical(IAtomContainer query)
        {
            bool isQuery = query is IQueryAtomContainer;

            return(FindIdentical(query,
                                 isQuery ? AtomMatcher.CreateQueryMatcher() : AtomMatcher.CreateElementMatcher(),
                                 isQuery ? BondMatcher.CreateQueryMatcher() : BondMatcher.CreateOrderMatcher()));
        }
Esempio n. 3
0
        public void AliphaticMatch()
        {
            BondMatcher matcher = BondMatcher.CreateOrderMatcher();
            var         m_bond1 = new Mock <IBond>(); IBond bond1 = m_bond1.Object;
            var         m_bond2 = new Mock <IBond>(); IBond bond2 = m_bond2.Object;

            m_bond1.SetupGet(n => n.IsAromatic).Returns(false);
            m_bond2.SetupGet(n => n.IsAromatic).Returns(false);
            m_bond1.SetupGet(n => n.Order).Returns(BondOrder.Single);
            m_bond2.SetupGet(n => n.Order).Returns(BondOrder.Single);
            Assert.IsTrue(matcher.Matches(bond1, bond2));
            Assert.IsTrue(matcher.Matches(bond2, bond1));
        }