from nanotechsoftware.base import *
from nanotechsoftware.chemistry import *
from nanotechsoftware.chemistry.framework import *
from nanotechsoftware.chemistry.core import *
from nanotechsoftware.chemistry.predicate import *
from nanotechsoftware.chemistry.processor import *
from nanotechsoftware.chemistry.io import *
from nanotechsoftware.chemistry.match import *
from nanotechsoftware.chemistry.graph import *

import os

class IsTrue:
      def __call__(self, a):
        return 1 



pe = PredicateGraphEdit()
i = pe.insertNode(AtomPythonWrapperPredicate(IsTrue()))
j = pe.insertNode(AtomPythonWrapperPredicate(IsOxygen()))
pe.insertEdge(i, j, BondPythonWrapperPredicate(IsTrue()))
pg = createGraphPredicateWithComparators(pe)

mol = fromSmiles("c1cc(O)ccc1")
AssignIndexProcessor()(mol)
g = createGraphWithComparators(createGraphEdit(mol))

for m in pg.matchTotalUnique(g):
    for a in ComponentIteratorFactory.create(Atom, m):
        print "Atom", a.getIndex()
    print


