Search in sources :

Example 1 with HydrogenAtom

use of org.openscience.cdk.isomorphism.matchers.smarts.HydrogenAtom in project cdk by cdk.

the class SmartsQueryVisitor method visit.

public Object visit(ASTExplicitAtom node, Object data) {
    IQueryAtom atom;
    String symbol = node.getSymbol();
    if ("*".equals(symbol)) {
        atom = new AnyAtom(builder);
    } else if ("A".equals(symbol)) {
        atom = new AliphaticAtom(builder);
    } else if ("a".equals(symbol)) {
        atom = new AromaticAtom(builder);
    } else if ("o".equals(symbol) || "n".equals(symbol) || "c".equals(symbol) || "s".equals(symbol) || "p".equals(symbol) || "as".equals(symbol) || "se".equals(symbol)) {
        String atomSymbol = symbol.substring(0, 1).toUpperCase() + symbol.substring(1);
        atom = new AromaticSymbolAtom(atomSymbol, builder);
    } else if ("H".equals(symbol)) {
        atom = new HydrogenAtom(builder);
        atom.setSymbol(symbol.toUpperCase());
        atom.setMassNumber(1);
    } else if ("D".equals(symbol)) {
        atom = new HydrogenAtom(builder);
        atom.setSymbol(symbol.toUpperCase());
        atom.setMassNumber(2);
    } else if ("T".equals(symbol)) {
        atom = new HydrogenAtom(builder);
        atom.setSymbol(symbol.toUpperCase());
        atom.setMassNumber(3);
    } else {
        atom = new AliphaticSymbolAtom(symbol, builder);
    }
    return atom;
}
Also used : AliphaticAtom(org.openscience.cdk.isomorphism.matchers.smarts.AliphaticAtom) AromaticSymbolAtom(org.openscience.cdk.isomorphism.matchers.smarts.AromaticSymbolAtom) HydrogenAtom(org.openscience.cdk.isomorphism.matchers.smarts.HydrogenAtom) AliphaticSymbolAtom(org.openscience.cdk.isomorphism.matchers.smarts.AliphaticSymbolAtom) IQueryAtom(org.openscience.cdk.isomorphism.matchers.IQueryAtom) AromaticAtom(org.openscience.cdk.isomorphism.matchers.smarts.AromaticAtom) AnyAtom(org.openscience.cdk.isomorphism.matchers.smarts.AnyAtom)

Aggregations

IQueryAtom (org.openscience.cdk.isomorphism.matchers.IQueryAtom)1 AliphaticAtom (org.openscience.cdk.isomorphism.matchers.smarts.AliphaticAtom)1 AliphaticSymbolAtom (org.openscience.cdk.isomorphism.matchers.smarts.AliphaticSymbolAtom)1 AnyAtom (org.openscience.cdk.isomorphism.matchers.smarts.AnyAtom)1 AromaticAtom (org.openscience.cdk.isomorphism.matchers.smarts.AromaticAtom)1 AromaticSymbolAtom (org.openscience.cdk.isomorphism.matchers.smarts.AromaticSymbolAtom)1 HydrogenAtom (org.openscience.cdk.isomorphism.matchers.smarts.HydrogenAtom)1