本文整理汇总了C#中ISilDataAccess.get_VecSize方法的典型用法代码示例。如果您正苦于以下问题:C# ISilDataAccess.get_VecSize方法的具体用法?C# ISilDataAccess.get_VecSize怎么用?C# ISilDataAccess.get_VecSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISilDataAccess
的用法示例。
在下文中一共展示了ISilDataAccess.get_VecSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MorphemeBreaker
int m_cchPrevMorphemes; // Total length of morphemes before m_imorph.
public MorphemeBreaker(CachePair caches, string input, int hvoSbWord, int wsVern,
SandboxBase sandbox)
{
m_caches = caches;
m_sda = caches.DataAccess;
m_cda = (IVwCacheDa)m_sda;
m_input = input;
m_hvoSbWord = hvoSbWord;
m_cOldMorphs = m_sda.get_VecSize(m_hvoSbWord, ktagSbWordMorphs);
ITsStrFactory m_tsf = TsStrFactoryClass.Create();
m_wsVern = wsVern;
m_types = m_caches.MainCache.ServiceLocator.GetInstance<IMoMorphTypeRepository>();
m_sandbox = sandbox;
}
示例2: SenseWithMsa
/// <summary>
/// Starting from hvoBase, which may be a LexEntry or LexSense, find the most desirable sense that has
/// the requested MSA. flidSense should be LexEntry.kflidSenses or LexSense.kflidSenses as
/// appropriate.
/// First tries all the top-level senses, if none matches, try children of each sense recursively.
/// Note: arguably, should try all level-two senses before trying level 3. But level-3 senses are
/// vanishingly rare; a level 3 sense with a different msa from its parent is so rare that it isn't
/// worth the effort to be more precise.
/// </summary>
/// <param name="sda"></param>
/// <param name="hvoBase"></param>
/// <param name="flidSenses"></param>
/// <param name="hvoMsa"></param>
/// <returns></returns>
int SenseWithMsa(ISilDataAccess sda, int hvoBase, int flidSenses, int hvoMsa)
{
int csense = sda.get_VecSize(hvoBase, flidSenses);
for (int i = 0; i < csense; i++)
{
int hvoSense = sda.get_VecItem(hvoBase, flidSenses, i);
int hvoThisMsa = sda.get_ObjectProp(hvoSense, (int)LexSense.LexSenseTags.kflidMorphoSyntaxAnalysis);
if (hvoThisMsa == hvoMsa)
return hvoSense;
}
for (int i = 0; i < csense; i++)
{
int hvoSense = sda.get_VecItem(hvoBase, flidSenses, i);
int hvoSubSense = SenseWithMsa(sda, hvoSense, (int)LexSense.LexSenseTags.kflidSenses, hvoMsa);
if (hvoSubSense != 0)
return hvoSubSense;
}
return 0; // no suitable sense found.
}
示例3: GetRealAnalysisMethod
public GetRealAnalysisMethod(IHelpTopicProvider helpTopicProvider, SandboxBase owner,
CachePair caches, int hvoSbWord, AnalysisTree oldAnalysis, IWfiAnalysis wa,
IWfiGloss gloss, InterlinLineChoices choices, ITsString tssForm,
bool fWantOnlyWfiAnalysis) : this()
{
m_helpTopicProvider = helpTopicProvider;
m_sandbox = owner;
m_caches = caches;
m_hvoSbWord = hvoSbWord;
m_oldAnalysis = oldAnalysis;
m_wf = oldAnalysis.Wordform;
m_wa = wa;
m_wg = gloss;
m_sda = m_caches.DataAccess;
m_sdaMain = m_caches.MainCache.MainCacheAccessor;
m_cmorphs = m_sda.get_VecSize(m_hvoSbWord, ktagSbWordMorphs);
m_choices = choices;
m_tssForm = tssForm;
m_fWantOnlyWfiAnalysis = fWantOnlyWfiAnalysis;
}
示例4: ExportLift
/// <summary>
/// Export the lexicon entries filtered into the list given by flid with relation to
/// the LexDb object.
/// </summary>
public void ExportLift(TextWriter w, string folderPath, ISilDataAccess sda, int flid)
{
var hvoObject = m_cache.LangProject.LexDbOA.Hvo;
var chvo = sda.get_VecSize(hvoObject, flid);
int[] contents;
using (var arrayPtr = MarshalEx.ArrayToNative<int>(chvo))
{
sda.VecProp(hvoObject, flid, chvo, out chvo, arrayPtr);
contents = MarshalEx.NativeToArray<int>(arrayPtr, chvo);
}
var entries = FilterVirtualFlidVector(contents);
ExportLift(w, folderPath, entries, entries.Count);
}
示例5: GetItems
/// ------------------------------------------------------------------------------------
/// <summary>
/// Get all the possibilities (or subpossibiities) of the owner and (optionally their
/// subpossibilities).
/// </summary>
/// <param name="hvoOwn">The hvo own.</param>
/// <param name="flid">flid for Possibilities for a CmPossibilityList, or
/// SubPossibilities for a CmPossibility</param>
/// <param name="list">list of ids to return.</param>
/// <param name="sda">The sda.</param>
/// <param name="fGetAllDescendants">if true, recurse to get ALL subpossibilities.</param>
/// ------------------------------------------------------------------------------------
private static void GetItems(int hvoOwn, int flid, Set<int> list, ISilDataAccess sda,
bool fGetAllDescendants)
{
int flidPss = (int)CellarModuleDefns.kflidCmPossibility_SubPossibilities;
int chvo = 0;
// Note, calling get_VecSize directly will result in a SQL query for all of the nodes of
// the tree to verify that they are zero. This generates around 1400 queries for the
// semantic domain list during loading. These will likely never be needed for anything
// else, so it simply wastes time.
if (sda.get_IsPropInCache(hvoOwn, flid, (int)FieldType.kcptOwningCollection, 0))
chvo = sda.get_VecSize(hvoOwn, flid);
for (int ihvo = 0; ihvo < chvo; ++ihvo)
{
int hvo = sda.get_VecItem(hvoOwn, flid, ihvo);
list.Add(hvo);
if (fGetAllDescendants)
CmPossibility.GetItems(hvo, flidPss, list, sda, fGetAllDescendants);
}
}
示例6: CheckPropSetForAllMorphs
// Check that the specified WfiAnalysis includes at least one morpheme bundle, and that all morpheme
// bundles have the specified property set. Return true if all is well.
private static bool CheckPropSetForAllMorphs(ISilDataAccess sda, int hvoWfiAnalysis, int flid)
{
int cbundle = sda.get_VecSize(hvoWfiAnalysis, (int)WfiAnalysis.WfiAnalysisTags.kflidMorphBundles);
if (cbundle == 0)
return false;
for (int ibundle = 0; ibundle < cbundle; ibundle++)
{
int hvoBundle = sda.get_VecItem(hvoWfiAnalysis, (int)WfiAnalysis.WfiAnalysisTags.kflidMorphBundles, ibundle);
if (sda.get_ObjectProp(hvoBundle, flid) == 0)
return false;
}
return true;
}
示例7: FindNestedObject
// Recursive helper method for IndexOf. Handles searching one property of one object (and
// its children) starting at a particular depth in the tree.
bool FindNestedObject(int hvoStart, int[] tags, int hvoTarget, int[] indexes, int[] hvos, int idepth,
ISilDataAccess sda)
{
int tag = tags[idepth];
int chvo = sda.get_VecSize(hvoStart, tag);
for (int i = 0; i < chvo; ++i)
{
int hvo = sda.get_VecItem(hvoStart, tag, i);
if (idepth == tags.Length - 1)
{
if (hvo == hvoTarget)
{
indexes[idepth] = i;
hvos[idepth] = hvoStart;
return true;
}
}
else
{
if (FindNestedObject(hvo, tags, hvoTarget, indexes, hvos, idepth + 1, sda))
{
indexes[idepth] = i;
hvos[idepth] = hvoStart;
return true;
}
}
}
return false;
}
示例8: StringsFor
//.........这里部分代码省略.........
if (partref == null)
return ChildKeys(fdoCache, sda, layout, hvo, layoutCache, caller, stringTbl, wsForce); // an actual part, made up of its pieces
XmlNode part = XmlVc.GetNodeForPart(hvo, partref, false, sda, layoutCache);
// This is the critical place where we introduce a caller. The 'layout' is really a 'part ref' which is the
// 'caller' for all embedded nodes in the called part.
return StringsFor(fdoCache, sda, part, hvo, layoutCache, layout, stringTbl, wsForce);
}
case "div":
case "innerpile":
{
// Concatenate keys for child nodes (as distinct strings)
return ChildKeys(fdoCache, sda, layout, hvo, layoutCache, caller, stringTbl, wsForce);
}
case "obj":
{
// Follow the property, get the object, look up the layout to use,
// invoke recursively.
int flid = GetFlid(sda, layout, hvo);
int hvoTarget = sda.get_ObjectProp(hvo, flid);
if (hvoTarget == 0)
break; // return empty key
string targetLayoutName = XmlUtils.GetOptionalAttributeValue(layout, "layout"); // uses 'default' if missing.
XmlNode layoutTarget = GetLayoutNodeForChild(sda, hvoTarget, flid, targetLayoutName, layout, layoutCache);
if (layoutTarget == null)
break;
return ChildKeys(fdoCache, sda, layoutTarget, hvoTarget, layoutCache, caller, stringTbl, wsForce);
}
case "seq":
{
// Follow the property. For each object, look up the layout to use,
// invoke recursively, concatenate
int flid = GetFlid(sda, layout, hvo);
int[] contents;
int ctarget = sda.get_VecSize(hvo, flid);
using (ArrayPtr arrayPtr = MarshalEx.ArrayToNative<int>(ctarget))
{
int chvo;
sda.VecProp(hvo, flid, ctarget, out chvo, arrayPtr);
contents = MarshalEx.NativeToArray<int>(arrayPtr, chvo);
}
string[] result = null;
string targetLayoutName = XmlVc.GetLayoutName(layout, caller); // also allows for finding "param" attr in caller, if not null
int i = 0;
foreach (int hvoTarget in contents)
{
int prevResultLength = GetArrayLength(result);
XmlNode layoutTarget = GetLayoutNodeForChild(sda, hvoTarget, flid, targetLayoutName, layout, layoutCache);
if (layoutTarget == null)
continue; // should not happen, but best recovery we can make
result = Concatenate(result, ChildKeys(fdoCache, sda, layoutTarget, hvoTarget, layoutCache, caller, stringTbl, wsForce));
// add a separator between the new childkey group and the previous childkey group
if (i > 0 && prevResultLength != GetArrayLength(result) && prevResultLength > 0)
{
int ichIns = 0;
if (result[prevResultLength - 1] != null)
ichIns = result[prevResultLength - 1].Length;
AddSeparator(ref result[prevResultLength - 1], ichIns, layout);
}
++i;
}
return result;
}
case "choice":
{
示例9: UpdateNotifierLists
/// <summary>
/// Update rghvo and rgtag to add each sense hvo with the Pictures flid.
/// </summary>
public override void UpdateNotifierLists(ISilDataAccess sda,
ref int[] rghvo, ref int[] rgtag, ref int chvo)
{
Debug.Assert(sda != null);
Debug.Assert(rghvo != null && rghvo.Length == 1);
Debug.Assert(rgtag != null && rgtag.Length == 1);
Debug.Assert(chvo == 1);
int hvoEntry = rghvo[0];
int csense = sda.get_VecSize(hvoEntry, (int)LexEntry.LexEntryTags.kflidSenses);
List<int> hvos = new List<int>();
List<int> tags = new List<int>();
// keep the existing entry hvo and (virtual) tag.
hvos.Add(hvoEntry);
tags.Add(rgtag[0]);
// also set dependency on the senses themselves.
hvos.Add(hvoEntry);
tags.Add((int)LexEntry.LexEntryTags.kflidSenses);
for (int isense = 0; isense < csense; isense++)
{
int hvoSense = sda.get_VecItem(hvoEntry, (int)LexEntry.LexEntryTags.kflidSenses, isense);
hvos.Add(hvoSense);
tags.Add((int)LexSense.LexSenseTags.kflidPictures);
}
rghvo = hvos.ToArray();
rgtag = tags.ToArray();
chvo = hvos.Count;
}
示例10: GetNextSeg
/// <summary>
/// Given that idxCurSeg is the index of a segment of curPara, adjust both until it is the index of the
/// next segment (possibly in a later paragraph). Return false if no earlier segment exists in
/// the current text.
/// </summary
private static bool GetNextSeg(ref int idxCurSeg, ISilDataAccess sda,
ref StTxtPara curPara, int ktagParaSegments)
{
idxCurSeg++;
// This for usually exits early in the first iteration, and all we do in the method is increment idxCurSeg.
// It is even rarer to have more than one full iteration but could happen if there is an empty paragraph.
for (; ; )
{
int csegs = sda.get_VecSize(curPara.Hvo, ktagParaSegments);
if (idxCurSeg < csegs)
return true;
// set curPara to next para in StText. If there is none, fail.
int idxPara = sda.GetObjIndex(curPara.OwnerHVO, (int)StText.StTextTags.kflidParagraphs, curPara.Hvo);
int cpara = sda.get_VecSize(curPara.OwnerHVO, (int)StText.StTextTags.kflidParagraphs);
if (idxPara >= cpara - 1)
return false;
int hvoNext = sda.get_VecItem(curPara.OwnerHVO, (int)StText.StTextTags.kflidParagraphs, idxPara + 1);
curPara = CmObject.CreateFromDBObject(curPara.Cache, hvoNext, false) as StTxtPara;
idxCurSeg = 0;
}
}
示例11: GetPrevSeg
/// <summary>
/// Given that idxCurSeg is the index of a segment of curPara, adjust both until it is the index of the
/// previous segment (possibly in an earlier paragraph). Return false if no earlier segment exists in
/// the current text.
/// </summary
private static bool GetPrevSeg(ref int idxCurSeg, ISilDataAccess sda,
ref StTxtPara curPara, int ktagParaSegments)
{
idxCurSeg--;
// This while usually has no iterations, and all we do in the method is decrement idxCurSeg.
// It is even rarer to have more than one iteration but could happen if there is an empty paragraph.
while (idxCurSeg < 0)
{
// set curPara to previous para in StText. If there is none, fail.
int idxPara = sda.GetObjIndex(curPara.OwnerHVO, (int)StText.StTextTags.kflidParagraphs, curPara.Hvo);
if (idxPara == 0)
return false;
int hvoPrev = sda.get_VecItem(curPara.OwnerHVO, (int)StText.StTextTags.kflidParagraphs, idxPara - 1);
curPara = CmObject.CreateFromDBObject(curPara.Cache, hvoPrev, false) as StTxtPara;
idxCurSeg = sda.get_VecSize(curPara.Hvo, ktagParaSegments) - 1;
}
return true;
}
示例12: RecomputeVirtuals
/// <summary>
/// If object hvo has no cached value for the property flidVirtual, do nothing.
/// Otherwise, compute a new value for the property, and issue a PropChanged. (Currently only string type supported)
/// If it has owning properties of type clidVirtual, do the same for all their items.
/// </summary>
/// <param name="hvo"></param>
/// <param name="flidVirtual"></param>
/// <param name="mdc"></param>
/// <param name="sda"></param>
private void RecomputeVirtuals(int hvo, uint clidVirtual, int flidVirtual, int typeVirtual, IFwMetaDataCache mdc, ISilDataAccess sda,
IVwVirtualHandler vh)
{
if (Cache.GetClassOfObject(hvo) != clidVirtual)
return;
// Unless it's a computeEveryTime property, we don't need to worry if it's not already cached.
if (vh.ComputeEveryTime || sda.get_IsPropInCache(hvo, flidVirtual, typeVirtual, 0))
{
vh.Load(hvo, flidVirtual, 0, Cache.VwCacheDaAccessor);
switch (typeVirtual)
{
case (int)CellarModuleDefns.kcptString:
sda.PropChanged(null, (int)PropChangeType.kpctNotifyAll, hvo, flidVirtual, 0, 0, 0);
break;
default:
Debug.WriteLine("RecomputeVirtuals: unimplemented prop type");
break;
}
}
uint[] flids = DbOps.GetFieldsInClassOfType(mdc, (int)clidVirtual, FieldType.kgrfcptOwning);
foreach (uint flid in flids)
{
int type = mdc.GetFieldType(flid);
if (type == (int)CellarModuleDefns.kfcptOwningAtom)
{
RecomputeVirtuals(sda.get_ObjectProp(hvo, (int)flid), clidVirtual, flidVirtual, typeVirtual, mdc, sda, vh);
}
else
{
// must be owning sequence or collection; do them all.
int chvo = sda.get_VecSize(hvo, (int)flid);
for (int i = 0; i < chvo; i++)
RecomputeVirtuals(sda.get_VecItem(hvo, (int)flid, i), clidVirtual, flidVirtual, typeVirtual, mdc, sda, vh);
}
}
}
示例13: MorphemeBreaker
int m_cchPrevMorphemes; // Total length of morphemes before m_imorph.
public MorphemeBreaker(CachePair caches, string input, int hvoSbWord, int wsVern,
SandboxBase sandbox)
{
m_caches = caches;
m_sda = caches.DataAccess;
m_cda = (IVwCacheDa)m_sda;
m_input = input;
m_hvoSbWord = hvoSbWord;
m_cOldMorphs = m_sda.get_VecSize(m_hvoSbWord, ktagSbWordMorphs);
ITsStrFactory m_tsf = TsStrFactoryClass.Create();
m_wsVern = wsVern;
m_types = new MoMorphTypeCollection(m_caches.MainCache);
m_sandbox = sandbox;
}
示例14: GetRealAnalysisMethod
public GetRealAnalysisMethod(SandboxBase owner, CachePair caches, int hvoSbWord,
int hvoWordform, int hvoWfiAnalysis, int hvoWordGloss, InterlinLineChoices choices,
ITsString tssForm, bool fWantOnlyWfiAnalysis)
{
m_sandbox = owner;
m_caches = caches;
m_hvoSbWord = hvoSbWord;
m_hvoWordform = hvoWordform;
m_hvoWfiAnalysis = hvoWfiAnalysis;
m_hvoWordGloss = hvoWordGloss;
m_sda = m_caches.DataAccess;
m_sdaMain = m_caches.MainCache.MainCacheAccessor;
m_cmorphs = m_sda.get_VecSize(m_hvoSbWord, ktagSbWordMorphs);
m_choices = choices;
m_tssForm = tssForm;
m_fWantOnlyWfiAnalysis = fWantOnlyWfiAnalysis;
}
示例15: AddChildPos
/// <summary>
/// Add to possiblePOS all the children (recursively) of hvoPos
/// </summary>
/// <param name="sda"></param>
/// <param name="hvoPos"></param>
/// <param name="possiblePOS"></param>
void AddChildPos(ISilDataAccess sda, int hvoPos, Set<int> possiblePOS)
{
possiblePOS.Add(hvoPos);
int chvo = sda.get_VecSize(hvoPos, (int)CmPossibility.CmPossibilityTags.kflidSubPossibilities);
for (int i = 0; i < chvo; i++)
AddChildPos(sda, sda.get_VecItem(hvoPos,
(int)CmPossibility.CmPossibilityTags.kflidSubPossibilities, i), possiblePOS);
}