• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# DomainServices.AnalysisOccurrence类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



AnalysisOccurrence类属于SIL.FieldWorks.FDO.DomainServices命名空间,在下文中一共展示了AnalysisOccurrence类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetAllAnalyses

		/// <summary>
		/// Get all of the Analyses associated with a single ConstChartWordGroup.
		/// Returns null if there is a problem finding them. Includes PunctuationForms.
		/// </summary>
		/// <returns></returns>
		public IEnumerable<IAnalysis> GetAllAnalyses()
		{
			if (!IsValidRef)
				return null;

			var point1 = new AnalysisOccurrence(BeginSegmentRA, BeginAnalysisIndex);
			var point2 = new AnalysisOccurrence(EndSegmentRA, EndAnalysisIndex);
			return point1.GetAdvancingOccurrencesInclusiveOf(point2);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:14,代码来源:OverridesLing_Disc.cs


示例2: CallGetWordGroupCellsBorderingChOrph

		internal void CallGetWordGroupCellsBorderingChOrph(AnalysisOccurrence occurrence,
			out ChartLocation precCell, out ChartLocation follCell)
		{
			var iPara = m_ccl.CallGetParaIndexForOccurrence(occurrence);
			Assert.Greater(iPara, -1, "Can't get ChOrph paragraph index.");
			var offset = occurrence.GetMyBeginOffsetInPara();
			Assert.Greater(offset, -1, "Can't get ChOrph offset.");
			m_ccl.GetWordGroupCellsBorderingChOrph(iPara, offset, out precCell, out follCell);
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:9,代码来源:ConstituentChartDatabaseTests.cs


示例3: Sandbox

		/// <summary>
		/// Create a new one.
		/// </summary>
		/// <param name="cache"></param>
		/// <param name="ss"></param>
		/// <param name="choices"></param>
		/// <param name="mediator"></param>
		public Sandbox(FdoCache cache, Mediator mediator, IVwStylesheet ss,
			InterlinLineChoices choices, AnalysisOccurrence selected, FocusBoxController focusBox)
			: this(cache, mediator, ss, choices)
		{
			FocusBox = focusBox;
			m_interlinDoc = focusBox.InterlinDoc;
			m_occurrenceSelected = selected;
			// Finish initialization with occurrence context.
			LoadForWordBundleAnalysis(m_occurrenceSelected.Analysis.Hvo);
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:17,代码来源:Sandbox.cs


示例4: Save

		/// <summary>
		/// Saves the given AnalysisOccurrence in the InterlinMaster.
		/// </summary>
		/// <param name="point"></param>
		/// <param name="fPersistNow">if true, this annotation will persist.</param>
		/// <param name="index">The index of the selected text in the list</param>
		public void Save(AnalysisOccurrence point, bool fPersistNow, int index, Mediator mediator)
		{
			if (point == null || !point.IsValid)
			{
				Reset(index, mediator); // let's just reset for an empty location.
				return;
			}
			var iParaInText = point.Segment.Paragraph.IndexInOwner;
			var begOffset = point.Segment.GetAnalysisBeginOffset(point.Index);
			var endOffset = point.HasWordform ? begOffset + point.BaselineText.Length : begOffset;

			Save(index, iParaInText, begOffset, endOffset, fPersistNow, mediator);
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:19,代码来源:InterAreaBookmark.cs


示例5: ParseText

		private void ParseText()
		{
			using (var pp = new ParagraphParser(Cache))
			{
				pp.Parse(m_txtPara);
			}
			var seg = m_txtPara.SegmentsOS[0];
			var wordArray = seg.AnalysesRS.ToArray();
			var cwords = wordArray.Length;
			m_occurrences = new AnalysisOccurrence[cwords];
			for (var i = 0; i < cwords; i++)
				m_occurrences[i] = new AnalysisOccurrence(seg, i);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:13,代码来源:ReferenceAdjusterServiceTests.cs


示例6: GetParaAnalyses

		private static AnalysisOccurrence[] GetParaAnalyses(IStTxtPara para)
		{
			var result = new List<AnalysisOccurrence>();
			var point1 = new AnalysisOccurrence(para.SegmentsOS[0], 0);
			if (!point1.IsValid)
				return result.ToArray();
			do
			{
				if (point1.HasWordform)
					result.Add(point1);
				point1 = point1.NextWordform();
			} while (point1 != null && point1.IsValid);
			return result.ToArray();
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:14,代码来源:InterlinRibbonTests.cs


示例7: RibbonLayout

		public void RibbonLayout()
		{
			EndSetupTask();
			// SUT#1 (but not one that changes data)
			m_ribbon.MakeRoot();
			m_ribbon.CallLayout();
			Assert.IsNotNull(m_ribbon.RootBox, "layout should produce some root box");
			var widthEmpty = m_ribbon.RootBox.Width;
			var glosses = new AnalysisOccurrence[0];

			// SUT#2 This changes data! Use a UOW.
			UndoableUnitOfWorkHelper.Do("RibbonLayoutUndo", "RibbonLayoutRedo",
										Cache.ActionHandlerAccessor, () => glosses = GetParaAnalyses(m_firstPara));

			Assert.Greater(glosses.Length, 0);
			var firstGloss = new List<AnalysisOccurrence> { glosses[0] };

			// SUT#3 This changes some internal data! Use a UOW.
			UndoableUnitOfWorkHelper.Do("CacheAnnsUndo", "CacheAnnsRedo", Cache.ActionHandlerAccessor,
										() => m_ribbon.CacheRibbonItems(firstGloss));
			m_ribbon.CallLayout();

			int widthOne = m_ribbon.RootBox.Width;
			int heightOne = m_ribbon.RootBox.Height;
			Assert.IsTrue(widthOne > widthEmpty, "adding a wordform should make the root box wider");

			var glossList = new List<AnalysisOccurrence>();
			glossList.AddRange(glosses);

			// SUT#4 This changes some internal data! Use a UOW.
			UndoableUnitOfWorkHelper.Do("CacheAnnsUndo", "CacheAnnsRedo", Cache.ActionHandlerAccessor,
										() => m_ribbon.CacheRibbonItems(glossList));
			m_ribbon.CallLayout();
			int widthMany = m_ribbon.RootBox.Width;
			int heightMany = m_ribbon.RootBox.Height;
			Assert.IsTrue(widthMany > widthOne, "adding more wordforms should make the root box wider");
			// In a real view they might not be exactly equal due to subscripts and the like, but our
			// text and anaysis are very simple.
			Assert.AreEqual(heightOne, heightMany, "ribbon should not wrap!");
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:40,代码来源:InterlinRibbonTests.cs


示例8: GetNextSegment

		/// <summary>
		/// Get the next segment with either a non-null annotation that is configured or
		/// a non-punctuation analysis. Also skip segments that are Scripture labels (like
		/// Chapter/Verse/Footnote numbers.
		/// It tries the next one after the SelectedOccurrence.Segment
		/// then tries the next paragraph, etc..
		/// Use this version if the calling code already has the actual para/seg objects.
		/// </summary>
		/// <param name="currentPara"></param>
		/// <param name="seg"></param>
		/// <param name="upward">true if moving up and left, false otherwise</param>
		/// <param name="realAnalysis">the first or last real analysis found in the next segment</param>
		/// <returns>A segment meeting the criteria or null if not found.</returns>
		private ISegment GetNextSegment(IStTxtPara currentPara, ISegment seg, bool upward,
				out AnalysisOccurrence realAnalysis)
		{
			ISegment nextSeg = null;
			realAnalysis = null;
			var currentText = currentPara.Owner as IStText;
			Debug.Assert(currentText != null, "Paragraph not owned by a text.");
			var lines = LineChoices.m_specs as IEnumerable<InterlinLineSpec>;
			var delta = upward ? -1 : 1;
			var nextSegIndex = delta + seg.IndexInOwner;
			do
			{
				if (0 <= nextSegIndex && nextSegIndex < currentPara.SegmentsOS.Count)
				{
					nextSeg = currentPara.SegmentsOS[nextSegIndex];
					nextSegIndex += delta; // increment for next loop in case it doesn't check out
				}
				else
				{   // try the first (last) segment in the next (previous) paragraph
					int nextParaIndex = delta + currentPara.IndexInOwner;
					nextSeg = null;
					IStTxtPara nextPara = null;
					if (0 <= nextParaIndex && nextParaIndex < currentText.ParagraphsOS.Count)
					{   // try to find this paragraph's first (last) segment
						currentPara = (IStTxtPara)currentText.ParagraphsOS[nextParaIndex];
						nextSegIndex = upward ? currentPara.SegmentsOS.Count - 1 : 0;
					}
					else
					{	// no more paragraphs in this text
						break;
					}
				}
				realAnalysis = FindRealAnalysisInSegment(nextSeg, !upward);
			} while (nextSeg == null || (realAnalysis == null && !HasVisibleTranslationOrNote(nextSeg, lines)));
			return nextSeg;
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:49,代码来源:InterlinDocForAnalysis.cs


示例9: TriggerAnalysisSelected

		/// <summary>
		/// Move the sandbox to the AnalysisOccurrence, (which may be a WfiWordform, WfiAnalysis, or WfiGloss).
		/// </summary>
		/// <param name="target"></param>
		/// <param name="fSaveGuess">if true, saves guesses; if false, skips guesses but still saves edits.</param>
		/// <param name="fMakeDefaultSelection">true to make the default selection within the new sandbox.</param>
		/// <param name="fShow">true makes the focusbox visible.</param>
		public virtual void TriggerAnalysisSelected(AnalysisOccurrence target, bool fSaveGuess, bool fMakeDefaultSelection, bool fShow)
		{
			// This can happen, though it is rare...see LT-8193.
			if (!target.IsValid)
			{
				return;
			}
			if (IsFocusBoxInstalled)
				FocusBox.UpdateRealFromSandbox(null, fSaveGuess, target);
			TryHideFocusBoxAndUninstall();
			RecordGuessIfNotKnown(target);
			InstallFocusBox();
			RootBox.DestroySelection();
			FocusBox.SelectOccurrence(target);
			SetFocusBoxSizeForVc();
			SelectedOccurrence = target;

			if (fShow)
			{
				SimulateReplaceAnalysis(target);
				MoveFocusBoxIntoPlace();
				// Now it is the right size and place we can show it.
				TryShowFocusBox();
				// All this CAN hapen because we're editing in another window...for example,
				// if we edit something that deletes the current wordform in a concordance view.
				// In that case we don't want to steal the focus.
				if (ParentForm == Form.ActiveForm)
					FocusBox.FocusSandbox();
			}

			if (fMakeDefaultSelection)
				m_mediator.IdleQueue.Add(IdleQueuePriority.Medium, FocusBox.MakeDefaultSelection);
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:40,代码来源:InterlinDocForAnalysis.cs


示例10: TriggerAnnotationSelected

		/// <summary>
		/// Move the sandbox (see main method), making the default selection.
		/// </summary>
		/// <param name="target"></param>
		/// <param name="fSaveGuess">if true, saves guesses; if false, skips guesses but still saves edits.</param>
		public void TriggerAnnotationSelected(AnalysisOccurrence target, bool fSaveGuess)
		{
			TriggerAnalysisSelected(target, fSaveGuess, true);
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:9,代码来源:InterlinDocForAnalysis.cs


示例11: RecordGuessIfNotKnown

		internal void RecordGuessIfNotKnown(AnalysisOccurrence selected)
		{
			if (m_vc != null) // I think this only happens in tests.
				m_vc.RecordGuessIfNotKnown(selected);
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:5,代码来源:InterlinDocForAnalysis.cs


示例12: FindRealAnalysisInSegment

		/// <summary>
		/// Finds a real analysis in the segment from the indicated direction.
		/// When used just to check if there is an analysis, the direction doesn't matter.
		/// </summary>
		/// <param name="seg">The seg.</param>
		/// <param name="forward">if set to <c>true</c> find a real analysis looking forward.</param>
		/// <returns>The analysis found or null</returns>
		private AnalysisOccurrence FindRealAnalysisInSegment(ISegment seg, bool forward)
		{
			if (seg == null) return null;
			int index = -1;
			AnalysisOccurrence realAnalysis = null;
			bool found = false;
			for (int i = 0; i < seg.AnalysesRS.Count; i++)
			{	// need to count to create occurances
				index++;
				int ind = forward ? index : seg.AnalysesRS.Count - index;
				realAnalysis = new AnalysisOccurrence(seg, ind);
				if (m_vc.CanBeAnalyzed(realAnalysis))
				{
					found = true;
					break; // found the first or last real analysis
				}
			}
			return found ? realAnalysis : null;
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:26,代码来源:InterlinDocForAnalysis.cs


示例13: GetAdvancingWordformsInclusiveOf

		/// <summary>
		/// Returns a sequence of IAnalysis objects inclusive of the current occurrence
		/// and the end occurrence (otherAC).
		/// </summary>
		/// <param name="point2">An AnalysisOccurrence</param>
		public IEnumerable<IAnalysis> GetAdvancingWordformsInclusiveOf(AnalysisOccurrence point2)
		{
			return from occurrence in GetAdvancingOccurrencesInclusiveOf(point2)
				   where !(occurrence is IPunctuationForm)
				   select occurrence;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:11,代码来源:AnalysisOccurrence.cs


示例14: ParseTestText

		private void ParseTestText()
		{
			// Seg:  0								1								2
			// Index:0	  1		 2			 3 0			  1	  2		3 0		 1			 2
			//		xxxpus xxxyalola xxxnihimbilira. xxxnihimbilira xxxpus xxxyalola. xxxhesyla xxxnihimbilira.
			using (var pp = new ParagraphParser(Cache))
			{
				pp.Parse(m_para1);
			}
			var coords = new int[8, 2] { { 0, 0 }, { 0, 1 }, { 0, 2 }, { 1, 0 }, { 1, 1 }, { 1, 2 }, { 2, 0 }, { 2, 1 } };
			m_occurrences = new AnalysisOccurrence[8];
			for (int i = 0; i < 8; i++)
				m_occurrences[i] = new AnalysisOccurrence(m_para1.SegmentsOS[coords[i, 0]], coords[i, 1]);
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:14,代码来源:InterlinTaggingTests.cs


示例15: GetAdvancingOccurrencesInclusiveOf

		/// <summary>
		/// Returns a sequence of IAnalysis objects inclusive of the current occurrence
		/// and the end occurrence (otherAC). Parameter occurrence must occur AFTER 'this'
		/// occurrence.
		/// </summary>
		/// <param name="point2">An AnalysisOccurrence</param>
		/// <returns></returns>
		public IEnumerable<IAnalysis> GetAdvancingOccurrencesInclusiveOf(AnalysisOccurrence point2)
		{
			if (!point2.IsValid)
				throw new ArgumentException("Invalid Analysis Occurrence");
			if (Segment == point2.Segment)
			{
				// Case 1: Two points in same ISegment object
				if (Index > point2.Index)
					throw new ArgumentException("Second AnalysisOccurrence is before the first!");
				// Copy out sub-array of Analyses between the two ACs indices
				return Segment.AnalysesRS.ToList().GetRange(Index, point2.Index - Index + 1);
			}
			if (Segment.Owner == point2.Segment.Owner)
			{
				// Case 2: Two points in different ISegment objects, but in same StTxtPara
				if (Segment.IndexInOwner > point2.Segment.IndexInOwner)
					throw new ArgumentException("Second AnalysisOccurrence is before the first!");
				// Need to copy out end of first segment, any segments in between and beginning of second segment
				return CopyOutAnalysesFromMultipleSegments(point2);
			}
			var para1 = Segment.Owner as IStTxtPara;
			var para2 = point2.Segment.Owner as IStTxtPara;
			if (!(para1.Owner as IStText).ParagraphsOS.Contains(para2))
			{
				throw new ArgumentOutOfRangeException("point2", "AnalysisOccurrences are not within the same Text!");
			}
			throw new NotImplementedException("So far we only handle this in same Segment or Paragraph.");
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:35,代码来源:AnalysisOccurrence.cs


示例16: CopyOutAnalysesFromMultipleSegments

		/// <summary>
		/// Copy out IAnalysis objects from the end of this ISegment through the beginning of
		/// parameter's ISegment (inclusive). Also copies objects from intervening ISegments.
		/// Assumes parameter is in the same StTxtPara!
		/// </summary>
		/// <param name="point2"></param>
		/// <returns></returns>
		private IEnumerable<IAnalysis> CopyOutAnalysesFromMultipleSegments(AnalysisOccurrence point2)
		{
			// Need to copy out end of first segment, any segments in between and beginning of second segment
			var result = new List<IAnalysis>();
			var paraSegs = (Segment.Owner as IStTxtPara).SegmentsOS;
			if (paraSegs == null)
				throw new NullReferenceException("Unexpected error!");
			for (var i = Segment.IndexInOwner; i <= point2.Segment.IndexInOwner; i++)
			{
				if (i == Segment.IndexInOwner)
				{
					// Copy out end of this segment
					result.AddRange(paraSegs[i].AnalysesRS.ToList().GetRange(Index, Segment.AnalysesRS.Count - Index));
					continue;
				}
				if (i == point2.Segment.IndexInOwner)
				{
					// Copy out beginning of this segment
					result.AddRange(paraSegs[i].AnalysesRS.ToList().GetRange(0, point2.Index + 1));
					continue;
				}
				// Copy out all of this segment
				result.AddRange(paraSegs[i].AnalysesRS);
			}
			return result;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:33,代码来源:AnalysisOccurrence.cs


示例17: VerifyTextTag

		/// <summary>
		/// Verify that the parameter tag points to the right possibility marker
		/// and that it refers to the correct begin and end points in the text.
		/// </summary>
		/// <param name="ttag"></param>
		/// <param name="poss"></param>
		/// <param name="point1"></param>
		/// <param name="point2"></param>
		private static void VerifyTextTag(ITextTag ttag, ICmPossibility poss,
										  AnalysisOccurrence point1, AnalysisOccurrence point2)
		{
			Assert.IsNotNull(ttag, "There should be a TextTag object.");
			Assert.AreEqual(poss.Hvo, ttag.TagRA.Hvo, "Text Tag has wrong possibility Hvo.");
			Assert.AreEqual(point1.Segment.Hvo, ttag.BeginSegmentRA.Hvo, "Tag has wrong BeginSegment");
			Assert.AreEqual(point1.Index, ttag.BeginAnalysisIndex, "Tag has wrong BeginAnalysisIndex");
			Assert.AreEqual(point2.Segment.Hvo, ttag.EndSegmentRA.Hvo, "Tag has wrong EndSegment");
			Assert.AreEqual(point2.Index, ttag.EndAnalysisIndex, "Tag has wrong EndAnalysisIndex");
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:18,代码来源:InterlinTaggingTests.cs


示例18: IsAfter

		/// <summary>
		/// Tests to see if this AnalysisOccurrence is later in the text than the
		/// parameter.
		/// </summary>
		/// <param name="otherPoint"></param>
		/// <returns></returns>
		public bool IsAfter(AnalysisOccurrence otherPoint)
		{
			if(Paragraph.Owner.Hvo != otherPoint.Paragraph.Owner.Hvo)
				throw new ArgumentException("The two points are not from the same text!");
			var imyPara = Paragraph.IndexInOwner;
			var iotherPara = otherPoint.Paragraph.IndexInOwner;
			if (imyPara > iotherPara)
				return true;
			if (imyPara < iotherPara)
				return false;
			var imySeg = Segment.IndexInOwner;
			var iotherSeg = otherPoint.Segment.IndexInOwner;
			if (imySeg > iotherSeg)
				return true;
			if (imySeg < iotherSeg)
				return false;
			var iother = otherPoint.Index;
			return Index > iother;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:25,代码来源:AnalysisOccurrence.cs


示例19: SelectOccurrence

		public override void SelectOccurrence(AnalysisOccurrence target)
		{
			InstallFocusBox();
			FocusBox.SelectOccurrence(target);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:5,代码来源:InterlinDocForAnalysisTests.cs


示例20: SelectOccurrence

		/// <summary>
		/// Select the word indicated by the occurrence.
		/// Note that this does not save any changes made in the Sandbox. It is mainly used
		/// when the view is read-only.
		/// </summary>
		public override void SelectOccurrence(AnalysisOccurrence target)
		{
			if (target == null)
			{
				TryHideFocusBoxAndUninstall();
				return;
			}
			if (SelectedOccurrence == target && IsFocusBoxInstalled)
			{
				// Don't steal the focus from another window.  See FWR-1795.
				if (ParentForm == Form.ActiveForm)
				{
					if (ExistingFocusBox.CanFocus)
					{
						ExistingFocusBox.Focus(); // important when switching tabs with ctrl-tab.
					}
					else
					{
						VisibleChanged += FocusWhenVisible;
					}
				}
				return;
			}
			if (!m_vc.CanBeAnalyzed(target))
				return;
#if DEBUG
			// test preconditions.
			Debug.Assert(target.IsValid && !(target.Analysis is IPunctuationForm), "Given annotation type should not be punctuation"
				+ " but was " + target.Analysis.ShortName + ".");
#endif
			TriggerAnnotationSelected(target, true);
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:37,代码来源:InterlinDocForAnalysis.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TestUtilities.TemporaryFolder类代码示例发布时间:2022-05-26
下一篇:
C# Cellar.StTxtPara类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap