TIntVar KVZ; //Количество вошедших заявок

        #endregion Fields

        #region Constructors

        public UstroystvoVvoda(VU parent, string name)
            : base(parent, name)
        {
            #region Инициализация переменных объектов модели
            KOZ = InitModelObject<TIntVar>();
            KVZ = InitModelObject<TIntVar>();
            Zanyatost = InitModelObject<TRefVar<VS.Zayavka>>();

            Que = InitModelObject<SimpleModelList<QRec>>();

            parentVU = parent;
            #endregion

            #region Инициализация сборщиков статистики
            Variance_QueCount = InitModelObject<Variance<int>>();
            Variance_QueCount.ConnectOnSet(Que.Count);

            Min_QueCount = InitModelObject<Min<int>>();
            Min_QueCount.ConnectOnSet(Que.Count);
            Max_QueCount = InitModelObject<Max<int>>();
            Max_QueCount.ConnectOnSet(Que.Count);

            Zanyto = InitModelObject<BoolCollector>();
            Zanyto.ConnectOnSet(Zanyatost);

            #endregion
        }
예제 #2
0
        public KPD(VS parent, string name)
            : base(parent, name)
        {
            #region Инициализация переменных объектов модели
            KOZ = InitModelObject<TIntVar>();
            KPZ = InitModelObject<TIntVar>();
            Zanyatost = InitModelObject<TRefVar<VS.Zayavka>>();

            Q_Vhod = InitModelObject<SimpleModelList<QRec>>();
            Q_Vozvrat = InitModelObject<SimpleModelList<QRec>>();
            #endregion

            #region Инициализация сборщиков статистики
            Variance_Q_Vhod = InitModelObject<Variance<int>>();
            Variance_Q_Vhod.ConnectOnSet(Q_Vhod.Count);
            Min_Q_Vhod = InitModelObject<Min<int>>();
            Min_Q_Vhod.ConnectOnSet(Q_Vhod.Count);
            Max_Q_Vhod = InitModelObject<Max<int>>();
            Max_Q_Vhod.ConnectOnSet(Q_Vhod.Count);

            Variance_Q_Vozvrat = InitModelObject<Variance<int>>();
            Variance_Q_Vozvrat.ConnectOnSet(Q_Vozvrat.Count);
            Min_Q_Vozvrat = InitModelObject<Min<int>>();
            Min_Q_Vozvrat.ConnectOnSet(Q_Vozvrat.Count);
            Max_Q_Vozvrat = InitModelObject<Max<int>>();
            Max_Q_Vozvrat.ConnectOnSet(Q_Vozvrat.Count);

            Zanyato = InitModelObject<BoolCollector>();
            Zanyato.ConnectOnSet(Zanyatost);
            #endregion
        }
예제 #3
0
파일: MinTest.cs 프로젝트: sys27/xFunc
        public void OneNumberTest()
        {
            var exp = new Min(new[] { new Number(2) }, 1);
            var result = exp.Execute();

            Assert.Equal(2.0, result);
        }
예제 #4
0
        private void Initialize()
        {
            _functions[1] = new Average();
            _functions[2] = new Count();
            _functions[3] = new CountA();
            _functions[4] = new Max();
            _functions[5] = new Min();
            _functions[6] = new Product();
            _functions[7] = new Stdev();
            _functions[8] = new StdevP();
            _functions[9] = new Sum();
            _functions[10] = new Var();
            _functions[11] = new VarP();

            AddHiddenValueHandlingFunction(new Average(), 101);
            AddHiddenValueHandlingFunction(new Count(), 102);
            AddHiddenValueHandlingFunction(new CountA(), 103);
            AddHiddenValueHandlingFunction(new Max(), 104);
            AddHiddenValueHandlingFunction(new Min(), 105);
            AddHiddenValueHandlingFunction(new Product(), 106);
            AddHiddenValueHandlingFunction(new Stdev(), 107);
            AddHiddenValueHandlingFunction(new StdevP(), 108);
            AddHiddenValueHandlingFunction(new Sum(), 109);
            AddHiddenValueHandlingFunction(new Var(), 110);
            AddHiddenValueHandlingFunction(new VarP(), 111);
        }
예제 #5
0
파일: MinTest.cs 프로젝트: sys27/xFunc
        public void TwoNumberTest()
        {
            var exp = new Min(new[] { new Number(2), new Number(4) }, 2);
            var result = exp.Execute();

            Assert.Equal(2.0, result);
        }
예제 #6
0
        public SMOModel(Model parent, string name)
            : base(parent, name)
        {
            KVZS = InitModelObject<TIntVar>();
            KVZ = InitModelObjectArray<TIntVar>(3, "");
            KPZ = InitModelObjectArray<TIntVar>(3, "");
            KZ = InitModelObjectArray<TBoolVar>(2, "");
            TZKO = InitModelObjectArray<TRealVar>(2, "");
            KPZ = InitModelObjectArray<TIntVar>(3, "");

            queue = InitModelObjectArray<SimpleModelList<QueueRec>>(3, "");

            TimeIn_FirstFlow = InitModelObject<TRealVar>();
            TimeIn_SecondFlow = InitModelObject<TRealVar>();

            inFlowGenerator = InitModelObjectArray<PoissonStream>(2, "");
            servFlowGenerator = InitModelObjectArray<ExpStream>(2, "");
            repeateGenerator = InitModelObject<UniformStream>();

            Variance_QueueCount = InitModelObjectArray<Variance<int>>(3, "");
            Variance_QueueCount[0].ConnectOnSet(queue[0].Count);
            Variance_QueueCount[1].ConnectOnSet(queue[1].Count);
            Variance_QueueCount[2].ConnectOnSet(queue[2].Count);

            Variance_TimeIn_FirstFlow = InitModelObject<Variance<double>>();
            Variance_TimeIn_FirstFlow.ConnectOnSet(TimeIn_FirstFlow);

            Variance_TimeIn_SecondFlow = InitModelObject<Variance<double>>();
            Variance_TimeIn_SecondFlow.ConnectOnSet(TimeIn_SecondFlow);

            Min_TimeIn_FirstFlow = InitModelObject<Min<double>>();
            Min_TimeIn_FirstFlow.ConnectOnSet(TimeIn_FirstFlow);

            Min_TimeIn_SecondFlow = InitModelObject<Min<double>>();
            Min_TimeIn_SecondFlow.ConnectOnSet(TimeIn_SecondFlow);

            Max_TimeIn_FirstFlow = InitModelObject<Max<double>>();
            Max_TimeIn_FirstFlow.ConnectOnSet(TimeIn_FirstFlow);

            Max_TimeIn_SecondFlow = InitModelObject<Max<double>>();
            Max_TimeIn_SecondFlow.ConnectOnSet(TimeIn_SecondFlow);

            Bool_Kanal = InitModelObjectArray<BoolCollector>(2, "");
            Bool_Kanal[0].ConnectOnSet(KZ[0]);
            Bool_Kanal[1].ConnectOnSet(KZ[1]);
        }
예제 #7
0
        TRealVar TOZ; //Время обработки заявки в системе

        #endregion Fields

        #region Constructors

        public VU(VS parent, string name)
            : base(parent, name)
        {
            ParentVS = parent;
            UVD = new UstroystvoVvoda(this, "УВД" + "(" + name + ")");
            UR = new UstroystvoRabota(this, "УОД" + "(" + name + ")");
            UV = new UstroystvoVyvoda(this, "УВР" + "(" + name + ")");

            this.AddModelObject(UVD);
            this.AddModelObject(UR);
            this.AddModelObject(UV);

            #region  Инициализация переменных объектов модели
            KVZ = InitModelObject<TIntVar>();
            KOZ = InitModelObject<TIntVar>();
            TOZ = InitModelObject<TRealVar>();
            KPZ = new int[3];

            Gener_Vhod = InitModelObject<ExpStream>();
            Gener_RazmerVvod = InitModelObject<UniformStream>();
            Gener_RazmerVyvoda = InitModelObject<NormalStream>();
            //  Gener_RazmerRabota = InitModelObject<ExpStream>();
            #endregion

            #region Инициализация сборщиков статистики
            Variance_TOZ = InitModelObject<Variance<Double>>();   //создаем сборщик
            Variance_TOZ.ConnectOnSet(TOZ);              //подключаем сборщик к переменной

            Min_TOZ = InitModelObject<Min<double>>();   //создаем сборщик
            Min_TOZ.ConnectOnSet(TOZ);                  //подключаем сборщик к переменной

            Max_TOZ = InitModelObject<Max<double>>();   //создаем сборщик
            Max_TOZ.ConnectOnSet(TOZ);              //подключаем сборщик к переменной

            His_TOZ = InitModelObject<DynamicHistogram>();
            His_TOZ.ConnectOnSet(TOZ);
            #endregion
        }
예제 #8
0
 /// <summary>
 /// Compare 2 IntRanges
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public int CompareTo(IntRange other)
 {
     return(Min.CompareTo(other.Min));
 }
예제 #9
0
 public override void ResetValue()
 {
     CurrentValueIndex = 0;
     Value             = Min.ToString();
 }
예제 #10
0
        /// <summary>
        /// Determines if the given <typeparamref name="T"/> is between the lower and upper bounds of the <see cref="Range{T}"/>
        /// </summary>
        /// <param name="value"></param>
        /// <returns> <c>true</c> if <paramref name="value"/> is greater than <see cref="Max"/> and less than <see cref="Max"/> </returns>
        public bool Includes(T value)
        {
            Require(value, nameof(value));

            return(!(Min.CompareTo(value) > 0 || Max.CompareTo(value) < 0));
        }
예제 #11
0
 public bool Equals(Aabb?other)
 {
     return(other != null && Min.Equals(other.Min) && Max.Equals(other.Max));
 }
예제 #12
0
파일: MinTest.cs 프로젝트: sys27/xFunc
        public void ToStringTest2()
        {
            var sum = new Min(new[] { new Vector(new[] { new Number(1), new Number(2) }) }, 1);

            Assert.Equal("min({1, 2})", sum.ToString());
        }
예제 #13
0
 public void Visit(Min min)
 {
     Visit(min, _min);
 }
예제 #14
0
 public override string ToString()
 {
     return(Min.ToString() + "-" + Max.ToString());
 }
예제 #15
0
        /// <summary>
        /// Creates an expression object from <see cref="FunctionToken"/>.
        /// </summary>
        /// <param name="token">The function token.</param>
        /// <returns>An expression.</returns>
        protected virtual IExpression CreateFunction(FunctionToken token)
        {
            IExpression exp;

            switch (token.Function)
            {
                case Functions.Add:
                    exp = new Add(); break;
                case Functions.Sub:
                    exp = new Sub(); break;
                case Functions.Mul:
                    exp = new Mul(); break;
                case Functions.Div:
                    exp = new Div(); break;
                case Functions.Pow:
                    exp = new Pow(); break;
                case Functions.Absolute:
                    exp = new Abs(); break;
                case Functions.Sine:
                    exp = new Sin(); break;
                case Functions.Cosine:
                    exp = new Cos(); break;
                case Functions.Tangent:
                    exp = new Tan(); break;
                case Functions.Cotangent:
                    exp = new Cot(); break;
                case Functions.Secant:
                    exp = new Sec(); break;
                case Functions.Cosecant:
                    exp = new Csc(); break;
                case Functions.Arcsine:
                    exp = new Arcsin(); break;
                case Functions.Arccosine:
                    exp = new Arccos(); break;
                case Functions.Arctangent:
                    exp = new Arctan(); break;
                case Functions.Arccotangent:
                    exp = new Arccot(); break;
                case Functions.Arcsecant:
                    exp = new Arcsec(); break;
                case Functions.Arccosecant:
                    exp = new Arccsc(); break;
                case Functions.Sqrt:
                    exp = new Sqrt(); break;
                case Functions.Root:
                    exp = new Root(); break;
                case Functions.Ln:
                    exp = new Ln(); break;
                case Functions.Lg:
                    exp = new Lg(); break;
                case Functions.Lb:
                    exp = new Lb(); break;
                case Functions.Log:
                    exp = new Log(); break;
                case Functions.Sineh:
                    exp = new Sinh(); break;
                case Functions.Cosineh:
                    exp = new Cosh(); break;
                case Functions.Tangenth:
                    exp = new Tanh(); break;
                case Functions.Cotangenth:
                    exp = new Coth(); break;
                case Functions.Secanth:
                    exp = new Sech(); break;
                case Functions.Cosecanth:
                    exp = new Csch(); break;
                case Functions.Arsineh:
                    exp = new Arsinh(); break;
                case Functions.Arcosineh:
                    exp = new Arcosh(); break;
                case Functions.Artangenth:
                    exp = new Artanh(); break;
                case Functions.Arcotangenth:
                    exp = new Arcoth(); break;
                case Functions.Arsecanth:
                    exp = new Arsech(); break;
                case Functions.Arcosecanth:
                    exp = new Arcsch(); break;
                case Functions.Exp:
                    exp = new Exp(); break;
                case Functions.GCD:
                    exp = new GCD(); break;
                case Functions.LCM:
                    exp = new LCM(); break;
                case Functions.Factorial:
                    exp = new Fact(); break;
                case Functions.Sum:
                    exp = new Sum(); break;
                case Functions.Product:
                    exp = new Product(); break;
                case Functions.Round:
                    exp = new Round(); break;
                case Functions.Floor:
                    exp = new Floor(); break;
                case Functions.Ceil:
                    exp = new Ceil(); break;
                case Functions.Derivative:
                    exp = new Derivative(); break;
                case Functions.Simplify:
                    exp = new Simplify(); break;
                case Functions.Del:
                    exp = new Del(); break;
                case Functions.Define:
                    exp = new Define(); break;
                case Functions.Vector:
                    exp = new Vector(); break;
                case Functions.Matrix:
                    exp = new Matrix(); break;
                case Functions.Transpose:
                    exp = new Transpose(); break;
                case Functions.Determinant:
                    exp = new Determinant(); break;
                case Functions.Inverse:
                    exp = new Inverse(); break;
                case Functions.If:
                    exp = new If(); break;
                case Functions.For:
                    exp = new For(); break;
                case Functions.While:
                    exp = new While(); break;
                case Functions.Undefine:
                    exp = new Undefine(); break;
                case Functions.Im:
                    exp = new Im(); break;
                case Functions.Re:
                    exp = new Re(); break;
                case Functions.Phase:
                    exp = new Phase(); break;
                case Functions.Conjugate:
                    exp = new Conjugate(); break;
                case Functions.Reciprocal:
                    exp = new Reciprocal(); break;
                case Functions.Min:
                    exp = new Min(); break;
                case Functions.Max:
                    exp = new Max(); break;
                case Functions.Avg:
                    exp = new Avg(); break;
                case Functions.Count:
                    exp = new Count(); break;
                case Functions.Var:
                    exp = new Var(); break;
                case Functions.Varp:
                    exp = new Varp(); break;
                case Functions.Stdev:
                    exp = new Stdev(); break;
                case Functions.Stdevp:
                    exp = new Stdevp(); break;
                default:
                    exp = null; break;
            }

            var diff = exp as DifferentParametersExpression;
            if (diff != null)
                diff.ParametersCount = token.CountOfParams;

            return exp;
        }
예제 #16
0
        public void MinTest()
        {
            var tokens = new List<IToken>
            {
                new FunctionToken(Functions.Min, 2),
                new SymbolToken(Symbols.OpenBracket),
                new NumberToken(1),
                new SymbolToken(Symbols.Comma),
                new NumberToken(2),
                new SymbolToken(Symbols.CloseBracket)
            };

            var exp = parser.Parse(tokens);
            var expected = new Min(new[] { new Number(1), new Number(2) }, 2);

            Assert.Equal(expected, exp);
        }
예제 #17
0
 public BuiltInFunctions()
 {
     // Text
     Functions["text"] = new CStr();
     Functions["len"] = new Len();
     Functions["lower"] = new Lower();
     Functions["upper"] = new Upper();
     Functions["left"] = new Left();
     Functions["right"] = new Right();
     Functions["mid"] = new Mid();
     Functions["replace"] = new Replace();
     Functions["substitute"] = new Substitute();
     Functions["concatenate"] = new Concatenate();
     // Numbers
     Functions["int"] = new CInt();
     // Math
     Functions["cos"] = new Cos();
     Functions["cosh"] = new Cosh();
     Functions["power"] = new Power();
     Functions["sqrt"] = new Sqrt();
     Functions["sqrtpi"] = new SqrtPi();
     Functions["pi"] = new Pi();
     Functions["product"] = new Product();
     Functions["ceiling"] = new Ceiling();
     Functions["count"] = new Count();
     Functions["counta"] = new CountA();
     Functions["floor"] = new Floor();
     Functions["sin"] = new Sin();
     Functions["sinh"] = new Sinh();
     Functions["sum"] = new Sum();
     Functions["sumif"] = new SumIf();
     Functions["stdev"] = new Stdev();
     Functions["stdevp"] = new StdevP();
     Functions["subtotal"] = new Subtotal();
     Functions["exp"] = new Exp();
     Functions["log"] = new Log();
     Functions["log10"] = new Log10();
     Functions["max"] = new Max();
     Functions["maxa"] = new Maxa();
     Functions["min"] = new Min();
     Functions["mod"] = new Mod();
     Functions["average"] = new Average();
     Functions["round"] = new Round();
     Functions["rand"] = new Rand();
     Functions["randbetween"] = new RandBetween();
     Functions["tan"] = new Tan();
     Functions["tanh"] = new Tanh();
     Functions["var"] = new Var();
     Functions["varp"] = new VarP();
     // Information
     Functions["isblank"] = new IsBlank();
     Functions["isnumber"] = new IsNumber();
     Functions["istext"] = new IsText();
     Functions["iserror"] = new IsError();
     // Logical
     Functions["if"] = new If();
     Functions["not"] = new Not();
     Functions["and"] = new And();
     Functions["or"] = new Or();
     Functions["true"] = new True();
     // Reference and lookup
     Functions["address"] = new Address();
     Functions["hlookup"] = new HLookup();
     Functions["vlookup"] = new VLookup();
     Functions["lookup"] = new Lookup();
     Functions["match"] = new Match();
     Functions["row"] = new Row();
     Functions["rows"] = new Rows();
     Functions["column"] = new Column();
     Functions["columns"] = new Columns();
     Functions["choose"] = new Choose();
     // Date
     Functions["date"] = new Date();
     Functions["today"] = new Today();
     Functions["now"] = new Now();
     Functions["day"] = new Day();
     Functions["month"] = new Month();
     Functions["year"] = new Year();
     Functions["time"] = new Time();
     Functions["hour"] = new Hour();
     Functions["minute"] = new Minute();
     Functions["second"] = new Second();
 }
예제 #18
0
파일: MinTest.cs 프로젝트: sys27/xFunc
        public void VectorTest()
        {
            var exp = new Min(new[] { new Vector(new[] { new Number(1), new Number(2), new Number(3) }) }, 1);
            var result = exp.Execute();

            Assert.Equal(1.0, result);
        }
예제 #19
0
 public bool Equals(Range <T> value) => Min.Equals(value.Min) && Max.Equals(value.Max);
예제 #20
0
 public BuiltInFunctions()
 {
     // Text
     Functions["len"]         = new Len();
     Functions["lower"]       = new Lower();
     Functions["upper"]       = new Upper();
     Functions["left"]        = new Left();
     Functions["right"]       = new Right();
     Functions["mid"]         = new Mid();
     Functions["replace"]     = new Replace();
     Functions["substitute"]  = new Substitute();
     Functions["concatenate"] = new Concatenate();
     Functions["exact"]       = new Exact();
     Functions["find"]        = new Find();
     Functions["proper"]      = new Proper();
     Functions["text"]        = new Text.Text();
     Functions["t"]           = new T();
     // Numbers
     Functions["int"] = new CInt();
     // Math
     Functions["abs"]         = new Abs();
     Functions["cos"]         = new Cos();
     Functions["cosh"]        = new Cosh();
     Functions["power"]       = new Power();
     Functions["sign"]        = new Sign();
     Functions["sqrt"]        = new Sqrt();
     Functions["sqrtpi"]      = new SqrtPi();
     Functions["pi"]          = new Pi();
     Functions["product"]     = new Product();
     Functions["ceiling"]     = new Ceiling();
     Functions["count"]       = new Count();
     Functions["counta"]      = new CountA();
     Functions["countif"]     = new CountIf();
     Functions["fact"]        = new Fact();
     Functions["floor"]       = new Floor();
     Functions["sin"]         = new Sin();
     Functions["sinh"]        = new Sinh();
     Functions["sum"]         = new Sum();
     Functions["sumif"]       = new SumIf();
     Functions["sumproduct"]  = new SumProduct();
     Functions["sumsq"]       = new Sumsq();
     Functions["stdev"]       = new Stdev();
     Functions["stdevp"]      = new StdevP();
     Functions["stdev.s"]     = new Stdev();
     Functions["stdev.p"]     = new StdevP();
     Functions["subtotal"]    = new Subtotal();
     Functions["exp"]         = new Exp();
     Functions["log"]         = new Log();
     Functions["log10"]       = new Log10();
     Functions["ln"]          = new Ln();
     Functions["max"]         = new Max();
     Functions["maxa"]        = new Maxa();
     Functions["min"]         = new Min();
     Functions["mod"]         = new Mod();
     Functions["average"]     = new Average();
     Functions["averagea"]    = new AverageA();
     Functions["averageif"]   = new AverageIf();
     Functions["round"]       = new Round();
     Functions["rounddown"]   = new Rounddown();
     Functions["roundup"]     = new Roundup();
     Functions["rand"]        = new Rand();
     Functions["randbetween"] = new RandBetween();
     Functions["quotient"]    = new Quotient();
     Functions["trunc"]       = new Trunc();
     Functions["tan"]         = new Tan();
     Functions["tanh"]        = new Tanh();
     Functions["atan"]        = new Atan();
     Functions["atan2"]       = new Atan2();
     Functions["var"]         = new Var();
     Functions["varp"]        = new VarP();
     // Information
     Functions["isblank"]   = new IsBlank();
     Functions["isnumber"]  = new IsNumber();
     Functions["istext"]    = new IsText();
     Functions["iserror"]   = new IsError();
     Functions["iserr"]     = new IsErr();
     Functions["iseven"]    = new IsEven();
     Functions["isodd"]     = new IsOdd();
     Functions["islogical"] = new IsLogical();
     Functions["isna"]      = new IsNa();
     Functions["na"]        = new Na();
     Functions["n"]         = new N();
     // Logical
     Functions["if"]   = new If();
     Functions["not"]  = new Not();
     Functions["and"]  = new And();
     Functions["or"]   = new Or();
     Functions["true"] = new True();
     // Reference and lookup
     Functions["address"] = new Address();
     Functions["hlookup"] = new HLookup();
     Functions["vlookup"] = new VLookup();
     Functions["lookup"]  = new Lookup();
     Functions["match"]   = new Match();
     Functions["row"]     = new Row();
     Functions["rows"]    = new Rows()
     {
         SkipArgumentEvaluation = true
     };
     Functions["column"]  = new Column();
     Functions["columns"] = new Columns()
     {
         SkipArgumentEvaluation = true
     };
     Functions["choose"] = new Choose();
     Functions["index"]  = new Index();
     // Date
     Functions["date"]       = new Date();
     Functions["today"]      = new Today();
     Functions["now"]        = new Now();
     Functions["day"]        = new Day();
     Functions["month"]      = new Month();
     Functions["year"]       = new Year();
     Functions["time"]       = new Time();
     Functions["hour"]       = new Hour();
     Functions["minute"]     = new Minute();
     Functions["second"]     = new Second();
     Functions["weeknum"]    = new Weeknum();
     Functions["weekday"]    = new Weekday();
     Functions["days360"]    = new Days360();
     Functions["yearfrac"]   = new Yearfrac();
     Functions["edate"]      = new Edate();
     Functions["eomonth"]    = new Eomonth();
     Functions["isoweeknum"] = new IsoWeekNum();
     Functions["workday"]    = new Workday();
 }
예제 #21
0
 public void MinShouldCalculateCorrectResult()
 {
     var func = new Min();
     var args = FunctionsHelper.CreateArgs(4, 2, 5, 2);
     var result = func.Execute(args, _parsingContext);
     Assert.AreEqual(2d, result.Result);
 }
예제 #22
0
 public int CompareTo(Interval other)
 {
     return(Min.CompareTo(other.Min));
 }
 /// <summary>
 /// Returns random date from specified range.
 /// </summary>
 /// <returns>Random date from specified range.</returns>
 public override DateTime GetRandom()
 {
     return(Min.AddMilliseconds((Max - Min).TotalMilliseconds * random.NextDouble()));
 }
예제 #24
0
        Variance<Double> Variance_TOZ; //МО и дисперсия

        #endregion Fields

        #region Constructors

        public VS(Model parent, string name)
            : base(parent, name)
        {
            #region  Инициализация переменных объектов модели
            KVZ = InitModelObject<TIntVar>();
            KOZ = InitModelObject<TIntVar>();
            TOZ = InitModelObject<TRealVar>();

            UZEL = new VU[3];
            UZEL[0] = new VU(this, "ВУ1");
            UZEL[1] = new VU(this, "ВУ2");
            UZEL[2] = new VU(this, "ВУ3");

            this.AddModelObject(UZEL[0]);
            this.AddModelObject(UZEL[1]);
            this.AddModelObject(UZEL[2]);

            KANAL = new KPD[3];
            KANAL[0] = new KPD(this, "КПД(1,2)");
            KANAL[1] = new KPD(this, "КПД(1,3)");
            KANAL[2] = new KPD(this, "КПД(2,3)");

            this.AddModelObject(KANAL[0]);
            this.AddModelObject(KANAL[1]);
            this.AddModelObject(KANAL[2]);

            KANAL[0].VU_1 = UZEL[0];
            KANAL[0].VU_2 = UZEL[1];
            KANAL[1].VU_1 = UZEL[0];
            KANAL[1].VU_2 = UZEL[2];
            KANAL[2].VU_1 = UZEL[1];
            KANAL[2].VU_2 = UZEL[2];
            #endregion

            #region Инициализация сборщиков статистики

            Variance_TOZ = InitModelObject<Variance<Double>>();   //создаем сборщик
            Variance_TOZ.ConnectOnSet(TOZ);              //подключаем сборщик к переменной

            Min_TOZ = InitModelObject<Min<double>>();   //создаем сборщик
            Min_TOZ.ConnectOnSet(TOZ);                  //подключаем сборщик к переменной

            Max_TOZ = InitModelObject<Max<double>>();   //создаем сборщик
            Max_TOZ.ConnectOnSet(TOZ);              //подключаем сборщик к переменной

            His_TOZ = InitModelObject<DynamicHistogram>();
            His_TOZ.ConnectOnSet(TOZ);

            //--------------------------------------------------
            allValuesTest = InitModelObject<AllValues<int>>("Сборщик полной статистики");
            dhTest = InitModelObject<DynamicHistogram>("Динамическая гистограмма");
            testAV = InitModelObject<TIntVar>("Тестовая переменная 1");
            testDH = InitModelObject<TRealVar>("Тестовая переменная 2");
            testAV.AddCollectors_OnSet(allValuesTest);
            testDH.AddCollectors_OnSet(dhTest);
            //--------------------------------------------------
            #endregion

            /*Tracer.AddAutoTabModel(this);
            UZEL.ToList().ForEach(u => Tracer.AddAutoTabModel(u));
            KANAL.ToList().ForEach(k => Tracer.AddAutoTabModel(k));*/
        }
예제 #25
0
파일: MinTest.cs 프로젝트: sys27/xFunc
        public void ToStringTest()
        {
            var sum = new Min(new[] { new Number(1), new Number(2) }, 2);

            Assert.Equal("min(1, 2)", sum.ToString());
        }
 public bool Equals(Bounds2D other)
 {
     return(Min.Equals(other.Min) && Max.Equals(other.Max));
 }
예제 #27
0
        public void MinToStringTest2()
        {
            var sum = new Min(new[] { new Matrices.Vector(new[] { new Number(1), new Number(2) }) });

            Assert.Equal("min({1, 2})", sum.ToString(commonFormatter));
        }
예제 #28
0
        /**********************************************************************/
        #region Value Type Methods

        /// <summary>
        /// <para>
        /// Returns the string representation of the current pair.
        /// </para>
        /// If the pair represents a range, the string representations of Min and Max are returned,
        /// using the standard mathematical notation for ranges (E.G. [1-5]).
        /// Otherwise, the string representation of the underlying single value is returned, as-is.
        /// </summary>
        /// <returns>See <see cref="ValueType.ToString"/>.</returns>
        public override string ToString() => IsRange ? $"[{Min}-{Max}]" : Min.ToString();
예제 #29
0
    void Generate()
    {
        // { Perlin, Billow, RidgedMultifractal, Voronoi, Checker, Const, Cylinders, Spheres };
        for (int n = 0; n <= 1; n++)
        {
            switch ((NoiseType)selectionGridInt[n])
            {
            case NoiseType.Perlin:
                moduleBases[n] = new Perlin(n_freq[n], n_lacun[n], n_persist[n], n_octaves[n], n, QualityMode.Medium);
                break;

            case NoiseType.Billow:
                moduleBases[n] = new Billow(n_freq[n], n_lacun[n], n_persist[n], n_octaves[n], n, QualityMode.Medium);
                break;

            case NoiseType.RidgedMultifractal:
                moduleBases[n] = new RidgedMultifractal(n_freq[n], n_lacun[n], n_octaves[n], n, QualityMode.Medium);
                break;

            case NoiseType.Voronoi:
                moduleBases[n] = new Voronoi(n_freq[n], n_displaces[n], n, n_distance[n]);
                break;

            case NoiseType.Checker:
                moduleBases[n] = new Checker();
                break;

            case NoiseType.Const:
                moduleBases[n] = new Const(n_freq[n]);
                break;

            case NoiseType.Cylinders:
                moduleBases[n] = new Cylinders(n_freq[n]);
                break;

            case NoiseType.Spheres:
                moduleBases[n] = new Spheres(n_freq[n]);
                break;
            }
        }
        ModuleBase moduleBase = new Const();

        // { "Add", "Blend", "Max", "Min", "Multiply", "Power", "Select", "Subtract", "Terrace"};
        switch (operatorGridInt)
        {
        case 0:
            moduleBase = new Add(moduleBases[0], moduleBases[1]);
            break;

        case 1:
            moduleBase = new Blend(moduleBases[0], moduleBases[1], new Perlin());
            break;

        case 2:
            moduleBase = new Max(moduleBases[0], moduleBases[1]);
            break;

        case 3:
            moduleBase = new Min(moduleBases[0], moduleBases[1]);
            break;

        case 4:
            moduleBase = new Multiply(moduleBases[0], moduleBases[1]);
            break;

        case 5:
            moduleBase = new Power(moduleBases[0], moduleBases[1]);
            break;

        case 6:
            moduleBase = new Subtract(moduleBases[0], moduleBases[1]);
            break;

        case 7:
            moduleBase = new Terrace(false, moduleBases[0]);
            break;

        case 8:
            moduleBase = moduleBases[0];
            break;
        }


        //case NoiseType.Mix:
        //	Perlin perlin = new Perlin(freq, lacun, persist, octvs, seed, QualityMode.High);
        //	RidgedMultifractal rigged = new RidgedMultifractal(freq, lacun, octvs, seed, QualityMode.High);
        //	Cylinders cyls = new Cylinders(freq);
        //	//moduleBase = new Add(perlin, rigged);
        //	moduleBase = new Blend(perlin, rigged, new Billow());
        //	break;

        // Initialize the noise map
        //moduleBase = new Scale(2, 2, 2, moduleBase);
        //moduleBase = new Translate(-1, -1, -1, moduleBase);
        this.m_noiseMap = new Noise2D(resolution, resolution, moduleBase);
        this.m_noiseMap.GeneratePlanar(
            offset + -1 * 1 / zoom,
            offset + offset + 1 * 1 / zoom,
            offset + -1 * 1 / zoom,
            offset + 1 * 1 / zoom);

        // Generate the textures
        this.m_textures[0]            = this.m_noiseMap.GetTexture(GradientPresets.Grayscale);
        this.m_textures[0].filterMode = FilterMode.Point;
        //this.m_textures[0] = this.m_noiseMap.GetTexture(LibNoise.Unity.Gradient.Terrain);

        this.m_textures[0].Apply();

        this.m_textures[1] = this.m_noiseMap.GetTexture(GradientPresets.Terrain);
        this.m_textures[1].Apply();

        this.m_textures[2] = this.m_noiseMap.GetNormalMap(3.0f);
        this.m_textures[2].Apply();

        //display on plane
        GetComponent <Renderer>().material.mainTexture = m_textures[0];


        //write images to disk
        //File.WriteAllBytes(Application.dataPath + "/../Gray.png", m_textures[0].EncodeToPNG());
        //File.WriteAllBytes(Application.dataPath + "/../Terrain.png", m_textures[1].EncodeToPNG());
        //File.WriteAllBytes(Application.dataPath + "/../Normal.png", m_textures[2].EncodeToPNG());
    }
예제 #30
0
        /// <summary>
        /// クライアントでのバリデーションサポート
        /// </summary>
        /// <param name="context">バリデーションコンテキスト</param>
        public void AddValidation(ClientModelValidationContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            // データ型とMin,Max,Stepの型チェック
            var numericType = CheckRangeValues(context.ModelMetadata.ModelType);

            if (Min != null)
            {
                // 最小値が設定されている場合以下のタグ属性を設定する
                // minlength                            最小桁数
                // notsupported-min-length-err-msg      未サポートブラウザでのエラーメッセージ
                // min-length-err-msg                   バリデーションで設定されたエラーメッセージ
                MergeAttribute(context.Attributes, "min", Min.ToString());
                MergeAttribute(context.Attributes, "numeric-type", numericType.ToString());
                MergeAttribute(context.Attributes, "notsupported-min-err-msg", "最小値「" + Min.ToString() + "」より小さいです。");
                if (!string.IsNullOrWhiteSpace(UnderMinErrorMessage))
                {
                    MergeAttribute(context.Attributes, "min-err-msg", UnderMinErrorMessage);
                }
            }

            if (Max != null)
            {
                // 最大値が設定されている場合以下のタグ属性を設定する
                // maxlength                            最大桁数
                // notsupported-max-length-err-msg      未サポートブラウザでのエラーメッセージ
                // max-length-err-msg                   バリデーションで設定されたエラーメッセージ
                MergeAttribute(context.Attributes, "max", Max.ToString());
                MergeAttribute(context.Attributes, "numeric-type", numericType.ToString());
                MergeAttribute(context.Attributes, "notsupported-max-err-msg", "値が最大値「" + Max.ToString() + "」を超えています。");
                if (!string.IsNullOrWhiteSpace(OverMaxErrorMessage))
                {
                    MergeAttribute(context.Attributes, "max-err-msg", OverMaxErrorMessage);
                }
            }

            if (Step != null)
            {
                // 最大値が設定されている場合以下のタグ属性を設定する
                // maxlength                            最大桁数
                // notsupported-max-length-err-msg      未サポートブラウザでのエラーメッセージ
                // max-length-err-msg                   バリデーションで設定されたエラーメッセージ
                MergeAttribute(context.Attributes, "step", Step.ToString());
                MergeAttribute(context.Attributes, "notsupported-step-err-msg", "値が刻み幅「" + Step.ToString() + "」に一致しません。");
                if (!string.IsNullOrWhiteSpace(NoStepErrorMessage))
                {
                    MergeAttribute(context.Attributes, "step-err-msg", NoStepErrorMessage);
                }
            }
        }
예제 #31
0
        internal CouplerViewModel(Coupler coupler)
        {
            CultureInfo culture = CultureInfo.InvariantCulture;

            Model = coupler;

            Min = coupler
                  .ToReactivePropertyAsSynchronized(
                x => x.Min,
                x => x.ToString(culture),
                x => double.Parse(x, NumberStyles.Float, culture),
                ignoreValidationErrorValue: true
                )
                  .AddTo(disposable);

            Max = coupler
                  .ToReactivePropertyAsSynchronized(
                x => x.Max,
                x => x.ToString(culture),
                x => double.Parse(x, NumberStyles.Float, culture),
                ignoreValidationErrorValue: true
                )
                  .AddTo(disposable);

            Object = coupler
                     .ToReactivePropertyAsSynchronized(x => x.Object)
                     .AddTo(disposable);

            Min.SetValidateNotifyError(x =>
            {
                double min;
                string message;

                if (Utilities.TryParse(x, NumberRange.Any, out min, out message))
                {
                    double max;

                    if (Utilities.TryParse(Max.Value, NumberRange.Any, out max) && min > max)
                    {
                        message = "MaxはMin以上でなければなりません。";
                    }
                }

                return(message);
            })
            .Subscribe(_ => Max.ForceValidate())
            .AddTo(disposable);

            Min.ObserveHasErrors
            .ToReadOnlyReactivePropertySlim(mode: ReactivePropertyMode.DistinctUntilChanged)
            .Where(x => !x)
            .Subscribe(_ => Min.ForceNotify())
            .AddTo(disposable);

            Max.SetValidateNotifyError(x =>
            {
                double max;
                string message;

                if (Utilities.TryParse(x, NumberRange.Any, out max, out message))
                {
                    double min;

                    if (Utilities.TryParse(Min.Value, NumberRange.Any, out min) && max < min)
                    {
                        message = "MaxはMin以上でなければなりません。";
                    }
                }

                return(message);
            })
            .Subscribe(_ => Min.ForceValidate())
            .AddTo(disposable);

            Max.ObserveHasErrors
            .ToReadOnlyReactivePropertySlim(mode: ReactivePropertyMode.DistinctUntilChanged)
            .Where(x => !x)
            .Subscribe(_ => Max.ForceNotify())
            .AddTo(disposable);
        }
예제 #32
0
 public BuiltInFunctions()
 {
     // Text
     Functions["text"]        = new CStr();
     Functions["len"]         = new Len();
     Functions["lower"]       = new Lower();
     Functions["upper"]       = new Upper();
     Functions["left"]        = new Left();
     Functions["right"]       = new Right();
     Functions["mid"]         = new Mid();
     Functions["replace"]     = new Replace();
     Functions["substitute"]  = new Substitute();
     Functions["concatenate"] = new Concatenate();
     // Numbers
     Functions["int"] = new CInt();
     // Math
     Functions["cos"]         = new Cos();
     Functions["cosh"]        = new Cosh();
     Functions["power"]       = new Power();
     Functions["sqrt"]        = new Sqrt();
     Functions["sqrtpi"]      = new SqrtPi();
     Functions["pi"]          = new Pi();
     Functions["product"]     = new Product();
     Functions["ceiling"]     = new Ceiling();
     Functions["count"]       = new Count();
     Functions["counta"]      = new CountA();
     Functions["floor"]       = new Floor();
     Functions["sin"]         = new Sin();
     Functions["sinh"]        = new Sinh();
     Functions["sum"]         = new Sum();
     Functions["sumif"]       = new SumIf();
     Functions["stdev"]       = new Stdev();
     Functions["stdevp"]      = new StdevP();
     Functions["subtotal"]    = new Subtotal();
     Functions["exp"]         = new Exp();
     Functions["log"]         = new Log();
     Functions["log10"]       = new Log10();
     Functions["max"]         = new Max();
     Functions["maxa"]        = new Maxa();
     Functions["min"]         = new Min();
     Functions["mod"]         = new Mod();
     Functions["average"]     = new Average();
     Functions["round"]       = new Round();
     Functions["rand"]        = new Rand();
     Functions["randbetween"] = new RandBetween();
     Functions["tan"]         = new Tan();
     Functions["tanh"]        = new Tanh();
     Functions["var"]         = new Var();
     Functions["varp"]        = new VarP();
     // Information
     Functions["isblank"]  = new IsBlank();
     Functions["isnumber"] = new IsNumber();
     Functions["istext"]   = new IsText();
     Functions["iserror"]  = new IsError();
     // Logical
     Functions["if"]   = new If();
     Functions["not"]  = new Not();
     Functions["and"]  = new And();
     Functions["or"]   = new Or();
     Functions["true"] = new True();
     // Reference and lookup
     Functions["address"] = new Address();
     Functions["hlookup"] = new HLookup();
     Functions["vlookup"] = new VLookup();
     Functions["lookup"]  = new Lookup();
     Functions["match"]   = new Match();
     Functions["row"]     = new Row();
     Functions["rows"]    = new Rows();
     Functions["column"]  = new Column();
     Functions["columns"] = new Columns();
     Functions["choose"]  = new Choose();
     // Date
     Functions["date"]   = new Date();
     Functions["today"]  = new Today();
     Functions["now"]    = new Now();
     Functions["day"]    = new Day();
     Functions["month"]  = new Month();
     Functions["year"]   = new Year();
     Functions["time"]   = new Time();
     Functions["hour"]   = new Hour();
     Functions["minute"] = new Minute();
     Functions["second"] = new Second();
 }
예제 #33
0
 public override string ToString()
 {
     return("{" + Min.ToString() + " - " + Max.ToString() + "} Range: " + Interval.ToString());
 }
예제 #34
0
 public abstract void Initialize(Min minReference);
예제 #35
0
 public Box Clone()
 {
     return(new Box(Min.Clone(), Max.Clone()));
 }
예제 #36
0
        protected override async Task OnParametersSetAsync()
        {
            _cssList = new List <string>();

            if (!String.IsNullOrWhiteSpace(Class))
            {
                _cssList.Add(Class);
            }

            var sizeSuffix = Size.ToDescriptionString();

            if (!String.IsNullOrWhiteSpace(sizeSuffix))
            {
                _cssList.Add($"form-control-{sizeSuffix}");
            }

            if (JsonConvert.SerializeObject(_originalValue) != JsonConvert.SerializeObject(Value))
            {
                _originalValue = Value;
                _value         = FieldValueService.InitAsDecimal(Value);
            }

            if (!String.IsNullOrWhiteSpace(Name))
            {
                AdditionalAttributes["name"] = Name;
            }

            if (!String.IsNullOrWhiteSpace(Placeholder))
            {
                AdditionalAttributes["placeholder"] = Placeholder;
            }

            if (!String.IsNullOrWhiteSpace(Title))
            {
                AdditionalAttributes["title"] = Title;
            }

            //Needs to be culture invariant as sometimes pure ToString results in "0,01" which is not the expected "0.01"
            if (Min != null)
            {
                AdditionalAttributes["min"] = Min?.ToString(CultureInfo.InvariantCulture);
            }

            if (Max != null)
            {
                AdditionalAttributes["max"] = Max?.ToString(CultureInfo.InvariantCulture);
            }

            AdditionalAttributes["step"] = Step.ToString(CultureInfo.InvariantCulture);

            _decimalPlaces = 0;
            if (Step.ToString(CultureInfo.InvariantCulture).IndexOf(".") > 0)
            {
                _decimalPlaces = Step.ToString(CultureInfo.InvariantCulture).Substring(Step.ToString(CultureInfo.InvariantCulture).IndexOf(".") + 1).Length;
            }

            if (_value != null)
            {
                _value = Math.Round(_value.Value, _decimalPlaces);
            }

            await base.OnParametersSetAsync();
        }
예제 #37
0
 public override string ToString()
 {
     return("{" + Min.ToString() + "}, {" + Max.ToString() + "}");
 }
예제 #38
0
 public override int GetHashCode() => Min.GetHashCode() ^ Max.GetHashCode();
예제 #39
0
 public void Serialize(BinaryWriter w)
 {
     Min.Serialize(w);
     Max.Serialize(w);
 }
예제 #40
0
 public void Init()
 {
     min = new Min();
 }
예제 #41
0
 public bool IsZero()
 {
     return(Min.IsZero() && Max.IsZero());
 }
예제 #42
0
 public override int GetHashCode()
 {
     return(Min.GetHashCode() ^ Max.GetHashCode());
 }
예제 #43
0
 public BuiltInFunctions()
 {
     // Text
     Functions["len"]         = new Len();
     Functions["lower"]       = new Lower();
     Functions["upper"]       = new Upper();
     Functions["left"]        = new Left();
     Functions["right"]       = new Right();
     Functions["mid"]         = new Mid();
     Functions["replace"]     = new Replace();
     Functions["rept"]        = new Rept();
     Functions["substitute"]  = new Substitute();
     Functions["concatenate"] = new Concatenate();
     Functions["concat"]      = new Concat();
     Functions["textjoin"]    = new Textjoin();
     Functions["char"]        = new CharFunction();
     Functions["exact"]       = new Exact();
     Functions["find"]        = new Find();
     Functions["fixed"]       = new Fixed();
     Functions["proper"]      = new Proper();
     Functions["search"]      = new Search();
     Functions["text"]        = new Text.Text();
     Functions["t"]           = new T();
     Functions["hyperlink"]   = new Hyperlink();
     Functions["value"]       = new Value();
     Functions["trim"]        = new Trim();
     Functions["clean"]       = new Clean();
     Functions["unicode"]     = new Unicode();
     Functions["unichar"]     = new Unichar();
     Functions["numbervalue"] = new NumberValue();
     // Numbers
     Functions["int"] = new CInt();
     // Math
     Functions["abs"]             = new Abs();
     Functions["asin"]            = new Asin();
     Functions["asinh"]           = new Asinh();
     Functions["acot"]            = new Acot();
     Functions["acoth"]           = new Acoth();
     Functions["cos"]             = new Cos();
     Functions["cot"]             = new Cot();
     Functions["coth"]            = new Coth();
     Functions["cosh"]            = new Cosh();
     Functions["csc"]             = new Csc();
     Functions["csch"]            = new Csch();
     Functions["power"]           = new Power();
     Functions["gcd"]             = new Gcd();
     Functions["lcm"]             = new Lcm();
     Functions["sec"]             = new Sec();
     Functions["sech"]            = new SecH();
     Functions["sign"]            = new Sign();
     Functions["sqrt"]            = new Sqrt();
     Functions["sqrtpi"]          = new SqrtPi();
     Functions["pi"]              = new Pi();
     Functions["product"]         = new Product();
     Functions["ceiling"]         = new Ceiling();
     Functions["ceiling.precise"] = new CeilingPrecise();
     Functions["ceiling.math"]    = new CeilingMath();
     Functions["iso.ceiling"]     = new IsoCeiling();
     Functions["combin"]          = new Combin();
     Functions["combina"]         = new Combina();
     Functions["count"]           = new Count();
     Functions["counta"]          = new CountA();
     Functions["countblank"]      = new CountBlank();
     Functions["countif"]         = new CountIf();
     Functions["countifs"]        = new CountIfs();
     Functions["fact"]            = new Fact();
     Functions["factdouble"]      = new FactDouble();
     Functions["floor"]           = new Floor();
     Functions["floor.precise"]   = new FloorPrecise();
     Functions["floor.math"]      = new FloorMath();
     Functions["radians"]         = new Radians();
     Functions["roman"]           = new Roman();
     Functions["sin"]             = new Sin();
     Functions["sinh"]            = new Sinh();
     Functions["sum"]             = new Sum();
     Functions["sumif"]           = new SumIf();
     Functions["sumifs"]          = new SumIfs();
     Functions["sumproduct"]      = new SumProduct();
     Functions["sumsq"]           = new Sumsq();
     Functions["sumxmy2"]         = new Sumxmy2();
     Functions["sumx2my2"]        = new SumX2mY2();
     Functions["sumx2py2"]        = new SumX2pY2();
     Functions["seriessum"]       = new Seriessum();
     Functions["stdev"]           = new Stdev();
     Functions["stdevp"]          = new StdevP();
     Functions["stdev.s"]         = new StdevDotS();
     Functions["stdev.p"]         = new StdevDotP();
     Functions["subtotal"]        = new Subtotal();
     Functions["exp"]             = new Exp();
     Functions["log"]             = new Log();
     Functions["log10"]           = new Log10();
     Functions["ln"]              = new Ln();
     Functions["max"]             = new Max();
     Functions["maxa"]            = new Maxa();
     Functions["median"]          = new Median();
     Functions["min"]             = new Min();
     Functions["mina"]            = new Mina();
     Functions["mod"]             = new Mod();
     Functions["mode"]            = new Mode();
     Functions["mode.sngl"]       = new ModeSngl();
     Functions["mround"]          = new Mround();
     Functions["average"]         = new Average();
     Functions["averagea"]        = new AverageA();
     Functions["averageif"]       = new AverageIf();
     Functions["averageifs"]      = new AverageIfs();
     Functions["round"]           = new Round();
     Functions["rounddown"]       = new Rounddown();
     Functions["roundup"]         = new Roundup();
     Functions["rand"]            = new Rand();
     Functions["randbetween"]     = new RandBetween();
     Functions["rank"]            = new Rank();
     Functions["rank.eq"]         = new RankEq();
     Functions["rank.avg"]        = new RankAvg();
     Functions["percentile"]      = new Percentile();
     Functions["percentile.inc"]  = new PercentileInc();
     Functions["percentrank"]     = new Percentrank();
     Functions["percentrank.inc"] = new PercentrankInc();
     Functions["quotient"]        = new Quotient();
     Functions["trunc"]           = new Trunc();
     Functions["tan"]             = new Tan();
     Functions["tanh"]            = new Tanh();
     Functions["atan"]            = new Atan();
     Functions["atan2"]           = new Atan2();
     Functions["atanh"]           = new Atanh();
     Functions["acos"]            = new Acos();
     Functions["acosh"]           = new Acosh();
     Functions["var"]             = new Var();
     Functions["var.s"]           = new VarDotS();
     Functions["varp"]            = new VarP();
     Functions["var.p"]           = new VarDotP();
     Functions["large"]           = new Large();
     Functions["small"]           = new Small();
     Functions["degrees"]         = new Degrees();
     Functions["odd"]             = new Odd();
     Functions["even"]            = new Even();
     // Information
     Functions["isblank"]    = new IsBlank();
     Functions["isnumber"]   = new IsNumber();
     Functions["istext"]     = new IsText();
     Functions["isnontext"]  = new IsNonText();
     Functions["iserror"]    = new IsError();
     Functions["iserr"]      = new IsErr();
     Functions["error.type"] = new ErrorType();
     Functions["iseven"]     = new IsEven();
     Functions["isodd"]      = new IsOdd();
     Functions["islogical"]  = new IsLogical();
     Functions["isna"]       = new IsNa();
     Functions["na"]         = new Na();
     Functions["n"]          = new N();
     Functions["type"]       = new TypeFunction();
     // Logical
     Functions["if"]      = new If();
     Functions["ifs"]     = new Ifs();
     Functions["iferror"] = new IfError();
     Functions["ifna"]    = new IfNa();
     Functions["not"]     = new Not();
     Functions["and"]     = new And();
     Functions["or"]      = new Or();
     Functions["true"]    = new True();
     Functions["false"]   = new False();
     Functions["switch"]  = new Switch();
     // Reference and lookup
     Functions["address"]  = new Address();
     Functions["hlookup"]  = new HLookup();
     Functions["vlookup"]  = new VLookup();
     Functions["lookup"]   = new Lookup();
     Functions["match"]    = new Match();
     Functions["row"]      = new Row();
     Functions["rows"]     = new Rows();
     Functions["column"]   = new Column();
     Functions["columns"]  = new Columns();
     Functions["choose"]   = new Choose();
     Functions["index"]    = new RefAndLookup.Index();
     Functions["indirect"] = new Indirect();
     Functions["offset"]   = new Offset();
     // Date
     Functions["date"]             = new Date();
     Functions["today"]            = new Today();
     Functions["now"]              = new Now();
     Functions["day"]              = new Day();
     Functions["month"]            = new Month();
     Functions["year"]             = new Year();
     Functions["time"]             = new Time();
     Functions["hour"]             = new Hour();
     Functions["minute"]           = new Minute();
     Functions["second"]           = new Second();
     Functions["weeknum"]          = new Weeknum();
     Functions["weekday"]          = new Weekday();
     Functions["days"]             = new Days();
     Functions["days360"]          = new Days360();
     Functions["yearfrac"]         = new Yearfrac();
     Functions["edate"]            = new Edate();
     Functions["eomonth"]          = new Eomonth();
     Functions["isoweeknum"]       = new IsoWeekNum();
     Functions["workday"]          = new Workday();
     Functions["workday.intl"]     = new WorkdayIntl();
     Functions["networkdays"]      = new Networkdays();
     Functions["networkdays.intl"] = new NetworkdaysIntl();
     Functions["datevalue"]        = new DateValue();
     Functions["timevalue"]        = new TimeValue();
     // Database
     Functions["dget"]     = new Dget();
     Functions["dcount"]   = new Dcount();
     Functions["dcounta"]  = new DcountA();
     Functions["dmax"]     = new Dmax();
     Functions["dmin"]     = new Dmin();
     Functions["dsum"]     = new Dsum();
     Functions["daverage"] = new Daverage();
     Functions["dvar"]     = new Dvar();
     Functions["dvarp"]    = new Dvarp();
     //Finance
     Functions["cumipmt"]    = new Cumipmt();
     Functions["cumprinc"]   = new Cumprinc();
     Functions["ddb"]        = new Ddb();
     Functions["effect"]     = new Effect();
     Functions["fvschedule"] = new FvSchedule();
     Functions["pduration"]  = new Pduration();
     Functions["rri"]        = new Rri();
     Functions["pmt"]        = new Pmt();
     Functions["ppmt"]       = new Ppmt();
     Functions["ipmt"]       = new Ipmt();
     Functions["ispmt"]      = new IsPmt();
     Functions["pv"]         = new Pv();
     Functions["fv"]         = new Fv();
     Functions["npv"]        = new Npv();
     Functions["rate"]       = new Rate();
     Functions["nper"]       = new Nper();
     Functions["nominal"]    = new Nominal();
     Functions["irr"]        = new Irr();
     Functions["mirr"]       = new Mirr();
     Functions["xirr"]       = new Xirr();
     Functions["sln"]        = new Sln();
     Functions["syd"]        = new Syd();
     Functions["xnpv"]       = new Xnpv();
     Functions["coupdays"]   = new Coupdays();
     Functions["coupdaysnc"] = new Coupdaysnc();
     Functions["coupdaybs"]  = new Coupdaybs();
     Functions["coupnum"]    = new Coupnum();
     Functions["coupncd"]    = new Coupncd();
     Functions["couppcd"]    = new Couppcd();
     Functions["price"]      = new Price();
     Functions["yield"]      = new Yield();
     Functions["duration"]   = new Duration();
     Functions["disc"]       = new Disc();
     //Engineering
     Functions["bitand"]       = new BitAnd();
     Functions["bitor"]        = new BitOr();
     Functions["bitxor"]       = new BitXor();
     Functions["bitlshift"]    = new BitLshift();
     Functions["bitrshift"]    = new BitRshift();
     Functions["convert"]      = new ConvertFunction();
     Functions["bin2dec"]      = new Bin2Dec();
     Functions["bin2hex"]      = new Bin2Hex();
     Functions["bin2oct"]      = new Bin2Oct();
     Functions["dec2bin"]      = new Dec2Bin();
     Functions["dec2hex"]      = new Dec2Hex();
     Functions["dec2oct"]      = new Dec2Oct();
     Functions["hex2bin"]      = new Hex2Bin();
     Functions["hex2dec"]      = new Hex2Dec();
     Functions["hex2oct"]      = new Hex2Oct();
     Functions["oct2bin"]      = new Oct2Bin();
     Functions["oct2dec"]      = new Oct2Dec();
     Functions["oct2hex"]      = new Oct2Hex();
     Functions["delta"]        = new Delta();
     Functions["erf"]          = new Erf();
     Functions["erf.precise"]  = new ErfPrecise();
     Functions["erfc"]         = new Erfc();
     Functions["erfc.precise"] = new ErfcPrecise();
     Functions["besseli"]      = new BesselI();
     Functions["besselj"]      = new BesselJ();
     Functions["besselk"]      = new BesselK();
     Functions["bessely"]      = new BesselY();
 }
예제 #44
0
 public void Visit(Min min)
 {
     ResultIsIntAndBothOperandsMustBeInt(min);
 }
예제 #45
0
 public void Visit(Min min)
 {
     _sb.Append("min(");
     min.Left.Accept(this);
     _sb.Append(", ");
     min.Right.Accept(this);
     _sb.Append(")");
 }
예제 #46
0
 public int CompareTo(Bucket other)
 => Min.CompareTo(other?.Min);
예제 #47
0
 public void MinShouldIgnoreHiddenValuesIfIgnoreHiddenValuesIsTrue()
 {
     var func = new Min();
     func.IgnoreHiddenValues = true;
     var args = FunctionsHelper.CreateArgs(4, 2, 5, 3);
     args.ElementAt(1).SetExcelStateFlag(ExcelCellState.HiddenCell);
     var result = func.Execute(args, _parsingContext);
     Assert.AreEqual(3d, result.Result);
 }
예제 #48
0
 public void Visit(Min min)
 {
     // Nothing to do here...
 }
예제 #49
0
 public bool Equals(Bucket other)
 => Min.Equals(other?.Min) && Max.Equals(other?.Max);
예제 #50
0
 public int CompareTo(Pair other) => Min.CompareTo(other.Min);
예제 #51
0
    public static void genNoise(int channelId)
    {
        moduleBase[channelId] = new Perlin();
        if (teNoiseChanTypeIndex[channelId] == 1)
        {
            int tIdx = teNoiseTypeIndex[channelId];
            if (tIdx == 0) { moduleBase[channelId] = new Perlin(frequency[channelId], lacunarity[channelId], persistance[channelId], octaves[channelId], seed[channelId], QualityMode.High); }
            if (tIdx == 1) { moduleBase[channelId] = new Billow(frequency[channelId], lacunarity[channelId], persistance[channelId], octaves[channelId], seed[channelId], QualityMode.High); }
            if (tIdx == 2) { moduleBase[channelId] = new RidgedMultifractal(frequency[channelId], lacunarity[channelId], octaves[channelId], seed[channelId], QualityMode.High); }
            if (tIdx == 3) { moduleBase[channelId] = new Voronoi(frequency[channelId], displacement[channelId], seed[channelId], distance[channelId]); }
            if (tIdx == 4) { moduleBase[channelId] = new BrownianMotion(frequency[channelId], lacunarity[channelId], octaves[channelId], seed[channelId], QualityMode.High); }
            if (tIdx == 5) { moduleBase[channelId] = new HeterogeneousMultiFractal(frequency[channelId], lacunarity[channelId], octaves[channelId], persistance[channelId], seed[channelId], offset[channelId], QualityMode.High); }
            if (tIdx == 6) { moduleBase[channelId] = new HybridMulti(frequency[channelId], lacunarity[channelId], octaves[channelId], persistance[channelId], seed[channelId], offset[channelId], gain[channelId], QualityMode.High); }
            if (tIdx == 7) { moduleBase[channelId] = new LinearGradientNoise(frequency[channelId]); }
        }
        if (teNoiseChanTypeIndex[channelId] == 2)
        {
            int fIdx = teFunctionTypeIndex[channelId];
            if (fIdx == 0) { moduleBase[channelId] = new Add(moduleBase[srcChannel1Id[channelId]], moduleBase[srcChannel2Id[channelId]]); }
            if (fIdx == 1) { moduleBase[channelId] = new Subtract(moduleBase[srcChannel1Id[channelId]], moduleBase[srcChannel2Id[channelId]]); }
            if (fIdx == 2) { moduleBase[channelId] = new Multiply(moduleBase[srcChannel1Id[channelId]], moduleBase[srcChannel2Id[channelId]]); }
            if (fIdx == 3) { moduleBase[channelId] = new Min(moduleBase[srcChannel1Id[channelId]], moduleBase[srcChannel2Id[channelId]]); }
            if (fIdx == 4) { moduleBase[channelId] = new Max(moduleBase[srcChannel1Id[channelId]], moduleBase[srcChannel2Id[channelId]]); }
            if (fIdx == 5) { moduleBase[channelId] = new Blend(moduleBase[srcChannel1Id[channelId]], moduleBase[srcChannel2Id[channelId]], moduleBase[srcChannel3Id[channelId]]); }
            if (fIdx == 6) { moduleBase[channelId] = new Clamp((double)noiseFuncMin[channelId], (double)noiseFuncMax[channelId], moduleBase[srcChannel1Id[channelId]]); }
			if (fIdx == 7) { moduleBase[channelId] = new Power(moduleBase[srcChannel1Id[channelId]],moduleBase[srcChannel2Id[channelId]]);}
			if (fIdx == 8) { Curve tmpCurve = new Curve(moduleBase[srcChannel1Id[channelId]]);
				double adjust = double.Parse((controlpointcount[channelId]-1).ToString())*0.5;
				for(int i=0;i<controlpointcount[channelId];i++){
					tmpCurve.Add(double.Parse(i.ToString())-adjust,(double)cpval[channelId,i]);
					moduleBase[channelId] = tmpCurve;
				}
			}
			if(fIdx==9){Terrace tmpTerrace = new Terrace(invertTerrace[channelId],moduleBase[srcChannel1Id[channelId]]);
				for(int i=0;i<controlpointcount[channelId];i++){
					tmpTerrace.Add((double)cpval[channelId,i]-0.5);
					moduleBase[channelId] = tmpTerrace;
				}
			}
            if (fIdx == 18) { moduleBase[channelId] = new Mask(moduleBase[srcChannel1Id[channelId]], (double)noiseFuncMin[channelId], (double)noiseFuncMax[channelId]); }
            if (fIdx == 17) { moduleBase[channelId] = new WindexWarp(moduleBase[srcChannel1Id[channelId]]); }
			if (fIdx == 16) { moduleBase[channelId] = new TEWarp(moduleBase[srcChannel1Id[channelId]]); }
            if (fIdx == 15) { moduleBase[channelId] = new Select((double)noiseFuncMin[channelId], (double)noiseFuncMax[channelId], falloff[channelId], moduleBase[srcChannel1Id[channelId]], moduleBase[srcChannel2Id[channelId]], moduleBase[srcChannel3Id[channelId]]); }
			if (fIdx == 14) { moduleBase[channelId] = new Turbulence(power[channelId],moduleBase[srcChannel1Id[channelId]]); }
			if (fIdx == 13) { moduleBase[channelId] = new ScaleBias(scale[channelId],bias[channelId],moduleBase[srcChannel1Id[channelId]]); }
			if (fIdx == 12) { moduleBase[channelId] = new Invert(moduleBase[srcChannel1Id[channelId]]);}
			if (fIdx == 11) { moduleBase[channelId] = new Exponent(exponent[channelId],moduleBase[srcChannel1Id[channelId]]); }
			if (fIdx == 10) { moduleBase[channelId] = new Abs(moduleBase[srcChannel1Id[channelId]]);}
		}
        int resolution = 64;
        int xoffset = 0; int yoffset = 0;
        m_noiseMap[channelId] = new Noise2D(resolution, resolution, moduleBase[channelId]);
        float x1 = xoffset * zoom[channelId];
        float x2 = (xoffset * zoom[channelId]) + ((zoom[channelId] / resolution) * (resolution + 1));
        float y1 = -yoffset * zoom[channelId];
        float y2 = (-yoffset * zoom[channelId]) + ((zoom[channelId] / resolution) * (resolution + 1));
        m_noiseMap[channelId].GeneratePlanar(x1, x2, y1, y2);
        m_textures[channelId] = m_noiseMap[channelId].GetTexture();
        m_textures[channelId].Apply();
    }