本文整理汇总了C#中ITsString.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# ITsString.Equals方法的具体用法?C# ITsString.Equals怎么用?C# ITsString.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITsString
的用法示例。
在下文中一共展示了ITsString.Equals方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeNewContents
/// ------------------------------------------------------------------------------------
/// <summary>
/// Figure what the new contents needs to be. (Also sets OldContents.) Maybe even set
/// the contents.
/// </summary>
/// <param name="fMakeChangeNow">if set to <c>true</c> make the actual change now;
/// otherwise, just figure out what the new contents will be.</param>
/// ------------------------------------------------------------------------------------
public void MakeNewContents(bool fMakeChangeNow, ProgressDialogWorkingOn progress)
{
RespellingSda sda = m_action.RespellSda;
m_oldContents = RespellUndoAction.AnnotationTargetString(m_hvoTarget, m_flid, m_ws, sda);
ITsStrBldr bldr = m_oldContents.GetBldr();
m_changes.Sort((left, right) => sda.get_IntProp(left, ConcDecorator.kflidBeginOffset).CompareTo(
sda.get_IntProp(right, ConcDecorator.kflidBeginOffset)));
for (int i = m_changes.Count - 1; i >= 0; i--)
{
int ichMin = sda.get_IntProp(m_changes[i], ConcDecorator.kflidBeginOffset);
int ichLim = sda.get_IntProp(m_changes[i], ConcDecorator.kflidEndOffset);
string replacement = Replacement(m_action.OldOccurrence(m_changes[i]));
bldr.Replace(ichMin, ichLim, replacement, null);
if (fMakeChangeNow)
{
ITsString tssNew = bldr.GetString();
if (!m_oldContents.Equals(tssNew))
{
if (m_ws == 0)
sda.SetString(m_hvoTarget, m_flid, tssNew);
else
sda.SetMultiStringAlt(m_hvoTarget, m_flid, m_ws, tssNew);
}
}
}
RespellUndoAction.UpdateProgress(progress);
m_newContents = bldr.GetString();
}
示例2: MergeString
/// <summary>
/// Merges the string.
/// </summary>
/// <param name="source">The source.</param>
/// <param name="dest">The dest.</param>
/// <param name="fConcatenateIfBoth">If true, and if source and dest both have values that are not
/// equal, concatenate source on end of dest. Otherwise ignore source if dest has a value.</param>
/// <returns></returns>
/// ------------------------------------------------------------------------------------
public static ITsString MergeString(ITsString source, ITsString dest, bool fConcatenateIfBoth)
{
string destText = (dest != null) ? dest.Text : null;
string sourceText = (source != null) ? source.Text : null;
if (string.IsNullOrEmpty(destText) && !string.IsNullOrEmpty(sourceText))
return source;
else if (fConcatenateIfBoth && !string.IsNullOrEmpty(destText) && !string.IsNullOrEmpty(sourceText) && !dest.Equals(source))
{
// concatenate
ITsStrBldr tsb = dest.GetBldr();
tsb.Replace(tsb.Length, tsb.Length, " ", null);
tsb.ReplaceTsString(tsb.Length, tsb.Length, source);
return tsb.GetString();
}
return dest;
}
示例3: AssertEqualTss
private void AssertEqualTss(ITsString tss1, ITsString tss2)
{
Assert.IsTrue(tss1.Equals(tss2));
}
示例4: FindMatchingVariantEntryBackRef
/// <summary>
///
/// </summary>
/// <param name="mainEntryOrSense"></param>
/// <param name="variantEntryType"></param>
/// <param name="targetVariantLexemeForm"></param>
/// <returns></returns>
public static ILexEntryRef FindMatchingVariantEntryBackRef(IVariantComponentLexeme mainEntryOrSense,
ILexEntryType variantEntryType, ITsString targetVariantLexemeForm)
{
ILexEntryRef matchingEntryRef = null;
foreach (int hvoLexEntryRef in mainEntryOrSense.VariantFormEntryBackRefs)
{
ILexEntryRef ler = LexEntryRef.CreateFromDBObject((mainEntryOrSense as ICmObject).Cache, hvoLexEntryRef);
// this only handles matching single component lexemes,
// so we only try to match those.
if (ler.ComponentLexemesRS.Count == 1)
{
// next see if we can match on the same variant lexeme form
ILexEntry variantEntry = (ler as CmObject).Owner as ILexEntry;
if (variantEntry.LexemeFormOA == null || variantEntry.LexemeFormOA.Form == null)
continue;
int wsTargetVariant = StringUtils.GetWsAtOffset(targetVariantLexemeForm, 0);
if (targetVariantLexemeForm.Equals(variantEntry.LexemeFormOA.Form.GetAlternativeTss(wsTargetVariant)))
{
// consider this a possible match. we'll use the last such possibility
// if we can't find a matching variantEntryType (below.)
matchingEntryRef = ler;
// next see if we can also match against the type, we'll just 'use' that one.
// otherwise keep going just in case we can find one that does match.
if (variantEntryType != null && ler.VariantEntryTypesRS.Contains(variantEntryType))
break;
}
// continue...
}
}
return matchingEntryRef;
}
示例5: SetContents
void SetContents(ITsString tssContents, bool fResetConcordance)
{
Debug.Assert(m_para != null);
if (m_para.Contents != null && tssContents.Equals(m_para.Contents))
return;
m_para.Contents = tssContents;
//ParseParagraph(fResetConcordance, fCreateRealWordforms);
}
示例6: IsMlSame
private bool IsMlSame(int hvoSrc, int flidSrc, int wsId, int hvoDst, int flidDest, out ITsString tss, out ITsString tssOld)
{
tss = m_sda.get_MultiStringAlt(hvoSrc, flidSrc, wsId);
tssOld = m_sdaMain.get_MultiStringAlt(hvoDst, flidDest, wsId);
return tss.Equals(tssOld);
}
示例7: MatchesWord
/// <summary>
/// Case insensitive comparison of two ITsStrings.
/// </summary>
/// <param name="tssA"></param>
/// <param name="tssB"></param>
/// <returns></returns>
internal bool MatchesWord(ITsString tssA, ITsString tssB)
{
int lenA = tssA != null ? tssA.Length : 0;
return tssB != null && lenA > 0 &&
lenA == tssB.Length &&
(tssA.Equals(tssB) ||
(this.ToLower(tssA) == this.ToLower(tssB) &&
WordWs(tssA) == WordWs(tssB)));
}
示例8: BaselineFormDiffersFromAnalysisWord
private bool BaselineFormDiffersFromAnalysisWord(int hvoAnnotation, out ITsString baselineCbaForm)
{
ICmBaseAnnotation cbaRealAnnotation = CmBaseAnnotation.CreateFromDBObject(m_fdoCache, hvoAnnotation);
baselineCbaForm = StTxtPara.TssSubstring(cbaRealAnnotation);
int wsBaselineCbaForm = StringUtils.GetWsAtOffset(baselineCbaForm, 0);
// We've updated the annotation to have InstanceOf set to the NEW analysis, so what we now derive from
// that is the NEW wordform.
int hvoNewWf = WfiWordform.GetWfiWordformFromInstanceOf(Cache, hvoAnnotation);
WfiWordform wfNew = new WfiWordform(Cache, hvoNewWf);
ITsString tssWfNew = wfNew.Form.GetAlternativeTss(wsBaselineCbaForm);
return !baselineCbaForm.Equals(tssWfNew);
}
示例9: BaselineFormDiffersFromAnalysisWord
private static bool BaselineFormDiffersFromAnalysisWord(AnalysisOccurrence occurrence, out ITsString baselineForm)
{
baselineForm = occurrence.BaselineText; // Review JohnT: does this work if the text might have changed??
var wsBaselineForm = TsStringUtils.GetWsAtOffset(baselineForm, 0);
// We've updated the annotation to have InstanceOf set to the NEW analysis, so what we now derive from
// that is the NEW wordform.
var wfNew = occurrence.Analysis as IWfiWordform;
if (wfNew == null)
return false; // punctuation variations not significant.
var tssWfNew = wfNew.Form.get_String(wsBaselineForm);
return !baselineForm.Equals(tssWfNew);
}
示例10: SetContents
void SetContents(ITsString tssContents, bool fCreateRealWordforms, bool fResetConcordance)
{
Debug.Assert(m_para != null);
if (tssContents.Equals(m_para.Contents.UnderlyingTsString))
return;
m_para.Contents.UnderlyingTsString = tssContents;
ParseParagraph(fResetConcordance, fCreateRealWordforms);
}
示例11: CompareTss
void CompareTss(ITsString tssExpected, ITsString tssActual)
{
if (tssExpected != null && tssActual != null)
{
Assert.AreEqual(tssExpected.Text, tssActual.Text);
Assert.IsTrue(tssExpected.Equals(tssActual));
}
else
{
Assert.AreEqual(tssExpected, tssActual);
}
}