Ejemplo n.º 1
0
  /**
   * This function returns null if no isomorphism is found
   *
   * @param container
   * @return
   */
  public List<IAtom> getIsomorphismMapping(IAtomContainer container) {
    if (query == null) return null;
    target = container;
    FlagStoreIsomorphismNode = true;
    isomorphismNodes.clear();

    if (query.getAtomCount() == 1) {
      SMARTSAtom qa = (SMARTSAtom) query.getAtom(0);
      for (int i = 0; i < target.getAtomCount(); i++) {
        if (qa.matches(target.getAtom(i))) {
          List<IAtom> v = new ArrayList<IAtom>();
          v.add(target.getAtom(i));
          return (v);
        }
      }
      return null;
    }

    TopLayer.setAtomTopLayers(target, TopLayer.TLProp);
    executeSequence(true);

    if (isomorphismFound) {
      // Getting the data from the Node
      Node node = isomorphismNodes.get(0);
      List<IAtom> v = new ArrayList<IAtom>();
      for (int i = 0; i < node.atoms.length; i++) v.add(node.atoms[i]);

      return (v);
    } else return (null);
  }
Ejemplo n.º 2
0
  /**
   * If no isomorphism is found the result is empty vector
   *
   * @param container
   * @return
   */
  public List<List<IAtom>> getAllIsomorphismMappings(IAtomContainer container) {
    if (query == null) return null;
    target = container;
    FlagStoreIsomorphismNode = true;
    isomorphismNodes.clear();
    List<List<IAtom>> result = new ArrayList<List<IAtom>>();

    if (query.getAtomCount() == 1) {
      SMARTSAtom qa = (SMARTSAtom) query.getAtom(0);
      for (int i = 0; i < target.getAtomCount(); i++) {
        if (qa.matches(target.getAtom(i))) {
          List<IAtom> v = new ArrayList<IAtom>();
          v.add(target.getAtom(i));
          result.add(v);
        }
      }
      return result;
    }

    TopLayer.setAtomTopLayers(target, TopLayer.TLProp);
    executeSequence(false);

    if (isomorphismFound) {
      // Getting the data from the all stored Nodes
      for (int k = 0; k < isomorphismNodes.size(); k++) {
        Node node = isomorphismNodes.get(k);
        List<IAtom> v = new ArrayList<IAtom>();
        for (int i = 0; i < node.atoms.length; i++) v.add(node.atoms[i]);
        result.add(v);
      }
    }
    return result;
  }
Ejemplo n.º 3
0
  public boolean hasIsomorphism(IAtomContainer container) {
    target = container;
    FlagStoreIsomorphismNode = false;
    isomorphismNodes.clear();

    if (query.getAtomCount() == 1) return (singleAtomIsomorphism());

    TopLayer.setAtomTopLayers(target, TopLayer.TLProp);
    executeSequence(true);
    return (isomorphismFound);
  }