use of ambit2.smarts.SmartsToChemObject in project ambit-mirror by ideaconsult.
the class RuleStateBondDistribution method calcDistribution.
public void calcDistribution(IQueryAtomContainer statePattern) {
int n = 0;
SmartsToChemObject stco = new SmartsToChemObject(SilentChemObjectBuilder.getInstance());
List<Integer> v2 = new ArrayList<Integer>();
List<Integer> v3 = new ArrayList<Integer>();
for (int i = 0; i < statePattern.getBondCount(); i++) {
if (hasRingClosure)
if (ringClosureBondIndex == i)
// It is obligatory that closure bond is not registered in the distribution arrays.
continue;
if (statePattern.getBond(i) instanceof DoubleNonAromaticBond) {
v2.add(new Integer(i));
continue;
}
if (statePattern.getBond(i) instanceof DoubleBondAromaticityNotSpecified) {
v2.add(new Integer(i));
continue;
}
if (statePattern.getBond(i) instanceof OrderQueryBond) {
OrderQueryBond bo = (OrderQueryBond) statePattern.getBond(i);
if (bo.getOrder() == IBond.Order.DOUBLE)
v2.add(new Integer(i));
if (bo.getOrder() == IBond.Order.TRIPLE)
v3.add(new Integer(i));
continue;
}
if (statePattern.getBond(i) instanceof SmartsBondExpression) {
IBond bo = stco.smartsExpressionToBond((SmartsBondExpression) statePattern.getBond(i));
if (bo != null) {
if (bo.getOrder() == IBond.Order.DOUBLE)
v2.add(new Integer(i));
if (bo.getOrder() == IBond.Order.TRIPLE)
v3.add(new Integer(i));
}
continue;
}
}
DBPositions = new int[v2.size()];
for (int i = 0; i < v2.size(); i++) DBPositions[i] = v2.get(i).intValue();
TBPositions = new int[v3.size()];
for (int i = 0; i < v3.size(); i++) TBPositions[i] = v3.get(i).intValue();
}
Aggregations