コード例 #1
0
        public void TestMatches()
        {
            IBond testBond = null;
            var   matcher  = new AnyOrderQueryBond();

            Assert.IsFalse(matcher.Matches(testBond));
        }
コード例 #2
0
        public void TestMatches()
        {
            IBond             testBond = null;
            AnyOrderQueryBond matcher  = new AnyOrderQueryBond(new Mock <IChemObjectBuilder>().Object);

            Assert.IsFalse(matcher.Matches(testBond));
        }
コード例 #3
0
        public void TestAnyOrder()
        {
            var matcher  = new AnyOrderQueryBond();
            var testBond = Silent.ChemObjectBuilder.Instance.NewBond();

            foreach (var order in BondOrderTools.Values)
            {
                testBond.Order = order;
                Assert.IsTrue(matcher.Matches(testBond));
            }
        }
コード例 #4
0
        public void TestAnyOrder()
        {
            AnyOrderQueryBond matcher  = new AnyOrderQueryBond(new Mock <IChemObjectBuilder>().Object);
            IBond             testBond = new Bond();

            foreach (var order in BondOrderTools.Values)
            {
                testBond.Order = order;
                Assert.IsTrue(matcher.Matches(testBond));
            }
        }
コード例 #5
0
        public object Visit(ASTSimpleBond node, object data)
        {
            SMARTSBond bond = null;

            switch (node.BondType)
            {
            case SMARTSParserConstants.S_BOND:
                bond = new Smarts.OrderQueryBond(BondOrder.Single, builder);
                break;

            case SMARTSParserConstants.D_BOND:
                bond = new Smarts.OrderQueryBond(BondOrder.Double, builder);
                doubleBonds.Add(bond);
                break;

            case SMARTSParserConstants.T_BOND:
                bond = new Smarts.OrderQueryBond(BondOrder.Triple, builder);
                break;

            case SMARTSParserConstants.DOLLAR:
                bond = new Smarts.OrderQueryBond(BondOrder.Quadruple, builder);
                break;

            case SMARTSParserConstants.ANY_BOND:
                bond = new Smarts.AnyOrderQueryBond(builder);
                break;

            case SMARTSParserConstants.AR_BOND:
                bond = new Smarts.AromaticQueryBond(builder);
                break;

            case SMARTSParserConstants.R_BOND:
                bond = new Smarts.RingBond(builder);
                break;

            case SMARTSParserConstants.UP_S_BOND:
                bond = new Smarts.StereoBond(builder, StereoBond.Direction.Up, false);
                stereoBonds.Add(bond);
                break;

            case SMARTSParserConstants.DN_S_BOND:
                bond = new Smarts.StereoBond(builder, StereoBond.Direction.Down, false);
                stereoBonds.Add(bond);
                break;

            case SMARTSParserConstants.UP_OR_UNSPECIFIED_S_BOND:
                bond = new Smarts.StereoBond(builder, StereoBond.Direction.Up, true);
                stereoBonds.Add(bond);
                break;

            case SMARTSParserConstants.DN_OR_UNSPECIFIED_S_BOND:
                bond = new Smarts.StereoBond(builder, StereoBond.Direction.Down, true);
                stereoBonds.Add(bond);
                break;

            default:
                Trace.TraceError("Unparsed bond: " + node.ToString());
                break;
            }
            return(bond);
        }