Exemplo 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()));
        }
Exemplo 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()));
        }
Exemplo n.º 3
0
        public void ElementPseudo()
        {
            AtomMatcher matcher = AtomMatcher.CreateElementMatcher();
            var         m_atom1 = new Mock <IPseudoAtom>();
            var         m_atom2 = new Mock <IPseudoAtom>();

            Assert.IsTrue(matcher.Matches(m_atom1.Object, m_atom2.Object));
            Assert.IsTrue(matcher.Matches(m_atom2.Object, m_atom1.Object));
        }
Exemplo n.º 4
0
        public void ElementMismatch()
        {
            AtomMatcher matcher = AtomMatcher.CreateElementMatcher();
            var         m_atom1 = new Mock <IAtom>();
            var         m_atom2 = new Mock <IAtom>();

            m_atom1.SetupGet(n => n.AtomicNumber).Returns(6);
            m_atom2.SetupGet(n => n.AtomicNumber).Returns(8);
            Assert.IsFalse(matcher.Matches(m_atom1.Object, m_atom2.Object));
            Assert.IsFalse(matcher.Matches(m_atom2.Object, m_atom1.Object));
        }