コード例 #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
ファイル: VentoFoggia.cs プロジェクト: roddickchen/NCDK
        /// <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
ファイル: AtomMatcherTest.cs プロジェクト: roddickchen/NCDK
        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));
        }