/// <summary> /// Get the occurrences of a particular analysis in the currently interesting texts. /// </summary> private int[] GetAnalysisOccurrences(int hvo, bool includeChildren) { int[] values; if (m_values.TryGetValue(hvo, out values)) { return(values); } var analysis = (IAnalysis)m_services.GetObject(hvo); var wf = analysis.Wordform; var bag = wf.OccurrencesBag; var valuesList = new List <int>(bag.Count); foreach (var seg in from item in bag.Items where BelongsToInterestingText(item) select item) { foreach (var occurrence in seg.GetOccurrencesOfAnalysis(analysis, bag.Occurrences(seg), includeChildren)) { var hvoOcc = m_nextId--; valuesList.Add(hvoOcc); m_occurrences[hvoOcc] = occurrence; } } AddAdditionalOccurrences(hvo, m_occurrences, ref m_nextId, valuesList); values = valuesList.ToArray(); m_values[hvo] = values; return(values); }
/// <summary> /// For a set of elements in cmObject that are referred to by setFlid, return the first element, or null. /// </summary> private static ICmPossibility FetchFirstElementFromSet(ICmObject cmObject, int setFlid, ISilDataAccess mainCacheAccessor, ILcmServiceLocator fdoServiceLocator) { var elementCount = mainCacheAccessor.get_VecSize(cmObject.Hvo, setFlid); if (elementCount == 0) { return(null); } var firstElementHvo = mainCacheAccessor.get_VecItem(cmObject.Hvo, setFlid, 0); return(fdoServiceLocator.GetObject(firstElementHvo) as ICmPossibility); }
/// <summary> /// Return true if the object represented by the HVO is of the parent object class. /// Enhance JohnT: improve name! /// </summary> /// <param name="hvo"></param> /// <returns></returns> public bool IsGhostOwnerClass(int hvo) { return(m_parentClsid == m_services.GetObject(hvo).ClassID); }