コード例 #1
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds an occurrence to and old-style sense.
		/// </summary>
		/// <param name="term">The ChkTerm (a sense or subsense).</param>
		/// <param name="reference">The Scripture reference.</param>
		/// <param name="wordform">The wordform.</param>
		/// <param name="keyword">The keyword (transliterated from Greek)</param>
		/// <param name="status">The rendering status.</param>
		/// <returns>The newly added ChkRef</returns>
		/// ------------------------------------------------------------------------------------
		protected IChkRef AddOccurrenceToOldStyleSense(IChkTerm term, int reference,
			IWfiWordform wordform, string keyword, KeyTermRenderingStatus status)
		{
			IChkRef occurrence = Cache.ServiceLocator.GetInstance<IChkRefFactory>().Create();
			term.OccurrencesOS.Add(occurrence);
			occurrence.KeyWord = m_factory.MakeString(keyword, m_wsEn);
			occurrence.Ref = reference;
			// If wordform is null, status must either be unassigned or ignored
			// If wordform is not null, status must either be assigned or auto-assigned
			Debug.Assert(((wordform == null) && (status == KeyTermRenderingStatus.Unassigned ||
				status == KeyTermRenderingStatus.Ignored)) ||
				((wordform != null) && (status == KeyTermRenderingStatus.Assigned ||
				status == KeyTermRenderingStatus.AutoAssigned)));
			occurrence.Status = status;
			occurrence.RenderingRA = wordform;

			return occurrence;
		}
コード例 #2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds an occurrence to and old-style sense.
		/// </summary>
		/// <param name="term">The ChkTerm (a sense or subsense).</param>
		/// <param name="reference">The Scripture reference.</param>
		/// <param name="wordform">The wordform.</param>
		/// <param name="keyword">The keyword (transliterated from Greek)</param>
		/// <param name="status">The rendering status.</param>
		/// <returns>The newly added ChkRef</returns>
		/// ------------------------------------------------------------------------------------
		protected ChkRef AddOccurrenceToOldStyleSense(ChkTerm term, int reference,
			IWfiWordform wordform, string keyword, KeyTermRenderingStatus status)
		{
			ChkRef occurrence = new ChkRef();
			term.OccurrencesOS.Append(occurrence);
			occurrence.KeyWord.UnderlyingTsString = m_factory.MakeString(keyword, m_wsEn);
			occurrence.Ref = reference;
			// If wordform is null, status must either be unassigned or ignored
			// If wordform is not null, status must either be assigned or auto-assigned
			Debug.Assert(((wordform == null) && (status == KeyTermRenderingStatus.Unassigned ||
				status == KeyTermRenderingStatus.Ignored)) ||
				((wordform != null) && (status == KeyTermRenderingStatus.Assigned ||
				status == KeyTermRenderingStatus.AutoAssigned)));
			occurrence.Status = status;
			occurrence.RenderingRA = wordform;

			return occurrence;
		}
コード例 #3
0
ファイル: KeyTermsTests.cs プロジェクト: sillsdev/WorldPad
		private static void CheckRenderingAndStatus(string expectedRendering, KeyTermRenderingStatus expectedStatus,
			IChkRef chkRef)
		{
			IWfiWordform wordform = chkRef.RenderingRA;
			if (expectedRendering == null)
				Assert.AreEqual(null, wordform);
			else
			{
				Assert.IsNotNull(wordform);
				Assert.AreEqual(expectedRendering, wordform.Form.VernacularDefaultWritingSystem);
			}
			Assert.AreEqual(expectedStatus, chkRef.Status);
		}