Package org.openscience.cdk.interfaces

Examples of org.openscience.cdk.interfaces.IReaction


  public void redo() {
    chemModel.getMoleculeSet().removeAtomContainer(movedContainer);
    if(chemModel.getReactionSet()==null)
        chemModel.setReactionSet(chemModel.getBuilder().newInstance(IReactionSet.class));
    IReaction reaction = ReactionSetManipulator.getReactionByReactionID(chemModel.getReactionSet(), reactionID);
    if(reaction==null){
        reaction = chemModel.getBuilder().newInstance(IReaction.class);
        reaction.setID(reactionID);
          chemModel.getReactionSet().addReaction(reaction);
    }
    IAtomContainer mol=chemModel.getBuilder().newInstance(IAtomContainer.class,movedContainer);
    mol.setID(movedContainer.getID());
    if(reactantOrProduct)
      reaction.addReactant(mol);
    else
      reaction.addProduct(mol);
    chemModel.getMoleculeSet().removeAtomContainer(oldContainer);
        if(chemModel.getMoleculeSet().getAtomContainerCount()==0)
            chemModel.getMoleculeSet().addAtomContainer(chemModel.getBuilder().newInstance(IAtomContainer.class));
  }
View Full Code Here


    IAtomContainerSet reactantsorproducts;
    if(reactantOrProduct)
      reactantsorproducts = ReactionSetManipulator.getReactionByReactionID(chemModel.getReactionSet(), reactionID).getReactants();
    else
      reactantsorproducts = ReactionSetManipulator.getReactionByReactionID(chemModel.getReactionSet(), reactionID).getProducts();
    IReaction reaction = ReactionSetManipulator.getReactionByReactionID(chemModel.getReactionSet(), reactionID);
    int count=0;
    for(IAtomContainer mol : reactantsorproducts.atomContainers()){
      if(mol.getID().equals(movedContainer.getID())){
        reactantsorproducts.removeAtomContainer(count);
        break;
      }
      count++;
    }
    if(reaction.getReactantCount()==0 && reaction.getProductCount()==0)
        chemModel.getReactionSet().removeReaction(reaction);
    if(chemModel.getReactionSet().getReactionCount()==0)
        chemModel.setReactionSet(null);
  }
View Full Code Here

TOP

Related Classes of org.openscience.cdk.interfaces.IReaction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.