use of ambit2.smarts.AliphaticSymbolQueryAtom in project ambit-mirror by ideaconsult.
the class SLN2ChemObject method slnAtomToQueryAtom.
public IQueryAtom slnAtomToQueryAtom(SLNAtom slnAt) {
currentConversionError = null;
currentConversionWarning = null;
if (slnAt == null) {
currentConversionError = "SNLAtom is null";
return null;
}
if (slnAt.atomType == 0) {
if (slnAt.atomExpression == null || slnAt.atomExpression.tokens.isEmpty()) {
if (slnAt.numHAtom == 0)
return new AnyAtom(SilentChemObjectBuilder.getInstance());
}
// Handle Any atom as an expression
// slnAt.numHAtom > 0 info is added into the expression
SmartsAtomExpression atExpr = slnAtomToSmartsAtomExpression(slnAt);
return atExpr;
}
// slnAt.atomType > 0
if (slnAt.atomType < SLNConst.GlobalDictOffseet) {
if (slnAt.atomType < SLNConst.elSymbols.length) {
if (slnAt.atomExpression == null || slnAt.atomExpression.tokens.isEmpty()) {
if (slnAt.numHAtom == 0) {
AliphaticSymbolQueryAtom atom = new AliphaticSymbolQueryAtom(SilentChemObjectBuilder.getInstance());
String symb = SLNConst.elSymbols[slnAt.atomType];
atom.setSymbol(symb);
atom.setAtomicNumber(PeriodicTable.getAtomicNumber(symb));
return atom;
} else {
// Since there are H atoms they define an expression
// slnAt.numHAtom > 0 info is added into the expression
}
}
// Create an expression
SmartsAtomExpression atExpr = slnAtomToSmartsAtomExpression(slnAt);
return atExpr;
} else {
// TODO
return null;
}
} else {
// TODO
return null;
}
}
use of ambit2.smarts.AliphaticSymbolQueryAtom in project ambit-mirror by ideaconsult.
the class SLN2ChemObject method queryAtomToSLNAtom.
public SLNAtom queryAtomToSLNAtom(IQueryAtom queryAtom) {
currentConversionError = null;
currentConversionWarning = null;
if (queryAtom == null) {
currentConversionError = "Atom is null";
return null;
}
if (queryAtom instanceof SmartsAtomExpression) {
// TODO
}
boolean FlagKnownAtomType = false;
SLNAtom slnAt = new SLNAtom(builder);
if (queryAtom instanceof AnyAtom) {
slnAt.atomType = 0;
slnAt.atomName = "Any";
FlagKnownAtomType = true;
}
if (FlagKnownAtomType)
return slnAt;
else
return null;
/*
* SLNAtom slnAt = new SLNAtom(builder);
String atomName = atom.getSymbol();
for (int i = 0; i < SLNConst.elSymbols.length; i++)
if (atomName.equals(SLNConst.elSymbols[i]))
{
slnAt.atomType = i;
break;
}
slnAt.atomName = atomName;
if (a instanceof AliphaticSymbolQueryAtom)
return (a.getSymbol());
if (a instanceof AromaticSymbolQueryAtom)
return (a.getSymbol().toLowerCase());
if (a instanceof AliphaticAtom)
return ("A");
if (a instanceof AromaticAtom)
return ("a");
*/
}
Aggregations