本文整理汇总了C#中Bond.setFlag方法的典型用法代码示例。如果您正苦于以下问题:C# Bond.setFlag方法的具体用法?C# Bond.setFlag怎么用?C# Bond.setFlag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bond
的用法示例。
在下文中一共展示了Bond.setFlag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: handleRing
/// <summary> We call this method when a ring (depicted by a number) has been found.
///
/// </summary>
/// <param name="atom"> Description of the Parameter
/// </param>
private void handleRing(Atom atom)
{
//logger.debug("handleRing():");
double bondStat = bondStatusForRingClosure;
Bond bond = null;
Atom partner = null;
Atom thisNode = rings[thisRing];
// lookup
if (thisNode != null)
{
partner = thisNode;
bond = new Bond(atom, partner, bondStat);
if (bondIsAromatic)
{
bond.setFlag(CDKConstants.ISAROMATIC, true);
}
molecule.addBond(bond);
bondIsAromatic = false;
rings[thisRing] = null;
ringbonds[thisRing] = - 1;
}
else
{
/*
* First occurence of this ring:
* - add current atom to list
*/
rings[thisRing] = atom;
ringbonds[thisRing] = bondStatusForRingClosure;
}
bondStatusForRingClosure = 1;
}
示例2: parseSmiles
/// <summary> Parses a SMILES string and returns a Molecule object.
///
/// </summary>
/// <param name="smiles"> A SMILES string
/// </param>
/// <returns> A Molecule representing the constitution
/// given in the SMILES string
/// </returns>
/// <exception cref="InvalidSmilesException"> Exception thrown when the SMILES string
/// is invalid
/// </exception>
public virtual Molecule parseSmiles(System.String smiles)
{
//logger.debug("parseSmiles()...");
Bond bond = null;
nodeCounter = 0;
bondStatus = 0;
bondIsAromatic = false;
bool bondExists = true;
thisRing = - 1;
currentSymbol = null;
molecule = new Molecule();
position = 0;
// we don't want more than 1024 rings
rings = new Atom[1024];
ringbonds = new double[1024];
for (int f = 0; f < 1024; f++)
{
rings[f] = null;
ringbonds[f] = - 1;
}
char mychar = 'X';
char[] chars = new char[1];
Atom lastNode = null;
System.Collections.ArrayList atomStack = new System.Collections.ArrayList();
System.Collections.ArrayList bondStack = new System.Collections.ArrayList();
Atom atom = null;
do
{
try
{
mychar = smiles[position];
//logger.debug("");
//logger.debug("Processing: " + mychar);
if (lastNode != null)
{
//logger.debug("Lastnode: ", lastNode.GetHashCode());
}
if ((mychar >= 'A' && mychar <= 'Z') || (mychar >= 'a' && mychar <= 'z') || (mychar == '*'))
{
status = 1;
//logger.debug("Found a must-be 'organic subset' element");
// only 'organic subset' elements allowed
atom = null;
if (mychar == '*')
{
currentSymbol = "*";
atom = new PseudoAtom("*");
}
else
{
currentSymbol = getSymbolForOrganicSubsetElement(smiles, position);
if (currentSymbol != null)
{
if (currentSymbol.Length == 1)
{
if (!(currentSymbol.ToUpper()).Equals(currentSymbol))
{
currentSymbol = currentSymbol.ToUpper();
atom = new Atom(currentSymbol);
atom.Hybridization = CDKConstants.HYBRIDIZATION_SP2;
}
else
{
atom = new Atom(currentSymbol);
}
}
else
{
atom = new Atom(currentSymbol);
}
//logger.debug("Made atom: ", atom);
}
else
{
throw new InvalidSmilesException("Found element which is not a 'organic subset' element. You must " + "use [" + mychar + "].");
}
}
molecule.addAtom(atom);
//logger.debug("Adding atom ", atom.GetHashCode());
if ((lastNode != null) && bondExists)
{
//logger.debug("Creating bond between ", atom.Symbol, " and ", lastNode.Symbol);
bond = new Bond(atom, lastNode, bondStatus);
if (bondIsAromatic)
{
bond.setFlag(CDKConstants.ISAROMATIC, true);
}
//.........这里部分代码省略.........