当前位置: 首页>>代码示例>>C#>>正文


C# Bond.setFlag方法代码示例

本文整理汇总了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;
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:38,代码来源:SmilesParser.cs

示例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);
							}
//.........这里部分代码省略.........
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:101,代码来源:SmilesParser.cs


注:本文中的Bond.setFlag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。