Exemple #1
0
 public object Visit(ASTSimpleBond node, object data)
 {
     System.Console.Out.WriteLine(IndentString() + node + " [" + node.BondType + "]");
     ++indent;
     data = node.ChildrenAccept(this, data);
     --indent;
     return(data);
 }
Exemple #2
0
        public object Visit(ASTSimpleBond node, object data)
        {
            string bond     = "";
            int    bondType = node.BondType;

            switch (bondType)
            {
            case SMARTSParserConstants.ANY_BOND:
                bond = "~";
                break;

            case SMARTSParserConstants.S_BOND:
                bond = "-";
                break;

            case SMARTSParserConstants.D_BOND:
                bond = "=";
                break;

            case SMARTSParserConstants.T_BOND:
                bond = "#";
                break;

            case SMARTSParserConstants.AR_BOND:
                bond = ":";
                break;

            case SMARTSParserConstants.R_BOND:
                bond = "$~1";     // TODO: only one ring is assumed here. Should handle more
                break;

            case SMARTSParserConstants.UP_S_BOND:
            case SMARTSParserConstants.DN_S_BOND:
            case SMARTSParserConstants.UP_OR_UNSPECIFIED_S_BOND:
            case SMARTSParserConstants.DN_OR_UNSPECIFIED_S_BOND:
                bond = "-";
                break;
            }
            return(bond);
        }
Exemple #3
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);
        }