コード例 #1
0
ファイル: OverridesLing_Disc.cs プロジェクト: vkarthim/liblcm
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Compares WordGroups in two segments to see if they are similar enough to be considered
        /// the same. Mostly designed for testing. Tests wordforms tagged for same baseline text
        /// and checks to see that they both reference the same CmPossibility column.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public bool IsAnalogousTo(IConstChartWordGroup otherWordGrp)
        {
            if (otherWordGrp == null)
            {
                return(false);
            }
            if (this.ColumnRA != otherWordGrp.ColumnRA)
            {
                return(false);
            }
            var myWordforms    = this.GetOccurrences();
            var otherWordforms = otherWordGrp.GetOccurrences();

            if (myWordforms == null || otherWordforms == null || myWordforms.Count == 0 || otherWordforms.Count == 0)
            {
                throw new ArgumentException("Found an invalid ConstChartWordGroup.");
            }
            if (myWordforms.Count != otherWordforms.Count)
            {
                return(false);
            }
            // Below LINQ returns false if it finds any tagged wordforms in the two lists
            // that have different baseline text (at the same index)
            return(!myWordforms.Where((t, i) => t.BaselineText.Text != otherWordforms[i].BaselineText.Text).Any());
        }
コード例 #2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Compares WordGroups in two segments to see if they are similar enough to be considered
		/// the same. Mostly designed for testing. Tests wordforms tagged for same baseline text
		/// and checks to see that they both reference the same CmPossibility column.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public bool IsAnalogousTo(IConstChartWordGroup otherWordGrp)
		{
			if (otherWordGrp == null)
				return false;
			if (this.ColumnRA != otherWordGrp.ColumnRA)
				return false;
			var myWordforms = this.GetOccurrences();
			var otherWordforms = otherWordGrp.GetOccurrences();
			if (myWordforms == null || otherWordforms == null || myWordforms.Count == 0 || otherWordforms.Count == 0)
				throw new ArgumentException("Found an invalid ConstChartWordGroup.");
			if (myWordforms.Count != otherWordforms.Count)
				return false;
			// Below LINQ returns false if it finds any tagged wordforms in the two lists
			// that have different baseline text (at the same index)
			return !myWordforms.Where((t, i) => t.BaselineText.Text != otherWordforms[i].BaselineText.Text).Any();
		}
コード例 #3
0
        private void CacheWordGroupOccurrencesForRibbon()
        {
            var words = m_wordGroup.GetOccurrences();

            m_ribbon.CacheRibbonItems(words);
        }