本文整理汇总了C#中Term.FindByTag方法的典型用法代码示例。如果您正苦于以下问题:C# Term.FindByTag方法的具体用法?C# Term.FindByTag怎么用?C# Term.FindByTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Term
的用法示例。
在下文中一共展示了Term.FindByTag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InsertTerm
public ArrayList InsertTerm(Tag [] tags, Term parent, Literal after)
{
int position;
if (after != null)
position = WidgetPosition (after.Widget) + 1;
else
position = Children.Length - 1;
ArrayList added = new ArrayList ();
foreach (Tag tag in tags) {
//Console.WriteLine ("Adding tag {0}", tag.Name);
// Don't put a tag into a Term twice
if (parent != Root && (parent.FindByTag (tag, true)).Count > 0)
continue;
if (parent.Count > 0) {
Widget sep = parent.SeparatorWidget ();
InsertWidget (position, sep);
position++;
}
// Encapsulate new OR terms within a new AND term of which they are the
// only member, so later other terms can be AND'd with them
//
// TODO should really see what type of term the parent is, and
// encapsulate this term in a term of the opposite type. This will
// allow the query system to be expanded to work for multiple levels much easier.
if (parent == rootTerm) {
parent = new AndTerm (rootTerm, after);
after = null;
}
Literal term = new Literal (parent, tag, after);
term.TagsAdded += HandleTagsAdded;
term.LiteralsMoved += HandleLiteralsMoved;
term.AttachTag += HandleAttachTag;
term.NegatedToggled += HandleNegated;
term.Removing += HandleRemoving;
term.Removed += HandleRemoved;
term.RequireTag += Require;
term.UnRequireTag += UnRequire;
added.Add (term);
// Insert this widget into the appropriate place in the hbox
InsertWidget (position, term.Widget);
}
UpdateQuery ();
return added;
}