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


C# DomainServices.AnalysisOccurrence类代码示例

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


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


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