예제 #1
0
파일: Ullmann.cs 프로젝트: roddickchen/NCDK
        /// <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()));
        }
예제 #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()));
        }
예제 #3
0
        public void QueryMatch()
        {
            BondMatcher matcher = BondMatcher.CreateQueryMatcher();
            var         m_bond1 = new Mock <IQueryBond>(); IQueryBond bond1 = m_bond1.Object;
            var         m_bond2 = new Mock <IBond>(); IBond bond2 = m_bond2.Object;
            var         m_bond3 = new Mock <IBond>(); IBond bond3 = m_bond3.Object;

            m_bond1.Setup(n => n.Matches(bond2)).Returns(true);
            m_bond1.Setup(n => n.Matches(bond3)).Returns(false);
            Assert.IsTrue(matcher.Matches(bond1, bond2));
            Assert.IsFalse(matcher.Matches(bond1, bond3));
        }