本文整理汇总了C#中Term类的典型用法代码示例。如果您正苦于以下问题:C# Term类的具体用法?C# Term怎么用?C# Term使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Term类属于命名空间,在下文中一共展示了Term类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SortChildTerms
private static IEnumerable<Term> SortChildTerms(Term parentTerm)
{
var sortedChildren = new List<Term>();
// If custom sort order is set, build term list in sorted order
if (!string.IsNullOrEmpty(parentTerm.CustomSortOrder))
{
var children = parentTerm.Terms.ToList();
var sortedIds = parentTerm.CustomSortOrder.Split(':').Select(id => new Guid(id)).ToList();
foreach (var sortedId in sortedIds)
{
var sortedTerm = children.SingleOrDefault(term => term.Id.Equals(sortedId));
if (sortedTerm != null)
{
sortedChildren.Add(sortedTerm);
}
}
// Add unsorted terms at the end of the collection
var unsortedTerms = children.Where(term => !sortedIds.Contains(term.Id));
sortedChildren.AddRange(unsortedTerms);
}
else
{
sortedChildren = parentTerm.Terms.ToList();
}
return sortedChildren;
}
示例2: TermSpans
public TermSpans(TermPositions positions, Term term)
{
this.internalPositions = positions;
this.term = term;
internalDoc = - 1;
}
示例3: TermEquality
public TermEquality(Term term1, Term term2)
{
this.term1 = term1;
this.term2 = term2;
terms.Add(term1);
terms.Add(term2);
}
示例4: GetStringParam
public static string GetStringParam(Term[] arg, ref SMath.Math.Store context)
{
var dbl = GetNumberParam(arg, ref context).obj as SMath.Math.Numeric.TDouble;
if (!dbl.isText)
throw new SMath.Manager.EvaluationException(Errors.ArgumentMustBeString);
return dbl.ToString().Trim('"');
}
示例5: ImportTerm
public void ImportTerm(Term parentTerm, XElement termElement, bool recurse = true)
{
try
{
//Get the LCID.
//TODO: Support importing LCIDs
int lcid = CultureInfo.CurrentCulture.LCID;
//Get the term name
string termName = (string)termElement.Attribute("Name");
//Check if the term exist
Term term = parentTerm.GetTerms(termName, lcid, true, StringMatchOption.ExactMatch, 1, false).FirstOrDefault();
//If the term does not exist, create it
if (term == null)
{
term = parentTerm.CreateTerm(termName, lcid);
}
//Create the child terms
if (recurse)
{
foreach (XElement childElement in termElement.Elements())
{
ImportTerm(term, childElement, recurse);
}
}
}
catch (Exception e)
{
}
}
示例6: SegmentMergeInfo
internal SegmentMergeInfo(int b, TermEnum te, IndexReader r)
{
base_Renamed = b;
reader = r;
termEnum = te;
term = te.Term;
}
示例7: BinaryTerm
private BinaryTerm(RiakFluentSearch search, string field, Op op, Term left)
: base(search, field)
{
_op = op;
_left = left;
left.Owner = this;
}
示例8: TVec
private TVec(Term[] left, Term[] right, Func<Term, Term, Term> elemOp)
{
Contract.Assume(left.Length == right.Length);
terms = new Term[left.Length];
for (int i = 0; i < terms.Length; ++i)
terms[i] = elemOp(left[i], right[i]);
}
示例9: AbstractBaseMutexEvaluator
/// <summary>
/// Initializes a new instance of the <see cref="AbstractBaseMutexEvaluator"/> class.
/// </summary>
/// <param name="conditional">The conditional.</param>
/// <param name="predicate">The predicate.</param>
/// <param name="subject">The subject.</param>
public AbstractBaseMutexEvaluator(Term conditional, Term predicate, Term subject)
{
_conditionalTerm = conditional;
_predicate = predicate;
_subjectTerm = subject;
_sorter = new Dictionary<object, List<WME>>();
}
示例10: Find
private static Optimizer Find(Term term, int dist)
{
if(term==null) return null;
Term next=term.next;
Term.TermType type=term.type;
switch(type){
case Term.TermType.CHAR:
case Term.TermType.REG:
case Term.TermType.REG_I:
return new Optimizer(term,dist);
case Term.TermType.BITSET:
case Term.TermType.BITSET2:
if(term.weight<=THRESHOLD) return new Optimizer(term,dist);
else return Find(term.next,dist+1);
case Term.TermType.ANY_CHAR:
case Term.TermType.ANY_CHAR_NE:
return Find(next,dist+1);
case Term.TermType.REPEAT_MIN_INF:
case Term.TermType.REPEAT_MIN_MAX:
if(term.minCount>0){
return Find(term.target,dist);
}
else return null;
case Term.TermType.BOUNDARY: case Term.TermType.DIRECTION: case Term.TermType.UBOUNDARY: case Term.TermType.UDIRECTION:
case Term.TermType.GROUP_IN: case Term.TermType.GROUP_OUT: case Term.TermType.VOID: case Term.TermType.START: case Term.TermType.END:
case Term.TermType.END_EOL: case Term.TermType.LINE_START: case Term.TermType.LINE_END: case Term.TermType.LAST_MATCH_END:
case Term.TermType.CNT_SET_0: case Term.TermType.CNT_INC: case Term.TermType.CNT_GT_EQ: case Term.TermType.READ_CNT_LT:
case Term.TermType.CRSTORE_CRINC: case Term.TermType.CR_SET_0: case Term.TermType.CR_LT: case Term.TermType.CR_GT_EQ:
return Find(next,dist);
}
return null;
}
示例11: Identity
/// <summary>
/// Define a function.
/// </summary>
/// <param name="body">The function body.</param>
/// <returns>A function.</returns>
public static Identity Identity(Func<Term, Term, Identity> body)
{
var p = body.Method.GetParameters();
var x0 = new Term(0);
var x1 = new Term(1);
return body(x0, x1);
}
示例12: Rule
public Rule(Term.Term antecent, Term.Term consequence)
{
if (antecent == null) throw new ArgumentNullException("antecent");
if (consequence == null) throw new ArgumentNullException("consequence");
_antecent = antecent;
_consequence = consequence;
}
示例13: stringValueFromTerm
public static String stringValueFromTerm(Term t)
{
var result = string.Empty;
Term tt = t.getTerm();
if (tt is Struct)
{
result = ((Struct)tt).getName();
if (result.Equals("."))
{
result = tt.ToString();
}
}
else if (tt is Number)
{
Number n = (Number)tt;
if (n is Int)
{
result = n.intValue().ToString();
}
else
{
result = n.ToString();
}
}
return result;
}
示例14: SeatArrangement
public SeatArrangement(Term source,ISimpleEmployee agent, DateTime start, DateTime end)
{
Agent = agent;
Start = start;
End = end;
Source = source;
}
示例15: EqualsTestEquality
public void EqualsTestEquality()
{
Term o1 = new Term("foo");
Term o2 = new Term("foo");
Assert.IsTrue(o1.Equals(o2));
}