Beispiel #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()));
        }
Beispiel #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 CreateIdenticalFinder(IAtomContainer query)
        {
            bool isQuery = query is IQueryAtomContainer;

            return(CreateIdenticalFinder(query,
                                         isQuery ? AtomMatcher.CreateQueryMatcher() : AtomMatcher.CreateElementMatcher(),
                                         isQuery ? BondMatcher.CreateQueryMatcher() : BondMatcher.CreateOrderMatcher()));
        }
Beispiel #3
0
        public void QueryMatch()
        {
            AtomMatcher matcher = AtomMatcher.CreateQueryMatcher();
            var         m_atom1 = new Mock <IQueryAtom>();
            var         m_atom2 = new Mock <IAtom>();
            var         m_atom3 = new Mock <IAtom>();

            m_atom1.Setup(n => n.Matches(m_atom2.Object)).Returns(true);
            m_atom1.Setup(n => n.Matches(m_atom3.Object)).Returns(false);
            Assert.IsTrue(matcher.Matches(m_atom1.Object, m_atom2.Object));
            Assert.IsFalse(matcher.Matches(m_atom1.Object, m_atom3.Object));
        }