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


C# FdoCache.MoveOwningSequence方法代码示例

本文整理汇总了C#中SIL.FieldWorks.FDO.FdoCache.MoveOwningSequence方法的典型用法代码示例。如果您正苦于以下问题:C# FdoCache.MoveOwningSequence方法的具体用法?C# FdoCache.MoveOwningSequence怎么用?C# FdoCache.MoveOwningSequence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SIL.FieldWorks.FDO.FdoCache的用法示例。


在下文中一共展示了FdoCache.MoveOwningSequence方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RDEMergeSense

		/// <summary>
		/// This is called (by reflection) in an RDE view (DoMerges() method of XmlBrowseRDEView)
		/// that is creating LexSenses (and entries) by having
		/// the user enter a lexeme form and definition
		/// for a collection of words in a given semantic domain.
		/// On loss of focus, switch domain, etc., this method is called for each
		/// newly created sense, to determine whether it can usefully be merged into some
		/// pre-existing lex entry.
		///
		/// The idea is to do one of the following, in order of preference:
		/// (a) If there are other LexEntries which have the same LF and a sense with the
		/// same definition, add hvoDomain to the domains of those senses, and delete hvoSense.
		/// (b) If there is a pre-existing LexEntry (not the owner of one of newHvos)
		/// that has the same lexeme form, move hvoSense to that LexEntry.
		/// (c) If there is another new LexEntry (the owner of one of newHvos other than hvoSense)
		/// that has the same LF, we want to merge the two. In this case we expect to be called
		/// in turn for all of these senses, so to simplify, the one with the smallest HVO
		/// is kept and the others merged.
		/// </summary>
		/// <param name="hvoDomain"></param>
		/// <param name="tagList"></param>
		/// <param name="columns">List of XmlNode objects</param>
		/// <param name="cache"></param>
		/// <param name="hvoSense"></param>
		/// <param name="newHvos">Set of new senses (including hvoSense).</param>
		public static void RDEMergeSense(int hvoDomain, int tagList,
			List<XmlNode> columns, FdoCache cache, int hvoSense, Set<int> newHvos)
		{
			// The goal is to find a lex entry with the same lexeme form.form as hvoSense's LexEntry.
			ILexSense ls = LexSense.CreateFromDBObject(cache, hvoSense);
			ILexEntry leTarget = LexEntry.CreateFromDBObject(cache, ls.EntryID);
			string homographForm = leTarget.HomographForm;
			string sDefnTarget = ls.Definition.AnalysisDefaultWritingSystem.Text;

			// Check for pre-existing LexEntry which has the same homograph form
			bool fGotExactMatch;
			ILexEntry leSaved = FindBestLexEntryAmongstHomographs(cache, homographForm, sDefnTarget, leTarget, newHvos, hvoDomain, out fGotExactMatch);
			if (fGotExactMatch)
			{
				// delete the entry AND sense
				leTarget.DeleteUnderlyingObject();
				DeleteSense(cache, hvoDomain, tagList, hvoSense);
			}
			else if (leSaved != null)
			{
				// move the one and only sense of leTarget to leSaved...provided it has a compatible MSA
				// of the expected type.
				ILexSense sense = leTarget.SensesOS.FirstItem as ILexSense;
				if (sense.MorphoSyntaxAnalysisRA is MoStemMsa)
				{
					IMoMorphSynAnalysis newMsa = null;
					foreach (IMoMorphSynAnalysis msa in leSaved.MorphoSyntaxAnalysesOC)
					{
						if (msa is IMoStemMsa)
							newMsa = msa;
					}
					if (newMsa != null)
					{
						// Fix the MSA of the sense to point at one of the MSAs of the new owner.
						sense.MorphoSyntaxAnalysisRA = newMsa;
						// Move it to the new owner.
						cache.MoveOwningSequence(leTarget.Hvo, (int)LexEntry.LexEntryTags.kflidSenses, 0, 0,
							leSaved.Hvo, (int)LexEntry.LexEntryTags.kflidSenses, leSaved.SensesOS.Count);
						// delete the entry.
						leTarget.DeleteUnderlyingObject();
						// But NOT the sense from the domain...it just moved to another entry.
						//DeleteSense(cache, hvoDomain, tagList, hvoSense);
					}
				}
			}
			// else do nothing (no useful match, let the LE survive)
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:72,代码来源:LingOverrides.cs


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