_Core/Lang/Helpers/FluentHelper.cs

(开头部分) 9KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ComLib.Lang.Helpers
{
    /// <summary>
    /// Helper class for "fluent" operations
    /// </summary>
    public class FluentHelper
    {
        /// <summary>
        /// Builds function names from multiple variables expressions.
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public static List<string> BuildMultiWordFunctionNames(List<string> ids)
        {
            var names = new List<string>();
            string name = ids[0];
            names.Add(name);
            for (int ndx = 1; ndx < ids.Count; ndx++)
            {
                var id = ids[ndx];
                name = name + " " + id;
                names.Add(name);
            }
            names.Reverse();
            return names;
        }


        /// <summary>
        /// Match a function wildcard.
        /// </summary>
        /// <param name="symbols">The symbol table</param>
        /// <param name="ids">The consequtive identifiers</param>
        /// <param name="funcs">The registered functions</param>
        /// <returns></returns>
        public static FunctionLookupResult MatchFunctionWildCard(Symbols symbols, RegisteredFunctions funcs, List<string> ids)
        {
            int tokenIndexFunctioName = 0;
            bool found = false;            
            string name = string.Empty;
            for (int ndx = 0; ndx < ids.Count; ndx++ )
            {
                tokenIndexFunctioName = ndx;                

                // "find user by"
                name = ids[ndx];
                if (symbols.IsFunc(name))
                {
                    var func = funcs.GetByName(name);
                    if (func.Meta.HasWildCard)
                    {
                        found = true;
                        break;
                    }
                }
后面还有 179 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。