/// <summary>
 /// Setup constructor
 /// </summary>
 /// <param name="minX">Minimum X value that can be passed into the function</param>
 /// <param name="minY">Minimum Y value that can be passed into the function</param>
 /// <param name="maxX">Maximum X value that can be passed into the function</param>
 /// <param name="maxY">Maximum Y value that can be passed into the function</param>
 /// <param name="evaluate">Evaluation function</param>
 public GraphX2dSourceFunction( float minX, float minY, float maxX, float maxY, EvaluateDelegate evaluate )
 {
     MinimumX = minX;
     MaximumX = maxX;
     MinimumY = minY;
     MaximumY = maxY;
     m_Evaluate = evaluate;
 }
Пример #2
0
        // NOTE: isStatic = true has never been tested. Library functions are static but are neither flagged as static nor as class members,
        // so references can be saved to them by users already.
        public FunctionValue_Host(ITypeDef _retType, List <ITypeDef> _argTypes, EvaluateDelegate _Evaluate, bool _varargs = false, TypeDef_Class classType = null, bool isStatic = false, List <Expr_Literal> defaultArgVals = null)
        {
            argDefaultValues = defaultArgVals;
            BuildArgHasDefaults(_argTypes.Count);

            valType  = TypeFactory.GetTypeDef_Function(_retType, _argTypes, minArgs, _varargs, classType, true, isStatic);
            Evaluate = _Evaluate;
        }
Пример #3
0
        public LogTrigger(string triggerId,
                          EvaluateDelegate evaluation,
                          InvokeEventDelegate invokeEvent)
        {
            if (string.IsNullOrEmpty(triggerId))
            {
                throw new ArgumentNullException("'ruleId' parameter is required");
            }

            _triggerId   = triggerId;
            _evaluate    = evaluation;
            _invokeEvent = invokeEvent;
        }
Пример #4
0
            static LiteralEvaluator()
            {
                switch (Type.GetTypeCode(typeof(T)))
                {
                case TypeCode.Byte:
                case TypeCode.UInt16:
                case TypeCode.UInt32:
                case TypeCode.UInt64:
                    NumberStyles = NumberStyles.None;
                    break;

                case TypeCode.SByte:
                case TypeCode.Int16:
                case TypeCode.Int32:
                case TypeCode.Int64:
                    NumberStyles = NumberStyles.AllowLeadingSign;
                    break;

                case TypeCode.Single:     // float
                case TypeCode.Decimal:
                case TypeCode.Double:
                    NumberStyles = NumberStyles.AllowLeadingSign | NumberStyles.AllowDecimalPoint;
                    break;

                default:
                    return;
                }

                TryParseMethodInfo = typeof(T).GetMethod("TryParse", new[]
                {
                    typeof(ReadOnlySpan <char>),
                    typeof(NumberStyles),
                    typeof(IFormatProvider),
                    typeof(T).MakeByRefType()
                });

                SliceMethodInfo = typeof(LiteralEvaluator <T>)
                                  .GetMethod("Slice", BindingFlags.NonPublic | BindingFlags.Static);

                Evaluate = GenerateEvaluateFunction();
            }
Пример #5
0
Файл: Model.cs Проект: rAum/mmgk
        public Model()
        {
            splines[(int)Model.Spline.P1] = new List<Vector3> // g1 - y
            {
                new Vector3(0,0,0),
                new Vector3(1,0,1),
                new Vector3(2,0,1),
                new Vector3(3,0,0)
            };

            splines[(int)Model.Spline.P0] = new List<Vector3> // g2 - y
            {
                new Vector3(0,3,0),
                new Vector3(1,3,1),
                new Vector3(2,3,1),
                new Vector3(3,3,0)
            };

            splines[(int)Model.Spline.Q1] = new List<Vector3> // h1 - x
            {
                new Vector3(0,0,0),
                new Vector3(0, 1, 1),
                new Vector3(0, 2, -3),
                new Vector3(0, 3, 0)
            };

            splines[(int)Model.Spline.Q0] = new List<Vector3> // h2 - x
            {
                new Vector3(3, 0, 0),
                new Vector3(3,1,1),
                new Vector3(3,2,1),
                new Vector3(3,3,0)
            };

            Evaluate = new EvaluateDelegate(Bezier);
        }
Пример #6
0
 public FunctionValue_Host(TypeDef_Function _valType, EvaluateDelegate eval)
 {
     valType  = _valType;
     Evaluate = eval;
 }