當前位置: 首頁>>代碼示例>>Java>>正文


Java MolBond.getFlags方法代碼示例

本文整理匯總了Java中chemaxon.struc.MolBond.getFlags方法的典型用法代碼示例。如果您正苦於以下問題:Java MolBond.getFlags方法的具體用法?Java MolBond.getFlags怎麽用?Java MolBond.getFlags使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在chemaxon.struc.MolBond的用法示例。


在下文中一共展示了MolBond.getFlags方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: resetEZ

import chemaxon.struc.MolBond; //導入方法依賴的package包/類
public static void resetEZ (Molecule mol) {
MolBond[] bonds = mol.getBondArray();
for (int i = 0; i < bonds.length; ++i) {
    MolBond b = bonds[i];
    int type = b.getType();
    if (type == 2) {
	b.setFlags(0, MolBond.CTUMASK);
    }
    else if (type == 1) {
	int flags = b.getFlags() & MolBond.STEREO1_MASK;
	if (flags  == (MolBond.UP | MolBond.DOWN)) {
	    // WAVY flag... 
	    b.setFlags(0, MolBond.STEREO1_MASK);
	}
    }
}
   }
 
開發者ID:ncats,項目名稱:lychi,代碼行數:18,代碼來源:ChemUtil.java

示例2: isSingleStereo

import chemaxon.struc.MolBond; //導入方法依賴的package包/類
/**
 * Check if the bond that R atom is part of is single stereo bond or not
 *
 * @param rAtom the R atom to be checked
 * @return true or false
 * @throws StructureException
 */
protected static boolean isSingleStereo(MolAtom rAtom) throws StructureException {
    int bondCount = rAtom.getBondCount();
    if (bondCount != 1) {
        throw new StructureException("RGroup is allowed to have single connection to other atom");
    }

    MolBond bond = rAtom.getBond(0);
    int bondType = bond.getFlags() & MolBond.STEREO1_MASK;

    return bondType == MolBond.UP || bondType == MolBond.DOWN || bondType == MolBond.WAVY;
}
 
開發者ID:PistoiaHELM,項目名稱:HELMNotationToolkit,代碼行數:19,代碼來源:StructureParser.java

示例3: adjustBondAnnotations

import chemaxon.struc.MolBond; //導入方法依賴的package包/類
protected void adjustBondAnnotations () {

	for (int i = 0; i < bonds.length; ++i) {
	    MolBond bnd = bonds[i];
	    int flags = bflags[i];

	    int type = bnd.getFlags() & MolBond.TYPE_MASK;
	    int order = flags & MolBond.TYPE_MASK;
	    int stereo = flags & MolBond.STEREO_MASK;
	    int topo = flags & MolBond.TOPOLOGY_MASK;
	    int chiral = flags & MolBond.REACTING_CENTER_MASK;
	    if (order == type) {
		// restore the flags if the bond type is the same
		bnd.setFlags(stereo, MolBond.STEREO_MASK);
		bnd.setFlags(topo, MolBond.TOPOLOGY_MASK);
		bnd.setFlags(chiral, MolBond.REACTING_CENTER_MASK);
	    }
	    else if (type == 1) {
		/* 
		 * here we reset all stereo flags of a mobile hydrogen
		 */
		if (order != type) {
		    // make sure previously generated tautomers turn off
		    //  the stereo flag for this bond
		    for (Molecule tau : tautomers) {
			tau.getBond(i).setFlags(0, MolBond.STEREO_MASK);
			tau.getBond(i).setFlags(0, MolBond.TOPOLOGY_MASK);
			tau.getBond(i).setFlags
			    (0, MolBond.REACTING_CENTER_MASK);
		    }
		    bflags[i] &= ~MolBond.STEREO_MASK;
		}
		bnd.setFlags(0, MolBond.STEREO_MASK);
		bnd.setFlags(0, MolBond.TOPOLOGY_MASK);
		bnd.setFlags(0, MolBond.REACTING_CENTER_MASK);
	    }

	    if (debug) {
		if (stereo != 0 && order != type) {
		    logger.info
			("** warning: "
			 +"stereo flag (" + stereo 
			 +") is ignored due to bond type changing from " 
			 + order + " to " + bnd.getType() 
			 + " at bond " +(i+1)+":"
			 + (mol.indexOf(bnd.getAtom1())+1) 
			 + "-" + (mol.indexOf(bnd.getAtom2())+1));
		}
		if (topo != 0) {
		    logger.info
			("** warning: "
			 +"topology flag (" + topo 
			 +") is ignored due to bond type changing from " 
			 + order + " to " + bnd.getType() 
			 + " at bond " + (i+1)+":"
			 + (mol.indexOf(bnd.getAtom1())+1) 
			 + "-" + (mol.indexOf(bnd.getAtom2())+1));
		}
		if (chiral != 0) {
		    logger.info
			("** warning: "
			 +"chiral flag (" + chiral
			 +") is ignored due to bond type changing from " 
			 + order + " to " + bnd.getType() 
			 + " at bond " + (i+1)+":"
			 + (mol.indexOf(bnd.getAtom1())+1) 
			 + "-" + (mol.indexOf(bnd.getAtom2())+1));
		}
	    }
	}
    }
 
開發者ID:ncats,項目名稱:lychi,代碼行數:72,代碼來源:SayleDelanyTautomerGenerator.java

示例4: countBondParity

import chemaxon.struc.MolBond; //導入方法依賴的package包/類
static int countBondParity (MolAtom atom, int dir) {
    int count = 0;

    Molecule mol = (Molecule)atom.getParent();
    if (DEBUG) {
        logger.info("** Atom "+(mol.indexOf(atom)+1));
    }
    for (int n = 0; n < atom.getBondCount(); ++n) {
        MolBond nb = atom.getBond(n);
        int parity = nb.getFlags() & MolBond.STEREO1_MASK;
        if (parity == MolBond.UP) {
            if (DEBUG) {
                System.err.println(" UP: "+(mol.indexOf(nb.getAtom1())+1)
                                   +"-"+(mol.indexOf(nb.getAtom2())+1));
            }
            if (dir < 0) {
                if (nb.getAtom1() == atom) {
                    ++count;
                }
            }
            else if (dir > 0) {
                if (nb.getAtom2() == atom) {
                    ++count;
                }
            }
            else {
                ++count;
            }
        }
        else if (parity == MolBond.DOWN) {
            if (DEBUG) {
                System.err.println(" DOWN: "+(mol.indexOf(nb.getAtom1())+1)
                                   +"-"+(mol.indexOf(nb.getAtom2())+1));
            }
            if (dir < 0) {
                if (nb.getAtom1() == atom) {
                    ++count;
                }
            }
            else if (dir > 0) {
                if (nb.getAtom2() == atom) {
                    ++count;
                }
            }
            else {
                ++count;
            }
        }
    }
    return count;
}
 
開發者ID:ncats,項目名稱:lychi,代碼行數:52,代碼來源:LyChIStandardizer.java


注:本文中的chemaxon.struc.MolBond.getFlags方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。