• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# FunctionCollection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中FunctionCollection的典型用法代码示例。如果您正苦于以下问题:C# FunctionCollection类的具体用法?C# FunctionCollection怎么用?C# FunctionCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FunctionCollection类属于命名空间,在下文中一共展示了FunctionCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CalculateTest2

        public void CalculateTest2()
        {
            var functions = new FunctionCollection();

            var func = new UserFunction("f", new IExpression[] { new Number(1) }, 1);
            Assert.AreEqual(Math.Log(1), func.Calculate(functions));
        }
开发者ID:ronnycsharp,项目名称:xFunc,代码行数:7,代码来源:UserFunctionTest.cs


示例2: Generator

        public Generator(Settings settings)
        {
            if (settings == null)
                throw new ArgumentNullException("settings");

            Settings = settings.Clone();

            glTypemap = "GL2/gl.tm";
            csTypemap = Settings.LanguageTypeMapFile;

            enumSpec = Path.Combine("GL2", "signatures.xml");
            enumSpecExt = String.Empty;
            glSpec = Path.Combine("GL2", "signatures.xml");
            glSpecExt = String.Empty;

            Settings.ImportsClass = "Core";
            Settings.DelegatesClass = "Delegates";
            Settings.OutputClass = "GL";

            Delegates = new DelegateCollection();
            Enums = new EnumCollection();
            Wrappers = new FunctionCollection();

            SpecReader = new XmlSpecReader(Settings);
        }
开发者ID:SnowmanTackler,项目名称:OpenTK,代码行数:25,代码来源:Generator.cs


示例3: WriteBindings

        void WriteBindings(DelegateCollection delegates, FunctionCollection wrappers, EnumCollection enums)
        {
            Console.WriteLine("Writing bindings to {0}", Settings.OutputPath);
            if (!Directory.Exists(Settings.OutputPath))
                Directory.CreateDirectory(Settings.OutputPath);

            // Hack: Fix 3dfx extension category so it doesn't start with a digit
            if (wrappers.ContainsKey("3dfx"))
            {
                var three_dee_fx = wrappers["3dfx"];
                wrappers.Remove("3dfx");
                wrappers.Add(DigitPrefix + "3dfx", three_dee_fx);
            }

            using (var sw = sw_h)
            {
                WriteLicense(sw);

                sw.WriteLine("package {0}.{1};", Settings.OutputNamespace, Settings.GLClass);
                sw.WriteLine();
                sw.WriteLine("import java.nio.*;");
                sw.WriteLine();

                WriteDefinitions(sw, enums, wrappers, Type.CSTypes);

                sw.Flush();
                sw.Close();
            }

            string output_header = Path.Combine(Settings.OutputPath, OutputFileHeader);
            Move(sw_h.File, output_header);
        }
开发者ID:hultqvist,项目名称:opentk,代码行数:32,代码来源:JavaSpecWriter.cs


示例4: NewFunctionCollection

        public static FunctionCollection NewFunctionCollection()
        {
            var result = new FunctionCollection();
            FunctionCollections.Add(result);

            return result;
        }
开发者ID:JustAndrei,项目名称:C1-Packages,代码行数:7,代码来源:MvcFunctions.cs


示例5: ExecuteTest2

        public void ExecuteTest2()
        {
            var functions = new FunctionCollection();

            var func = new UserFunction("f", new IExpression[] { new Number(1) }, 1);

            Assert.Throws<KeyNotFoundException>(() => func.Execute(functions));
        }
开发者ID:sys27,项目名称:xFunc,代码行数:8,代码来源:UserFunctionTest.cs


示例6: CalculateTest1

        public void CalculateTest1()
        {
            var functions = new FunctionCollection();
            functions.Add(new UserFunction("f", new IExpression[] { new Variable("x") }, 1), new Ln(new Variable("x")));

            var func = new UserFunction("f", new IExpression[] { new Number(1) }, 1);
            Assert.AreEqual(Math.Log(1), func.Calculate(functions));
        }
开发者ID:ronnycsharp,项目名称:xFunc,代码行数:8,代码来源:UserFunctionTest.cs


示例7: WriteBindings

        void WriteBindings(DelegateCollection delegates, FunctionCollection wrappers, EnumCollection enums)
        {
            Console.WriteLine("Writing bindings to {0}", Settings.OutputPath);
            if (!Directory.Exists(Settings.OutputPath))
                Directory.CreateDirectory(Settings.OutputPath);

            // Hack: Fix 3dfx extension category so it doesn't start with a digit
            if (wrappers.ContainsKey("3dfx"))
            {
                var three_dee_fx = wrappers["3dfx"];
                wrappers.Remove("3dfx");
                wrappers.Add(DigitPrefix + "3dfx", three_dee_fx);
            }

            Settings.DefaultOutputNamespace = "OpenTK";

            // Enums
            using (var sw = sw_h_enums)
            {
                WriteEnums(sw, enums);
                sw.Flush();
                sw.Close();
            }

            // Core definitions
            using (var sw = sw_h)
            {
                WriteDefinitions(sw, enums, wrappers, Type.CSTypes, false);
                sw.Flush();
                sw.Close();
            }

            // Compatibility definitions
            using (var sw = sw_h_compat)
            {
                WriteDefinitions(sw, enums, wrappers, Type.CSTypes, true);
                sw.Flush();
                sw.Close();
            }

            // Core & compatibility declarations
            using (var sw = sw_cpp)
            {
                WriteDeclarations(sw, wrappers, Type.CSTypes);
                sw.Flush();
                sw.Close();
            }

            string output_header = Path.Combine(Settings.OutputPath, OutputFileHeader);
            string output_cpp = Path.Combine(Settings.OutputPath, OutputFileCpp);
            string output_header_compat = Path.Combine(Settings.OutputPath, OutputFileHeaderCompat);
            string output_header_enums = Path.Combine(Settings.OutputPath, OutputFileHeaderEnums);

            Move(sw_h.File, output_header);
            Move(sw_cpp.File, output_cpp);
            Move(sw_h_compat.File, output_header_compat);
            Move(sw_h_enums.File, output_header_enums);
        }
开发者ID:rozgo,项目名称:opentk,代码行数:58,代码来源:CppSpecWriter.cs


示例8: MvcFunctionBase

        protected MvcFunctionBase(string @namespace, string name, string description, FunctionCollection functionCollection)
        {
            Verify.ArgumentNotNullOrEmpty(@namespace, "namespace");
            Verify.ArgumentNotNullOrEmpty(name, "name");
            Verify.ArgumentNotNull(functionCollection, "functionCollection");

            Namespace = @namespace;
            Name = @name;
            Description = description;
            _functionCollection = functionCollection;
        }
开发者ID:Orckestra,项目名称:C1-Packages,代码行数:11,代码来源:MvcFunctionBase.cs


示例9: CalculateTest3

        public void CalculateTest3()
        {
            var uf1 = new UserFunction("func", new[] { new Variable("x") }, 1);
            var func = new DelegateExpression(p => (double)p.Parameters["x"] == 10 ? 0 : 1);
            var funcs = new FunctionCollection();
            funcs.Add(uf1, func);

            var uf2 = new UserFunction("func", new[] { new Number(12) }, 1);
            var result = uf2.Calculate(new ExpressionParameters(funcs));

            Assert.AreEqual(1.0, result);
        }
开发者ID:smwentum,项目名称:xFunc,代码行数:12,代码来源:DelegateExpressionTest.cs


示例10: MvcActionFunction

        public MvcActionFunction(Type controllerType, string actionName, string @namespace, string name, string description,
            FunctionCollection functionCollection)
            : base(@namespace, name, description, functionCollection)
        {
            _controllerDescriptor = new ReflectedControllerDescriptor(controllerType);
            _actionName = actionName;

            var actions = _controllerDescriptor.GetCanonicalActions().Where(a => a.ActionName == actionName);
            Verify.That(actions.Any(), "Action name '{0}' isn't recognized", actionName);

            _routeToRender = "~/{0}/{1}".FormatWith(_controllerDescriptor.ControllerName, actionName);
        }
开发者ID:JustAndrei,项目名称:C1-Packages,代码行数:12,代码来源:MvcActionFunction.cs


示例11: UndefFuncTest

        public void UndefFuncTest()
        {
            var key1 = new UserFunction("f", 0);
            var key2 = new UserFunction("f", 1);

            var functions = new FunctionCollection { { key1, new Number(1) }, { key2, new Number(2) } };

            var undef = new Undefine(key1);
            undef.Calculate(functions);
            Assert.IsFalse(functions.ContainsKey(key1));
            Assert.IsTrue(functions.ContainsKey(key2));
        }
开发者ID:smwentum,项目名称:xFunc,代码行数:12,代码来源:UndefineTest.cs


示例12: UndefFuncWithParamsTest

        public void UndefFuncWithParamsTest()
        {
            var key1 = new UserFunction("f", new IExpression[0], 0);
            var key2 = new UserFunction("f", 1);

            var functions = new FunctionCollection { { key1, new Number(1) }, { key2, new Number(2) } };

            var undef = new Undefine(key2);
            var result = undef.Execute(functions);

            Assert.True(functions.ContainsKey(key1));
            Assert.False(functions.ContainsKey(key2));
            Assert.Equal("The 'f(x1)' function is removed.", result);
        }
开发者ID:sys27,项目名称:xFunc,代码行数:14,代码来源:UndefineTest.cs


示例13: MvcControllerFunction

        public MvcControllerFunction(ReflectedControllerDescriptor controllerDescriptor,
            string @namespace, string name, string description, FunctionCollection functionCollection)
            : base(@namespace, name, description, functionCollection)
        {
            Verify.ArgumentNotNull(controllerDescriptor, "controllerDescriptor");

            _controllerDescriptor = controllerDescriptor;

            RequireAsyncHandler = _controllerDescriptor.ControllerType
                            .GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
                            .Any(method => method.ReturnType == typeof(Task)
                                           || (method.ReturnType.IsGenericType
                                               && method.ReturnType.GetGenericTypeDefinition() == typeof(Task<>)));
        }
开发者ID:Orckestra,项目名称:C1-Packages,代码行数:14,代码来源:MvcControllerFunction.cs


示例14: DataContext

		public DataContext(MetadataContext metadataContext)
		{
			_metadataContext = metadataContext;

			_tables = new TableCollection(this);
			_tables.Changed += member_Changed;

			_tableRelations = new TableRelationCollection(this);
			_tableRelations.Changed += member_Changed;

			_constants = new ConstantCollection();
			_constants.Changed += member_Changed;

			_aggregates = new AggregateCollection();
			_aggregates.AddDefaults();
			_aggregates.Changed += member_Changed;

			_functions = new FunctionCollection();
			_functions.AddDefaults();
			_functions.Changed += member_Changed;			
		}
开发者ID:chenzuo,项目名称:nquery,代码行数:21,代码来源:DataContext.cs


示例15: Generator

        public Generator()
        {
            if (Settings.Compatibility == Settings.Legacy.Tao)
            {
                Settings.OutputNamespace = "Tao.OpenGl";
                Settings.OutputClass = "Gl";
            }
            else
            {
                // Defaults
            }

            Settings.ImportsFile = "GLCore.cs";
            Settings.DelegatesFile = "GLDelegates.cs";
            Settings.EnumsFile = "GLEnums.cs";
            Settings.WrappersFile = "GL.cs";

            Delegates = new DelegateCollection();
            Enums = new EnumCollection();
            Wrappers = new FunctionCollection();
        }
开发者ID:challal,项目名称:scallion,代码行数:21,代码来源:Generator.cs


示例16: CreateCLSCompliantWrappers

        static FunctionCollection CreateCLSCompliantWrappers(FunctionCollection functions, EnumCollection enums)
        {
            // If the function is not CLS-compliant (e.g. it contains unsigned parameters)
            // we need to create a CLS-Compliant overload. However, we should only do this
            // iff the opengl function does not contain unsigned/signed overloads itself
            // to avoid redefinitions.
            var wrappers = new FunctionCollection();
            foreach (var list in functions.Values)
            {
                foreach (var f in list)
                {
                    wrappers.AddChecked(f);

                    if (!f.CLSCompliant)
                    {
                        Function cls = new Function(f);

                        cls.Body.Clear();
                        CreateBody(cls, true, enums);

                        bool modified = false;
                        for (int i = 0; i < f.Parameters.Count; i++)
                        {
                            cls.Parameters[i].CurrentType = cls.Parameters[i].GetCLSCompliantType();
                            if (cls.Parameters[i].CurrentType != f.Parameters[i].CurrentType)
                                modified = true;
                        }

                        if (modified)
                            wrappers.AddChecked(cls);
                    }
                }
            }
            return wrappers;
        }
开发者ID:challal,项目名称:scallion,代码行数:35,代码来源:FuncProcessor.cs


示例17: CreateWrappers

 static FunctionCollection CreateWrappers(DelegateCollection delegates, EnumCollection enums)
 {
     var wrappers = new FunctionCollection();
     foreach (var d in delegates.Values)
     {
         wrappers.AddRange(CreateNormalWrappers(d, enums));
     }
     return wrappers;
 }
开发者ID:challal,项目名称:scallion,代码行数:9,代码来源:FuncProcessor.cs


示例18: WriteBindings

        public void WriteBindings(DelegateCollection delegates, FunctionCollection functions, EnumCollection enums)
        {
            Console.WriteLine("Writing bindings to {0}", Settings.OutputPath);
            if (!Directory.Exists(Settings.OutputPath))
                Directory.CreateDirectory(Settings.OutputPath);

            string temp_enums_file = Path.GetTempFileName();
            string temp_delegates_file = Path.GetTempFileName();
            string temp_core_file = Path.GetTempFileName();
            string temp_wrappers_file = Path.GetTempFileName();

            // Enums
            using (BindStreamWriter sw = new BindStreamWriter(temp_enums_file))
            {
                WriteLicense(sw);
                
                sw.WriteLine("using System;");
                sw.WriteLine();

                if ((Settings.Compatibility & Settings.Legacy.NestedEnums) != Settings.Legacy.None)
                {
                    sw.WriteLine("namespace {0}", Settings.OutputNamespace);
                    sw.WriteLine("{");
                    sw.Indent();
                    sw.WriteLine("static partial class {0}", Settings.OutputClass);
                }
                else
                    sw.WriteLine("namespace {0}", Settings.EnumsOutput);

                sw.WriteLine("{");

                sw.Indent();
                WriteEnums(sw, Enum.GLEnums);
                sw.Unindent();

                if ((Settings.Compatibility & Settings.Legacy.NestedEnums) != Settings.Legacy.None)
                {
                    sw.WriteLine("}");
                    sw.Unindent();
                }

                sw.WriteLine("}");
            }

            // Delegates
            using (BindStreamWriter sw = new BindStreamWriter(temp_delegates_file))
            {
                WriteLicense(sw);
                sw.WriteLine("namespace {0}", Settings.OutputNamespace);
                sw.WriteLine("{");
                sw.Indent();

                sw.WriteLine("using System;");
                sw.WriteLine("using System.Text;");
                sw.WriteLine("using System.Runtime.InteropServices;");

                sw.WriteLine("#pragma warning disable 0649");
                WriteDelegates(sw, Delegate.Delegates);

                sw.Unindent();
                sw.WriteLine("}");
            }

            // Core
            using (BindStreamWriter sw = new BindStreamWriter(temp_core_file))
            {
                WriteLicense(sw);
                sw.WriteLine("namespace {0}", Settings.OutputNamespace);
                sw.WriteLine("{");
                sw.Indent();
                //specWriter.WriteTypes(sw, Bind.Structures.Type.CSTypes);
                sw.WriteLine("using System;");
                sw.WriteLine("using System.Text;");
                sw.WriteLine("using System.Runtime.InteropServices;");

                WriteImports(sw, Delegate.Delegates);

                sw.Unindent();
                sw.WriteLine("}");
            }

            // Wrappers
            using (BindStreamWriter sw = new BindStreamWriter(temp_wrappers_file))
            {
                WriteLicense(sw);
                sw.WriteLine("namespace {0}", Settings.OutputNamespace);
                sw.WriteLine("{");
                sw.Indent();

                sw.WriteLine("using System;");
                sw.WriteLine("using System.Text;");
                sw.WriteLine("using System.Runtime.InteropServices;");

                WriteWrappers(sw, Function.Wrappers, Type.CSTypes);

                sw.Unindent();
                sw.WriteLine("}");
            }

            string output_enums = Path.Combine(Settings.OutputPath, enumsFile);
//.........这里部分代码省略.........
开发者ID:jwatte,项目名称:gears,代码行数:101,代码来源:Generator.cs


示例19: InterfaceComponent

 public InterfaceComponent()
 {
     Functions = new FunctionCollection();
 }
开发者ID:ricksladkey,项目名称:Markup-Programming,代码行数:4,代码来源:InterfaceComponent.cs


示例20: getTop

 string getTop(FunctionCollection list)
 {
     StringBuilder sb = new StringBuilder();
     foreach (Function item in list)
     {
         if (item.PID == 0)
         {
             var childInSide = hasChild(item.ID, list);
             sb.AppendFormat(@"<li id=""phtml_{1}"" _ID=""{1}"" class=""{3}  {2}""><a href=""javascript:;"">{0}</a>"
                 , item.Ten, item.ID, item.Active ? "jstree-checked" : "jstree-unchecked"
                 , childInSide ? "jstree-open" : "");
             if (childInSide)
             {
                 sb.Append(getChild(item.ID, list));
             }
             sb.AppendFormat("</li>");
         }
     }
     return sb.ToString();
 }
开发者ID:nhatkycon,项目名称:xetui,代码行数:20,代码来源:coquan.cs



注:本文中的FunctionCollection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# FunctionDefinition类代码示例发布时间:2022-05-24
下一篇:
C# FunctionArguments类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap