public List<Addition> GetAdditions(int fusionId)
 {
     List<Addition> result = new List<Addition>();
     string sql = "SELECT ha.HTADDACT_ID, ha.HEAT_ID, ha.MAT_ID, ha.PHASE_NO, ha.DESTINATION_AGGNO, ha.DATA_SOURCE, ha.INSERTTIME, ha.PORTION_WGT,ha.TOTAL_WGT, ";
     sql += " ms.NAME_ENGLISH,ha.Lanze_pos,ha.o2vol_total FROM HEAT_ADDITIONS_ACT ha, MATERIAL_SPEC ms WHERE ms.MAT_ID= ha.MAT_ID AND ha.HEAT_ID=" + fusionId.ToString() + " ORDER BY INSERTTIME ";
     OracleDataReader reader = Execute(sql);
     while (reader.Read())
     {
         Addition addition = new Addition();
         addition.Id = int.Parse(CheckNubmerForNull(reader[0].ToString()));
         addition.FusionId = int.Parse(CheckNubmerForNull(reader[1].ToString()));
         addition.MaterialId = int.Parse(CheckNubmerForNull(reader[2].ToString()));
         addition.Destination = reader[4].ToString();
         addition.DataSource = reader[5].ToString();
         addition.Date = DateTime.Parse(CheckDateForNull(reader[6].ToString()));
         addition.PortionWeight = int.Parse(CheckNubmerForNull(reader[7].ToString()));
         addition.TotalWeight = int.Parse(CheckNubmerForNull(reader[8].ToString()));
         addition.MaterialName = reader[9].ToString();
         addition.LancePosition = int.Parse(CheckNubmerForNull(reader[10].ToString()));
         addition.O2TotalVol = int.Parse(CheckNubmerForNull(reader[11].ToString()));
         result.Add(addition);
     }
     reader.Close();
     return result;
 }
Esempio n. 2
0
 public DefaultBuff(int additionID, Actor actor, string name, int lifetime, Addition.AdditionType type)
 {
     this.Name = name;
     this.additionID = (uint)additionID;
     this.AttachedActor = actor;
     this.lifeTime = lifetime;
     this.MyType = type;
 }
Esempio n. 3
0
 public DefaultBuff(SkillIDs id, Actor actor, string name,int lifetime, Addition.AdditionType type)
 {
     this.Name = name;
     this.skillID = id;
     this.AttachedActor = actor;
     this.lifeTime = lifetime;
     this.MyType = type;
 }
Esempio n. 4
0
 public TeleVision(string name, DVD dvd, Addition.Chanel chanel)
 {
     this.Name = name;
     this.Id = "tv";
     this.dvd = dvd;
     this.Chanel = chanel;
     this.Volume=20;
     this.Brightness = 20;
     this.Mode = true;
 }
Esempio n. 5
0
        public void Addition_Works()
        {
            // arrange
            var adder = new Addition();

            // act
            var result = adder.Execute(1, 2);

            // assert
            Assert.AreEqual(3, result);
        }
        public override TreeNodeBase DeepCopy()
        {
            TreeNodeBase left = LeftOperand.DeepCopy();
            TreeNodeBase right = RightOperand.DeepCopy();

            Addition node = new Addition
            {
                LeftOperand = left,
                RightOperand = right
            };
            return node;
        }
Esempio n. 7
0
        public void Addition_Maintains_Identity_Property()
        {
            const int left = 12;
            const int right = -12;

            var adder = new Addition();

            var firstResult = adder.Execute(left, right);
            var secondResult = adder.Execute(right, left);

            Assert.AreEqual(0, firstResult, secondResult);
        }
 public List<Addition> GetAdditionsDozen(int heatID)
 {
     List<Addition> result = new List<Addition>();
     string sql = "SELECT ha.MAT_ID,ha.INSERTTIME,ha.PORTION_WGT, ";
     sql += " ms.NAME_ENGLISH FROM HEAT_ADDITIONS_DOZEN ha, MATERIAL_SPEC ms WHERE ms.MAT_ID= ha.MAT_ID AND ha.HEAT_ID=" + heatID.ToString() + " ORDER BY INSERTTIME ";
     OracleDataReader reader = Execute(sql);
     while (reader.Read())
     {
         Addition addition = new Addition();
         addition.MaterialId = int.Parse(CheckNubmerForNull(reader[0].ToString()));
         addition.Date = DateTime.Parse(CheckDateForNull(reader[1].ToString()));
         addition.PortionWeight = int.Parse(CheckNubmerForNull(reader[2].ToString()));
         addition.MaterialName = reader[3].ToString();
         result.Add(addition);
     }
     reader.Close();
     return result;
 }
Esempio n. 9
0
        public double Execute(Operation operation,
                              IFunctionRegistry functionRegistry,
                              IConstantRegistry constantRegistry,
                              IDictionary <string, double> variables)
        {
            if (operation == null)
            {
                throw new ArgumentNullException("operation");
            }

            if (operation.GetType() == typeof(IntegerConstant))
            {
                IntegerConstant constant = (IntegerConstant)operation;
                return(constant.Value);
            }
            else if (operation.GetType() == typeof(FloatingPointConstant))
            {
                FloatingPointConstant constant = (FloatingPointConstant)operation;
                return(constant.Value);
            }
            else if (operation.GetType() == typeof(Variable))
            {
                Variable variable = (Variable)operation;

                double value;
                bool   variableFound = variables.TryGetValue(variable.Name, out value);

                if (variableFound)
                {
                    return(value);
                }
                else
                {
                    throw new VariableNotDefinedException(string.Format("The variable \"{0}\" used is not defined.", variable.Name));
                }
            }
            else if (operation.GetType() == typeof(Multiplication))
            {
                Multiplication multiplication = (Multiplication)operation;
                return(Execute(multiplication.Argument1, functionRegistry, constantRegistry, variables) * Execute(multiplication.Argument2, functionRegistry, constantRegistry, variables));
            }
            else if (operation.GetType() == typeof(Addition))
            {
                Addition addition = (Addition)operation;
                return(Execute(addition.Argument1, functionRegistry, constantRegistry, variables) + Execute(addition.Argument2, functionRegistry, constantRegistry, variables));
            }
            else if (operation.GetType() == typeof(Subtraction))
            {
                Subtraction addition = (Subtraction)operation;
                return(Execute(addition.Argument1, functionRegistry, constantRegistry, variables) - Execute(addition.Argument2, functionRegistry, constantRegistry, variables));
            }
            else if (operation.GetType() == typeof(Division))
            {
                Division division = (Division)operation;
                return(Execute(division.Dividend, functionRegistry, constantRegistry, variables) / Execute(division.Divisor, functionRegistry, constantRegistry, variables));
            }
            else if (operation.GetType() == typeof(Modulo))
            {
                Modulo division = (Modulo)operation;
                return(Execute(division.Dividend, functionRegistry, constantRegistry, variables) % Execute(division.Divisor, functionRegistry, constantRegistry, variables));
            }
            else if (operation.GetType() == typeof(Exponentiation))
            {
                Exponentiation exponentiation = (Exponentiation)operation;
                return(Math.Pow(Execute(exponentiation.Base, functionRegistry, constantRegistry, variables), Execute(exponentiation.Exponent, functionRegistry, constantRegistry, variables)));
            }
            else if (operation.GetType() == typeof(UnaryMinus))
            {
                UnaryMinus unaryMinus = (UnaryMinus)operation;
                return(-Execute(unaryMinus.Argument, functionRegistry, constantRegistry, variables));
            }
            else if (operation.GetType() == typeof(And))
            {
                And and        = (And)operation;
                var operation1 = Execute(and.Argument1, functionRegistry, constantRegistry, variables) != 0;
                var operation2 = Execute(and.Argument2, functionRegistry, constantRegistry, variables) != 0;

                return((operation1 && operation2) ? 1.0 : 0.0);
            }
            else if (operation.GetType() == typeof(Or))
            {
                Or  or         = (Or)operation;
                var operation1 = Execute(or.Argument1, functionRegistry, constantRegistry, variables) != 0;
                var operation2 = Execute(or.Argument2, functionRegistry, constantRegistry, variables) != 0;

                return((operation1 || operation2) ? 1.0 : 0.0);
            }
            else if (operation.GetType() == typeof(LessThan))
            {
                LessThan lessThan = (LessThan)operation;
                return((Execute(lessThan.Argument1, functionRegistry, constantRegistry, variables) < Execute(lessThan.Argument2, functionRegistry, constantRegistry, variables)) ? 1.0 : 0.0);
            }
            else if (operation.GetType() == typeof(LessOrEqualThan))
            {
                LessOrEqualThan lessOrEqualThan = (LessOrEqualThan)operation;
                return((Execute(lessOrEqualThan.Argument1, functionRegistry, constantRegistry, variables) <= Execute(lessOrEqualThan.Argument2, functionRegistry, constantRegistry, variables)) ? 1.0 : 0.0);
            }
            else if (operation.GetType() == typeof(GreaterThan))
            {
                GreaterThan greaterThan = (GreaterThan)operation;
                return((Execute(greaterThan.Argument1, functionRegistry, constantRegistry, variables) > Execute(greaterThan.Argument2, functionRegistry, constantRegistry, variables)) ? 1.0 : 0.0);
            }
            else if (operation.GetType() == typeof(GreaterOrEqualThan))
            {
                GreaterOrEqualThan greaterOrEqualThan = (GreaterOrEqualThan)operation;
                return((Execute(greaterOrEqualThan.Argument1, functionRegistry, constantRegistry, variables) >= Execute(greaterOrEqualThan.Argument2, functionRegistry, constantRegistry, variables)) ? 1.0 : 0.0);
            }
            else if (operation.GetType() == typeof(Equal))
            {
                Equal equal = (Equal)operation;
                return((Execute(equal.Argument1, functionRegistry, constantRegistry, variables) == Execute(equal.Argument2, functionRegistry, constantRegistry, variables)) ? 1.0 : 0.0);
            }
            else if (operation.GetType() == typeof(NotEqual))
            {
                NotEqual notEqual = (NotEqual)operation;
                return((Execute(notEqual.Argument1, functionRegistry, constantRegistry, variables) != Execute(notEqual.Argument2, functionRegistry, constantRegistry, variables)) ? 1.0 : 0.0);
            }
            else if (operation.GetType() == typeof(Function))
            {
                Function function = (Function)operation;

                FunctionInfo functionInfo = functionRegistry.GetFunctionInfo(function.FunctionName);

                double[] arguments = new double[functionInfo.IsDynamicFunc ? function.Arguments.Count : functionInfo.NumberOfParameters];
                for (int i = 0; i < arguments.Length; i++)
                {
                    arguments[i] = Execute(function.Arguments[i], functionRegistry, constantRegistry, variables);
                }

                return(Invoke(functionInfo.Function, arguments));
            }
            else
            {
                throw new ArgumentException(string.Format("Unsupported operation \"{0}\".", operation.GetType().FullName), "operation");
            }
        }
Esempio n. 10
0
 public void SumIntArrayTest()
 {
     Assert.AreEqual(40, Addition.Sum(f));
 }
Esempio n. 11
0
 public void SumTest()
 {
     Assert.AreEqual(60, Addition.Sum(a, b));
 }
Esempio n. 12
0
 public void SumIntArrayTest()
 {
     Assert.AreEqual(18, Addition.Sum(e));
 }
Esempio n. 13
0
 /// <summary>
 /// Addition using Func
 /// </summary>
 public object Visit(Addition addition)
 {
     return(Evaluate(addition));
 }
 protected override IExpression ReplaceAddition(Addition addition)
 => new Constant
 {
     Value = addition.Left.GetConstantValue() + addition.Right.GetConstantValue()
 };
Esempio n. 15
0
        private static List <Operation> Solve(string[] lines)
        {
            List <Operation> res = new List <Operation>();

            foreach (string line in lines)
            {
                Dictionary <int, Operation> ops = new Dictionary <int, Operation>();
                int Depth = 0;
                foreach (char c in line.Replace(" ", ""))
                {
                    KeyValuePair <int, Operation> last = ops.LastOrDefault(x => x.Key == Depth);
                    switch (c)
                    {
                    case '+':
                        if (last.Value == null)
                        {
                            Operation top = ops.LastOrDefault(x => x.Key == Depth + 1).Value;
                            ops[Depth] = new Addition(top, Depth);
                            ops.Remove(top.Priority);
                        }
                        else
                        {
                            ops[Depth] = new Addition(last.Value, Depth);
                        }
                        break;

                    case '*':
                        if (last.Value == null)
                        {
                            Operation top = ops.LastOrDefault(x => x.Key == Depth + 1).Value;
                            ops[Depth] = new Multiplication(top, Depth);
                            ops.Remove(top.Priority);
                        }
                        else
                        {
                            ops[Depth] = new Multiplication(last.Value, Depth);
                        }
                        break;

                    case '(':
                        Depth++;
                        break;

                    case ')':
                        Depth--;
                        Operation prev = ops.LastOrDefault(x => x.Key == Depth).Value;
                        if (prev != null)
                        {
                            prev.Right = last.Value;
                            ops.Remove(last.Key);
                        }
                        break;

                    default:
                        int num = Convert.ToInt32(c.ToString());
                        if (last.Value == null)
                        {
                            ops.Add(Depth, new Number(num, Depth));
                        }
                        else if (last.Key == Depth)
                        {
                            last.Value.Right = new Number(num, Depth);
                        }
                        else
                        {
                            ops.Add(Depth, new Number(num, Depth));
                        }
                        break;
                    }
                }
                res.Add(ops.First().Value);
            }
            return(res);
        }
Esempio n. 16
0
        public void X_Plus_Y_Font_La_Somme_Des_Deux(int x, int y, int resultat)
        {
            var addition = new Addition(x, y);

            Assert.AreEqual(resultat, addition.Resultat);
        }
Esempio n. 17
0
 // PUT: api/Additions/5
 public void Put(int id, [FromBody] Addition addition)
 {
     _additions.Remove(_additions.Find(x => x.Id == id));
     _additions.Add(addition);
 }
Esempio n. 18
0
 protected override void EvaluateAddition(Addition addition) => IncreaseCount();
Esempio n. 19
0
 public static void RemoveAddition(Actor actor, Addition addition, bool removeOnly)
 {
     if (actor.BattleStatus.Additions.ContainsKey(addition.Name))
     {
         actor.BattleStatus.Additions.Remove(addition.Name);
         if (addition.Activated && !removeOnly)
         {
             addition.AdditionEnd();
         }
         addition.Activated = false;
     }
 }
Esempio n. 20
0
 public void SumDoubleArrayTest()
 {
     Assert.AreEqual(9.82, Addition.Sum(e));
 }
Esempio n. 21
0
 private Expression ParseAdditiveExpression(TokenSet followers) {
   TokenSet followerOrAdditive = followers|Token.Addition|Token.Subtraction;
   Expression result = this.ParseMultiplicativeExpression(followerOrAdditive);
   while (this.currentToken == Token.Addition || this.currentToken == Token.Subtraction) {
     SourceLocationBuilder slb = new SourceLocationBuilder(result.SourceLocation);
     Token operatorToken = this.currentToken;
     this.GetNextToken();
     Expression operand2 = this.ParseMultiplicativeExpression(followerOrAdditive);
     slb.UpdateToSpan(operand2.SourceLocation);
     switch (operatorToken) {
       case Token.Addition: result = new Addition(result, operand2, slb); break;
       case Token.Subtraction: result = new Subtraction(result, operand2, slb); break;
     }
   }
   //^ assume followers[this.currentToken] || this.currentToken == Token.EndOfFile;
   return result;
 }
Esempio n. 22
0
        public void EvaluateSimpleAdditionSymbolicAndValueResult()
        {
            var addition = new Addition(new Number("a"), new Number("4.6"));

            Assert.AreEqual("a+4.6", ((Number)addition.Evaluate()).ToString());
        }
Esempio n. 23
0
        public void Addition(decimal x, decimal y, decimal result)
        {
            var calculation = new Addition(x, y);

            calculation.Calculate().Should().Be(result);
        }
Esempio n. 24
0
 public static void RemoveAddition(Actor actor, Addition addition)
 {
     RemoveAddition(actor, addition, false);
 }
Esempio n. 25
0
        //Форитрование графика замен на первый семестр
        private void btnSemestr1_Click(object sender, EventArgs e)
        {
            int curRow;

            string[] FIO;
            string   Surname;
            string   Name;
            string   Patronymic;
            string   Addition;

            //Очищаем сетку
            dgSwap.Rows.Clear();
            dgSwap.Columns.Clear();

            //Делаем невидимыми нуль-строку и нуль-столбец
            dgSwap.ColumnHeadersVisible = false;
            dgSwap.RowHeadersVisible    = false;

            //Задаём количество столбцов
            //оно остаётся неизменным
            //в количестве 6 штук
            for (int i = 0; i <= 5; i++)
            {
                dgSwap.Columns.Add("", "");
            }

            //Создаём строки
            //1. под шапку таблицы

            dgSwap.Rows.Add();

            //Текущая строка первая
            curRow = 0;
            //Заполняем первую строку и одновременно формируем размерности
            dgSwap.Columns[0].Width = 30;
            dgSwap[0, curRow].Value = "№ п/п";

            dgSwap.Columns[1].Width = 350;
            dgSwap[1, curRow].Value = "Дисциплина";

            dgSwap.Columns[2].Width = 70;
            dgSwap[2, curRow].Value = "Группа";

            dgSwap.Columns[3].Width = 150;
            dgSwap[3, curRow].Value = "Основной преподаватель";

            dgSwap.Columns[4].Width = 150;
            dgSwap[4, curRow].Value = "Замещающий преподаватель";

            dgSwap.Columns[5].Width = 150;
            dgSwap[5, curRow].Value = "Резервный преподаватель";

            //Формируем строки по заменам преподавателей в первом семестре
            //прогоняем все строки фактической нагрузки
            for (int i = 0; i <= mdlData.colDistribution.Count - 1; i++)
            {
                //смотрим только второй семестр
                if (mdlData.colDistribution[i].Semestr.SemNum.Equals("1 семестр"))
                {
                    //Если есть часы на ГАК, на аспирантуру, на диплом,
                    //на преддипломную практику, на производственную практику,
                    //на посещение учебных занятий,
                    //на учебную практику, то не рассматриваем эти строки
                    if (!(mdlData.colDistribution[i].GAK > 0) & !(mdlData.colDistribution[i].PostGrad > 0) &
                        !(mdlData.colDistribution[i].DiplomaPaper > 0) & !(mdlData.colDistribution[i].PreDiplomaPractice > 0) &
                        !(mdlData.colDistribution[i].ProducingPractice > 0) & !(mdlData.colDistribution[i].TutorialPractice > 0) &
                        !(mdlData.colDistribution[i].Visiting > 0))
                    {
                        if ((mdlData.colDistribution[i].Subject.Subject == "Посещение занятий") ||
                            (mdlData.colDistribution[i].Subject.Subject == "Аспирантура"))
                        {
                            continue;
                        }
                        //добавляем строку
                        dgSwap.Rows.Add();
                        //счётчик текущей строки увеличиваем на единицу
                        curRow += 1;
                        //дополнение к названию дисциплины
                        Addition = "(";

                        //Если есть лекционные часы
                        if (mdlData.colDistribution[i].Lecture > 0)
                        {
                            //пишем про наличие лекции
                            Addition += "лк,";
                        }

                        //Если уже дописали вид нагрузки, то более ничего не пишем
                        if (!(Addition.EndsWith(",")))
                        {
                            //Если есть практические часы
                            if (mdlData.colDistribution[i].Practice > 0)
                            {
                                //пишем про наличие практических
                                Addition += "пр,";
                            }
                        }

                        //Если уже дописали вид нагрузки, то более ничего не пишем
                        if (!(Addition.EndsWith(",")))
                        {
                            //Если есть лабораторные часы
                            if (mdlData.colDistribution[i].LabWork > 0)
                            {
                                //пишем про наличие лабораторных
                                Addition += "лб,";
                            }
                        }

                        //Если уже дописали вид нагрузки, то более ничего не пишем
                        if (!(Addition.EndsWith(",")))
                        {
                            //Если есть курсовой проект
                            if (mdlData.colDistribution[i].KursProject > 0)
                            {
                                //пишем про наличие курсового проекта
                                Addition += "к/пр,";
                            }
                        }

                        //Убираем запятую
                        if (Addition.EndsWith(","))
                        {
                            Addition = Addition.Substring(0, Addition.Length - 1);
                        }

                        //Закрываем скобку
                        Addition += ")";

                        //Если внутри скобок пустота, то
                        if (Addition == "()")
                        {
                            //убираем скобки
                            Addition = "";
                        }

                        //В номер по порядку вписываем значение счётчика
                        dgSwap[0, curRow].Value = curRow.ToString();
                        //Вписываем название дисциплины с дополнением
                        dgSwap[1, curRow].Value = mdlData.colDistribution[i].Subject.Subject.ToString() + " " + Addition;
                        //Название группы с номером курса

                        if (!(mdlData.colDistribution[i].Speciality == null) & !(mdlData.colDistribution[i].KursNum == null))
                        {
                            dgSwap[2, curRow].Value = mdlData.colDistribution[i].Speciality.ShortInstitute.ToString() + "-" +
                                                      mdlData.colDistribution[i].KursNum.Kurs.ToString();
                        }
                        else
                        {
                            if (!(mdlData.colDistribution[i].Speciality == null))
                            {
                                dgSwap[2, curRow].Value = mdlData.colDistribution[i].Speciality.ShortInstitute.ToString();
                            }
                            else
                            {
                                if (!(mdlData.colDistribution[i].KursNum == null))
                                {
                                    dgSwap[2, curRow].Value = "???-" +
                                                              mdlData.colDistribution[i].KursNum.Kurs.ToString();
                                }
                            }
                        }

                        //Разбираем строку для вывода отдельно
                        //Фамилии, имени и отчества основного преподавателя
                        FIO = mdlData.colDistribution[i].Lecturer.FIO.Split(new char[] { ' ' });

                        if (FIO.GetLength(0) == 3)
                        {
                            Surname    = FIO[0];
                            Name       = FIO[1].Substring(0, 1) + ".";
                            Patronymic = FIO[2].Substring(0, 1) + ".";
                        }
                        else if (FIO.GetLength(0) == 2)
                        {
                            Surname    = FIO[0];
                            Name       = FIO[1].Substring(0, 1) + ".";
                            Patronymic = "";
                        }
                        else if (FIO.GetLength(0) == 1)
                        {
                            Surname    = FIO[0];
                            Name       = "";
                            Patronymic = "";
                        }
                        else
                        {
                            Surname    = "";
                            Name       = "";
                            Patronymic = "";
                        }

                        dgSwap[3, curRow].Value = Surname + " " + Name + Patronymic;

                        //Разбираем строку для вывода отдельно
                        //Фамилии, имени и отчества заменяющего преподавателя
                        if (!(mdlData.colDistribution[i].Lecturer2 == null))
                        {
                            FIO = mdlData.colDistribution[i].Lecturer2.FIO.Split(new char[] { ' ' });

                            if (FIO.GetLength(0) == 3)
                            {
                                Surname    = FIO[0];
                                Name       = FIO[1].Substring(0, 1) + ".";
                                Patronymic = FIO[2].Substring(0, 1) + ".";
                            }
                            else if (FIO.GetLength(0) == 2)
                            {
                                Surname    = FIO[0];
                                Name       = FIO[1].Substring(0, 1) + ".";
                                Patronymic = "";
                            }
                            else if (FIO.GetLength(0) == 1)
                            {
                                Surname    = FIO[0];
                                Name       = "";
                                Patronymic = "";
                            }
                            else
                            {
                                Surname    = "";
                                Name       = "";
                                Patronymic = "";
                            }

                            dgSwap[4, curRow].Value = Surname + " " + Name + Patronymic;
                        }

                        //Разбираем строку для вывода отдельно
                        //Фамилии, имени и отчества резервного преподавателя
                        if (!(mdlData.colDistribution[i].Lecturer3 == null))
                        {
                            FIO = mdlData.colDistribution[i].Lecturer3.FIO.Split(new char[] { ' ' });

                            if (FIO.GetLength(0) == 3)
                            {
                                Surname    = FIO[0];
                                Name       = FIO[1].Substring(0, 1) + ".";
                                Patronymic = FIO[2].Substring(0, 1) + ".";
                            }
                            else if (FIO.GetLength(0) == 2)
                            {
                                Surname    = FIO[0];
                                Name       = FIO[1].Substring(0, 1) + ".";
                                Patronymic = "";
                            }
                            else if (FIO.GetLength(0) == 1)
                            {
                                Surname    = FIO[0];
                                Name       = "";
                                Patronymic = "";
                            }
                            else
                            {
                                Surname    = "";
                                Name       = "";
                                Patronymic = "";
                            }

                            dgSwap[5, curRow].Value = Surname + " " + Name + Patronymic;
                        }
                    }
                }
            }
        }
Esempio n. 26
0
        private void Initialize()
        {
            var add      = new Addition();
            var sub      = new Subtraction();
            var mul      = new Multiplication();
            var div      = new Division();
            var mean     = new Average();
            var sin      = new Sine();
            var cos      = new Cosine();
            var tan      = new Tangent();
            var log      = new Logarithm();
            var exp      = new Exponential();
            var @if      = new IfThenElse();
            var gt       = new GreaterThan();
            var lt       = new LessThan();
            var and      = new And();
            var or       = new Or();
            var not      = new Not();
            var constant = new Constant();

            constant.MinValue = -20;
            constant.MaxValue = 20;
            variableSymbol    = new HeuristicLab.Problems.DataAnalysis.Symbolic.Variable();

            var allSymbols = new List <Symbol>()
            {
                add, sub, mul, div, mean, sin, cos, tan, log, exp, @if, gt, lt, and, or, not, constant, variableSymbol
            };
            var unaryFunctionSymbols = new List <Symbol>()
            {
                sin, cos, tan, log, exp, not
            };
            var binaryFunctionSymbols = new List <Symbol>()
            {
                gt, lt
            };
            var functionSymbols = new List <Symbol>()
            {
                add, sub, mul, div, mean, and, or
            };

            foreach (var symb in allSymbols)
            {
                AddSymbol(symb);
            }

            foreach (var funSymb in functionSymbols)
            {
                SetSubtreeCount(funSymb, 1, 3);
            }
            foreach (var funSymb in unaryFunctionSymbols)
            {
                SetSubtreeCount(funSymb, 1, 1);
            }
            foreach (var funSymb in binaryFunctionSymbols)
            {
                SetSubtreeCount(funSymb, 2, 2);
            }

            SetSubtreeCount(@if, 3, 3);
            SetSubtreeCount(constant, 0, 0);
            SetSubtreeCount(variableSymbol, 0, 0);

            // allow each symbol as child of the start symbol
            foreach (var symb in allSymbols)
            {
                AddAllowedChildSymbol(StartSymbol, symb, 0);
            }

            // allow each symbol as child of every other symbol (except for terminals that have maxSubtreeCount == 0)
            foreach (var parent in allSymbols)
            {
                for (int i = 0; i < GetMaximumSubtreeCount(parent); i++)
                {
                    foreach (var child in allSymbols)
                    {
                        AddAllowedChildSymbol(parent, child, i);
                    }
                }
            }
        }
Esempio n. 27
0
        private void tableMain(object ObjMissing, Word._Document ObjDoc)
        {
            int curRow;

            int countCol;
            int countRow;

            string[] FIO;
            string   Surname;
            string   Name;
            string   Patronymic;
            string   Addition;

            //Задаём закладку конца документа
            object EndOfDoc = "\\endofdoc";

            Word.Table ObjTable;
            Word.Range ObjWordRange;

            //Задаём количество столбцов
            //оно остаётся неизменным
            //в количестве 6 штук
            countCol = 6;
            //Создаём строки
            //1. под шапку таблицы
            countRow = 1;

            //Формируем строки по заменам преподавателей в первом семестре
            //прогоняем все строки фактической нагрузки
            for (int i = 0; i <= mdlData.colDistribution.Count - 1; i++)
            {
                //смотрим только второй семестр
                if (mdlData.colDistribution[i].Semestr.SemNum.Equals(cmbSemestr.SelectedItem.ToString()))
                {
                    //Если есть часы на ГАК, на аспирантуру, на диплом,
                    //на преддипломную практику, на производственную практику,
                    //на посещение учебных занятий,
                    //на учебную практику, то не рассматриваем эти строки
                    if (!(mdlData.colDistribution[i].GAK > 0) & !(mdlData.colDistribution[i].PostGrad > 0) &
                        !(mdlData.colDistribution[i].DiplomaPaper > 0) & !(mdlData.colDistribution[i].PreDiplomaPractice > 0) &
                        !(mdlData.colDistribution[i].ProducingPractice > 0) & !(mdlData.colDistribution[i].TutorialPractice > 0) &
                        !(mdlData.colDistribution[i].Visiting > 0))
                    {
                        if ((mdlData.colDistribution[i].Subject.Subject == "Посещение занятий") ||
                            (mdlData.colDistribution[i].Subject.Subject == "Аспирантура") ||
                            (mdlData.colDistribution[i].Subject.Subject == "Руководство магистрами"))
                        {
                            continue;
                        }
                        //добавляем строку
                        countRow++;
                    }
                }
            }

            //Вставляем таблицу согласно заполненной сетке и заполняем её данными о нагрузке
            ObjWordRange = ObjDoc.Bookmarks.get_Item(ref EndOfDoc).Range;
            ObjTable     = ObjDoc.Tables.Add(ObjWordRange, countRow, countCol, ref ObjMissing, ref ObjMissing);

            //Размер шрифта 10 пт
            ObjTable.Range.Font.Size = 10;
            //Выравнивание по левому краю
            ObjTable.Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphLeft;
            //Отступ после абзаца отсутствует
            ObjTable.Range.ParagraphFormat.SpaceAfter = 0;
            //Отступ в 0 пт до абзаца
            ObjTable.Range.ParagraphFormat.SpaceBefore = 0;
            //Одинарный межстрочный интервал
            ObjTable.Range.ParagraphFormat.Space1();
            //Границы таблицы включены
            ObjTable.Borders.Enable = 1;

            //Текущая строка первая
            curRow = 1;
            ObjTable.Rows[1].Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter;
            ObjTable.Rows[1].Range.Font.Bold = 1;
            //Заполняем первую строку и одновременно формируем размерности
            ObjTable.Cell(curRow, 1).Range.Text = "№ п/п";

            ObjTable.Cell(curRow, 2).Range.Text = "Дисциплина";

            ObjTable.Cell(curRow, 3).Range.Text = "Группа";

            ObjTable.Cell(curRow, 4).Range.Text = "Основной преподаватель";

            ObjTable.Cell(curRow, 5).Range.Text = "Замещающий преподаватель";

            ObjTable.Cell(curRow, 6).Range.Text = "Резервный преподаватель";

            //Формируем строки по заменам преподавателей в первом семестре
            //прогоняем все строки фактической нагрузки
            for (int i = 0; i <= mdlData.colDistribution.Count - 1; i++)
            {
                //смотрим только второй семестр
                if (mdlData.colDistribution[i].Semestr.SemNum.Equals(cmbSemestr.SelectedItem.ToString()))
                {
                    //Если есть часы на ГАК, на аспирантуру, на диплом,
                    //на преддипломную практику, на производственную практику,
                    //на посещение учебных занятий,
                    //на учебную практику, то не рассматриваем эти строки
                    if (!(mdlData.colDistribution[i].GAK > 0) & !(mdlData.colDistribution[i].PostGrad > 0) &
                        !(mdlData.colDistribution[i].DiplomaPaper > 0) & !(mdlData.colDistribution[i].PreDiplomaPractice > 0) &
                        !(mdlData.colDistribution[i].ProducingPractice > 0) & !(mdlData.colDistribution[i].TutorialPractice > 0) &
                        !(mdlData.colDistribution[i].Visiting > 0))
                    {
                        if ((mdlData.colDistribution[i].Subject.Subject == "Посещение занятий") ||
                            (mdlData.colDistribution[i].Subject.Subject == "Аспирантура") ||
                            (mdlData.colDistribution[i].Subject.Subject == "Руководство магистрами"))
                        {
                            continue;
                        }
                        //счётчик текущей строки увеличиваем на единицу
                        curRow += 1;
                        //дополнение к названию дисциплины
                        Addition = "(";

                        //Если есть лекционные часы
                        if (mdlData.colDistribution[i].Lecture > 0)
                        {
                            //пишем про наличие лекции
                            Addition += "лк,";
                        }

                        //Если уже дописали вид нагрузки, то более ничего не пишем
                        if (!(Addition.EndsWith(",")))
                        {
                            //Если есть практические часы
                            if (mdlData.colDistribution[i].Practice > 0)
                            {
                                //пишем про наличие практических
                                Addition += "пр,";
                            }
                        }

                        //Если уже дописали вид нагрузки, то более ничего не пишем
                        if (!(Addition.EndsWith(",")))
                        {
                            //Если есть лабораторные часы
                            if (mdlData.colDistribution[i].LabWork > 0)
                            {
                                //пишем про наличие лабораторных
                                Addition += "лб,";
                            }
                        }

                        //Если уже дописали вид нагрузки, то более ничего не пишем
                        if (!(Addition.EndsWith(",")))
                        {
                            //Если есть курсовой проект
                            if (mdlData.colDistribution[i].KursProject > 0)
                            {
                                //пишем про наличие курсового проекта
                                Addition += "к/пр,";
                            }
                        }

                        //Убираем запятую
                        if (Addition.EndsWith(","))
                        {
                            Addition = Addition.Substring(0, Addition.Length - 1);
                        }

                        //Закрываем скобку
                        Addition += ")";

                        //Если внутри скобок пустота, то
                        if (Addition == "()")
                        {
                            //убираем скобки
                            Addition = "";
                        }

                        //В номер по порядку вписываем значение счётчика
                        ObjTable.Cell(curRow, 1).Range.Text = (curRow - 1).ToString();
                        //Вписываем название дисциплины с дополнением
                        ObjTable.Cell(curRow, 2).Range.Text = mdlData.colDistribution[i].Subject.Subject.ToString() + " " + Addition;
                        //Название группы с номером курса

                        if (!(mdlData.colDistribution[i].Speciality == null) & !(mdlData.colDistribution[i].KursNum == null))
                        {
                            ObjTable.Cell(curRow, 3).Range.Text = mdlData.colDistribution[i].Speciality.ShortInstitute.ToString() + "-" +
                                                                  mdlData.colDistribution[i].KursNum.Kurs.ToString();
                        }
                        else
                        {
                            if (!(mdlData.colDistribution[i].Speciality == null))
                            {
                                ObjTable.Cell(curRow, 3).Range.Text = mdlData.colDistribution[i].Speciality.ShortInstitute.ToString();
                            }
                            else
                            {
                                if (!(mdlData.colDistribution[i].KursNum == null))
                                {
                                    ObjTable.Cell(curRow, 3).Range.Text = "???-" +
                                                                          mdlData.colDistribution[i].KursNum.Kurs.ToString();
                                }
                            }
                        }

                        //Разбираем строку для вывода отдельно
                        //Фамилии, имени и отчества основного преподавателя
                        if (mdlData.colDistribution[i].Lecturer != null)
                        {
                            FIO = mdlData.colDistribution[i].Lecturer.FIO.Split(new char[] { ' ' });

                            if (FIO.GetLength(0) == 3)
                            {
                                Surname    = FIO[0];
                                Name       = FIO[1].Substring(0, 1) + ".";
                                Patronymic = FIO[2].Substring(0, 1) + ".";
                            }
                            else if (FIO.GetLength(0) == 2)
                            {
                                Surname    = FIO[0];
                                Name       = FIO[1].Substring(0, 1) + ".";
                                Patronymic = "";
                            }
                            else if (FIO.GetLength(0) == 1)
                            {
                                Surname    = FIO[0];
                                Name       = "";
                                Patronymic = "";
                            }
                            else
                            {
                                Surname    = "";
                                Name       = "";
                                Patronymic = "";
                            }

                            ObjTable.Cell(curRow, 4).Range.Text = Surname + " " + Name + Patronymic;
                        }

                        //Разбираем строку для вывода отдельно
                        //Фамилии, имени и отчества заменяющего преподавателя
                        if (!(mdlData.colDistribution[i].Lecturer2 == null))
                        {
                            FIO = mdlData.colDistribution[i].Lecturer2.FIO.Split(new char[] { ' ' });

                            if (FIO.GetLength(0) == 3)
                            {
                                Surname    = FIO[0];
                                Name       = FIO[1].Substring(0, 1) + ".";
                                Patronymic = FIO[2].Substring(0, 1) + ".";
                            }
                            else if (FIO.GetLength(0) == 2)
                            {
                                Surname    = FIO[0];
                                Name       = FIO[1].Substring(0, 1) + ".";
                                Patronymic = "";
                            }
                            else if (FIO.GetLength(0) == 1)
                            {
                                Surname    = FIO[0];
                                Name       = "";
                                Patronymic = "";
                            }
                            else
                            {
                                Surname    = "";
                                Name       = "";
                                Patronymic = "";
                            }

                            ObjTable.Cell(curRow, 5).Range.Text = Surname + " " + Name + Patronymic;
                        }

                        //Разбираем строку для вывода отдельно
                        //Фамилии, имени и отчества резервного преподавателя
                        if (!(mdlData.colDistribution[i].Lecturer3 == null))
                        {
                            FIO = mdlData.colDistribution[i].Lecturer3.FIO.Split(new char[] { ' ' });

                            if (FIO.GetLength(0) == 3)
                            {
                                Surname    = FIO[0];
                                Name       = FIO[1].Substring(0, 1) + ".";
                                Patronymic = FIO[2].Substring(0, 1) + ".";
                            }
                            else if (FIO.GetLength(0) == 2)
                            {
                                Surname    = FIO[0];
                                Name       = FIO[1].Substring(0, 1) + ".";
                                Patronymic = "";
                            }
                            else if (FIO.GetLength(0) == 1)
                            {
                                Surname    = FIO[0];
                                Name       = "";
                                Patronymic = "";
                            }
                            else
                            {
                                Surname    = "";
                                Name       = "";
                                Patronymic = "";
                            }

                            ObjTable.Cell(curRow, 6).Range.Text = Surname + " " + Name + Patronymic;
                        }
                    }
                }
            }

            ObjTable.Columns[1].Width = 0.94f / 0.03527f;
            ObjTable.Columns[2].Width = 7.05f / 0.03527f;
            ObjTable.Columns[3].Width = 1.70f / 0.03527f;
            ObjTable.Columns[4].Width = 3.09f / 0.03527f;
            ObjTable.Columns[5].Width = 3.62f / 0.03527f;
            ObjTable.Columns[6].Width = 3.43f / 0.03527f;
        }
Esempio n. 28
0
        private static List <Operation> Solve2(string[] lines)
        {
            List <Operation> res = new List <Operation>();

            foreach (string line in lines)
            {
                Dictionary <int, List <Operation> > ops = new Dictionary <int, List <Operation> >();
                int Depth = 0;
                foreach (char c in line.Replace(" ", ""))
                {
                    KeyValuePair <int, List <Operation> > last = ops.LastOrDefault(x => x.Key == Depth);
                    switch (c)
                    {
                    case '+':
                        if (last.Value == null)
                        {
                            Operation top = ops.LastOrDefault(x => x.Key == Depth + 1).Value.Last();
                            ops[Depth] = new List <Operation>()
                            {
                                new Addition(top, Depth)
                            };
                            ops.Remove(top.Priority);
                        }
                        else
                        {
                            if (last.Value.Last() is Multiplication && Depth == last.Value.Last().Priority)
                            {
                                Operation op = new Addition(last.Value.Last().Right, Depth);
                                ops[Depth].Add(op);
                                Operation second = last.Value.Reverse <Operation>().Skip(1).First();
                                second.Right = op;
                            }
                            else
                            {
                                ops[Depth][ops[Depth].Count() - 1] = new Addition(last.Value.Last(), Depth);
                            }
                        }
                        break;

                    case '*':
                        if (last.Value == null)
                        {
                            Operation top = ops.LastOrDefault(x => x.Key == Depth + 1).Value.First();
                            ops[Depth] = new List <Operation>()
                            {
                                new Multiplication(top, Depth)
                            };
                            ops.Remove(top.Priority);
                        }
                        else
                        {
                            ops[Depth][ops[Depth].Count() - 1] = new Multiplication(last.Value.Last(), Depth);
                        }
                        break;

                    case '(':
                        Depth++;
                        break;

                    case ')':
                        Depth--;
                        List <Operation> prev = ops.LastOrDefault(x => x.Key == Depth).Value;
                        if (prev != null && prev.Count > 0)
                        {
                            prev.Last().Right = last.Value.First();
                            if (prev.Count > 1)
                            {
                                prev.RemoveAt(1);
                            }
                            ops.Remove(last.Key);
                        }
                        break;

                    default:
                        int num = Convert.ToInt32(c.ToString());
                        if (last.Value == null)
                        {
                            ops.Add(Depth, new List <Operation>()
                            {
                                new Number(num, Depth)
                            });
                        }
                        else if (last.Key == Depth)
                        {
                            if (last.Value.Count > 1)
                            {
                                last.Value.Last(x => x.Right == null).Right = new Number(num, Depth);
                                last.Value.RemoveAt(1);
                            }
                            else
                            {
                                last.Value.First().Right = new Number(num, Depth);
                            }
                        }
                        else
                        {
                            ops.Add(Depth, new List <Operation>()
                            {
                                new Number(num, Depth)
                            });
                        }
                        break;
                    }
                }
                res.Add(ops.First().Value.First());
            }
            return(res);
        }
 public CalculatorController(Addition addition)
 {
     _addition = addition;
 }
Esempio n. 30
0
        public void Zero_Plus_Zero_Font_Zero()
        {
            var addition = new Addition(0, 0);

            Assert.AreEqual(0, addition.Resultat);
        }
 public void SumTest()
 {
     Assert.AreEqual(7, Addition.Sum(4, 3));
 }
Esempio n. 32
0
 //The "ans" will be recreated in the function.
 public static bool MatrixAddSub(Matrix a, Matrix b,ref Matrix ans, Addition c)
 {
     if (a.col != b.col || a.row != b.row)
         return false;
     ans = new Matrix(a.row, a.col);
     for (int i = 0; i < a.row; i++)
         for (int j = 0; j < a.col; j++)
             ans.SetData(i, j,(c == Addition.Add) ? (a.GetData(i, j) + b.GetData(i, j)) : (a.GetData(i, j) - b.GetData(i, j)));
     return true;
 }
Esempio n. 33
0
 protected override void OnDisappearing()
 {
     base.OnDisappearing();
     nonotesImage.IsVisible = false;
     nonotesImage.Source    = Addition.ChooseImage();
 }
Esempio n. 34
0
 public void AddTest1()
 {
     Assert.AreEqual(20, Addition.Add(a.Next(1, 10)));
 }
Esempio n. 35
0
        //public event PropertyChangedEventHandler PropertyChanged;
        //protected void OnPropertyChanged2(string propertyName = null)
        //{
        //    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        //}

        public TodayPage()
        {
            Title = "Дела на сегодня";
            ToolbarItem toolbar_edit2 = new ToolbarItem {
                Icon = "toolbar_edit3.png"
            };

            toolbar_edit2.Clicked += Toolbar_edit2_Clicked;
            ToolbarItems.Add(ToolbarItem);
            ToolbarItems.Add(toolbar_edit2);
            BindingContext = new NotesViewModel {
                Navigation = this.Navigation
            };

            todayNotesListView = new CustomListView
            {
                HasUnevenRows       = true,
                IsGroupingEnabled   = true,
                GroupHeaderTemplate = new DataTemplate(() =>
                {
                    Label headerLabel = new Label
                    {
                        TextColor      = Color.FromHex("0D47A1"),
                        FontAttributes = FontAttributes.None,
                        Margin         = new Thickness(25, 20, 0, 15)
                    };
                    headerLabel.SetBinding(Label.TextProperty, "Name");
                    return(new ViewCell
                    {
                        View = headerLabel
                    });
                }),
                ItemTemplate = new DataTemplate(() =>
                {
                    Label nameLabel = new Label
                    {
                        FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                        Margin   = new Thickness(5, 0, 0, 0)
                    };
                    nameLabel.SetBinding(Label.TextProperty, "Name");

                    Label commentLabel = new Label();
                    commentLabel.SetBinding(Label.TextProperty, "Comment");
                    commentLabel.SetBinding(Label.IsVisibleProperty, "HasComment");

                    Label sublabel = new Label {
                        IsVisible = false
                    };
                    sublabel.SetBinding(Label.TextProperty, "Subtasks_string", BindingMode.TwoWay);

                    int count_subtasks     = 0;
                    StackLayout subtasksSL = new StackLayout
                    {
                        Margin  = new Thickness(35, 0, 0, 0),
                        Spacing = 10
                    };
                    subtasksSL.SetBinding(StackLayout.IsVisibleProperty, "HasSubtasks");

                    sublabel.BindingContextChanged += (sender, e) =>
                    {
                        string str = sublabel.Text;
                        if (str != null)
                        {
                            string[] subtasks_array = str.Split(new char[] { '✖' });
                            foreach (char s in str)
                            {
                                if (s == '✖')
                                {
                                    count_subtasks++;
                                }
                            }

                            for (int i = 1; i <= count_subtasks; i++)
                            {
                                int subtask_index = i - 1;
                                CustomButton donesubtaskButton = new CustomButton
                                {
                                    FontSize          = Device.GetNamedSize(NamedSize.Micro, typeof(Button)),
                                    WidthRequest      = 23,
                                    HeightRequest     = 23,
                                    BorderRadius      = 12,
                                    BackgroundColor   = Color.Transparent,
                                    BorderWidth       = 1,
                                    BorderColor       = Color.LightGray,
                                    HorizontalOptions = LayoutOptions.Center,
                                    VerticalOptions   = LayoutOptions.Start
                                };
                                donesubtaskButton.SetBinding(Button.TextColorProperty, "TextColorSubtasks");
                                donesubtaskButton.SetBinding(Button.BorderColorProperty, "ColorSubtasks");

                                Label newsubtaskLabel = new Label
                                {
                                    FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Entry)),
                                    Text     = subtasks_array[i - 1]
                                };

                                if (Addition.IsStrikethrough(newsubtaskLabel.Text) == true)
                                {
                                    donesubtaskButton.Text = "✔";
                                }

                                StackLayout newsubtaskSL = new StackLayout
                                {
                                    Children    = { donesubtaskButton, newsubtaskLabel },
                                    Orientation = StackOrientation.Horizontal
                                };
                                subtasksSL.Children.Add(newsubtaskSL);

                                donesubtaskButton.Clicked += async(sender2, e2) =>
                                {
                                    string substringOld = newsubtaskLabel.Text;
                                    if (Addition.IsStrikethrough(newsubtaskLabel.Text) == true)
                                    {
                                        donesubtaskButton.Text = "";
                                        newsubtaskLabel.Text   = Addition.ConvertFromStrikethrough(newsubtaskLabel.Text);
                                    }
                                    else
                                    {
                                        donesubtaskButton.Text = "✔";
                                        newsubtaskLabel.Text   = Addition.ConvertToStrikethrough(newsubtaskLabel.Text);
                                    }
                                    subtasks_array[subtask_index] = newsubtaskLabel.Text;
                                    str           = String.Join("✖", subtasks_array);
                                    sublabel.Text = str;

                                    var note = sublabel?.BindingContext as NoteVM;
                                    await App.Database.SaveItemAsync(note);
                                };
                            }
                        }
                    };

                    Label everydayLabel = new Label
                    {
                        Text     = "Каждый день",
                        FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label))
                    };
                    everydayLabel.SetBinding(Label.IsVisibleProperty, "Repeat");

                    Label overdueLabel = new Label {
                        FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label))
                    };
                    overdueLabel.SetBinding(Label.TextProperty, "Overdue_str");
                    overdueLabel.SetBinding(Label.IsVisibleProperty, "IsOverdue");

                    CustomButton doneButton = new CustomButton
                    {
                        FontSize          = Device.GetNamedSize(NamedSize.Micro, typeof(Button)),
                        WidthRequest      = 30,
                        HeightRequest     = 30,
                        BorderRadius      = 15,
                        BorderColor       = Color.LightGray,
                        BorderWidth       = 1,
                        HorizontalOptions = LayoutOptions.Center,
                        VerticalOptions   = LayoutOptions.Start,
                        Margin            = new Thickness(0, 1, 0, 0)
                    };
                    doneButton.SetBinding(Button.BorderWidthProperty, "ButtonsWidth");
                    doneButton.SetBinding(BackgroundColorProperty, "ColorMarker");
                    doneButton.Clicked += Done_Clicked;
                    doneButton.Clicked += (sender, e) =>
                    {
                        nameLabel.Text = Addition.ConvertToStrikethrough(nameLabel.Text);
                    };

                    Button removeButton = new Button
                    {
                        Text            = "✖",
                        BackgroundColor = Color.White,
                        TextColor       = Color.FromHex("0D47A1")
                    };
                    removeButton.Clicked += RemoveButton_Clicked;

                    Button editButton = new Button
                    {
                        Text            = "•••",
                        FontAttributes  = FontAttributes.Bold,
                        BackgroundColor = Color.White,
                        TextColor       = Color.FromHex("0D47A1")
                    };
                    editButton.Clicked += edit_Clicked;

                    StackLayout invisibleStackL = new StackLayout
                    {
                        Orientation       = StackOrientation.Horizontal,
                        HorizontalOptions = LayoutOptions.Center,
                        Margin            = new Thickness(0, 10, 0, 0),
                        Padding           = new Thickness(-20, 0, 0, 0),
                        Children          = { /*doneButton,*/ removeButton, editButton }
                    };
                    invisibleStackL.SetBinding(StackLayout.IsVisibleProperty, "IsVisible");

                    return(new ViewCell
                    {
                        View = new StackLayout
                        {
                            Orientation = StackOrientation.Vertical,
                            Children =
                            {
                                new StackLayout
                                {
                                    Orientation = StackOrientation.Horizontal,
                                    Children =
                                    {
                                        doneButton,
                                        new StackLayout
                                        {
                                            Children =
                                            {
                                                nameLabel,
                                                new StackLayout
                                                {
                                                    Orientation = StackOrientation.Horizontal,
                                                    Children ={ everydayLabel, overdueLabel                },
                                                    Margin = new Thickness(5,                 0, 0, 0)
                                                },
                                            },
                                        }
                                    }
                                },
                                commentLabel,
                                sublabel,
                                subtasksSL,
                                invisibleStackL
                            },
                            Margin = new Thickness(10),
                            Padding = new Thickness(20, 0, 10, 0),
                            Spacing = 15,
                        }
                    });
                })
            };
            todayNotesListView.ItemTapped += todayNotesListView_ItemTapped;

            addButton = new Button
            {
                Text              = "+",
                FontSize          = Device.GetNamedSize(NamedSize.Large, typeof(Button)),
                BackgroundColor   = Color.FromHex("E3F2FD"),
                TextColor         = Color.FromHex("0D47A1"),
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.End,
                WidthRequest      = 70,
                HeightRequest     = 70,
                BorderRadius      = 35,
                Margin            = new Thickness(0, 0, 20, 20)
            };
            addButton.SetBinding(Button.CommandProperty, "CreateNoteCommand");

            RelativeLayout relativeLayout = new RelativeLayout();

            relativeLayout.Children.Add(todayNotesListView,
                                        Constraint.RelativeToParent((parent) => parent.X),
                                        Constraint.RelativeToParent((parent) => parent.Y /* + 20*/),
                                        Constraint.RelativeToParent((parent) => parent.Width),
                                        Constraint.RelativeToParent((parent) => parent.Height));

            //double getnonotesLabelWidth(RelativeLayout parent) => nonotesLabel.Measure(parent.Width, parent.Height).Request.Width;
            //relativeLayout.Children.Add(nonotesLabel,
            //    Constraint.RelativeToParent(parent => parent.Width / 2 - getnonotesLabelWidth(parent) / 2),
            //    Constraint.RelativeToParent(parent => parent.Height*.45));
            double getnonotesImageWidth(RelativeLayout parent) => nonotesImage.Measure(parent.Width, parent.Height).Request.Width;
            double getnonotesImageHeight(RelativeLayout parent) => nonotesImage.Measure(parent.Width, parent.Height).Request.Width;

            relativeLayout.Children.Add(nonotesImage,
                                        Constraint.RelativeToParent(parent => /*parent.Width/2- 100*/ parent.Width / 2 - getnonotesImageWidth(parent) / 2),
                                        Constraint.RelativeToParent(parent => parent.Height / 2 - getnonotesImageHeight(parent) / 2 /*parent.Height/2-100*/ /*parent.Height * .45*/));

            relativeLayout.Children.Add(addButton,
                                        Constraint.RelativeToParent((parent) => parent.Width * .75),
                                        Constraint.RelativeToParent((parent) => parent.Height * .8125));

            this.BackgroundColor = Color.White;
            this.Content         = relativeLayout;
        }
Esempio n. 36
0
 public void SumDoubleTest()
 {
     Assert.AreEqual(3.8, Addition.Sum(c, d));
 }
Esempio n. 37
0
 public dynamic Add(dynamic a, dynamic b)
 {
     result = Addition.Sum(a, b);
     return(result);
 }
Esempio n. 38
0
 public void SumDoubleArrayTest()
 {
     Assert.AreEqual(3.6, Addition.Sum(f));
 }
Esempio n. 39
0
        static public dynamic Add(dynamic augend, dynamic addend)
        {
            var result = Addition.Sum(augend, addend);

            return(result);
        }
Esempio n. 40
0
 public void OnDie()
 {
     I.state = 0;
     I.stance = Global.STANCE.DIE;
     foreach (MultiRunTask i in I.Tasks.Values)
     {
         try
         {
             i.Deactivate();
         }
         catch (Exception)
         {
         }
     }
     Addition[] additionlist = new Addition[I.BattleStatus.Additions.Count];
     I.BattleStatus.Additions.Values.CopyTo(additionlist, 0);
     foreach (Addition i in additionlist)
     {
         if (i.Activated)
             i.AdditionEnd();
     }
     I.BattleStatus.Additions.Clear();
     if (I.BattleStatus.Status != null) I.BattleStatus.Status.Clear();
     I.Tasks.Clear();
 }
Esempio n. 41
0
 static public dynamic Add(dynamic dArray)
 {
     return(Addition.Sum(dArray));
 }
Esempio n. 42
0
        public void EvaluateSimpleAdditionValueResult()
        {
            var addition = new Addition(new Number("2.6"), new Number("4.8"));

            Assert.AreEqual("7.4", ((Number)addition.Evaluate()).ToString());
        }
Esempio n. 43
0
 // POST: api/Additions
 public void Post([FromBody] Addition addition)
 {
     _additions.Add(addition);
 }
Esempio n. 44
0
 public DataAdditionsCollection(uint characterid)
 {
     this.owner = characterid;
     this.additions = new Addition();
 }
Esempio n. 45
0
 /// <summary>
 /// Apply a addition to an actor
 /// </summary>
 /// <param name="actor">Actor which the addition should be applied to</param>
 /// <param name="addition">Addition to be applied</param>
 public static void ApplyAddition(Actor actor, Addition addition)
 {
     if (actor.BattleStatus.Additions.ContainsKey(addition.Name))
     {
         Addition oldaddition = actor.BattleStatus.Additions[addition.Name];
         if (oldaddition.Activated)
             oldaddition.AdditionEnd();
         if (addition.IfActivate)
         {
             addition.AdditionStart();
             addition.StartTime = DateTime.Now;
             addition.Activated = true;
         }
         actor.BattleStatus.Additions.Remove(addition.Name);
         actor.BattleStatus.Additions.Add(addition.Name, addition);
     }
     else
     {
         if (addition.IfActivate)
         {
             addition.AdditionStart();
             addition.StartTime = DateTime.Now;
             addition.Activated = true;
         }
         actor.BattleStatus.Additions.Add(addition.Name, addition);
     }
 }
 public FolderAddition(ProjectNode project, string newFolderPath, string sourceFolder, DropEffect dropEffect, Addition[] additions) {
     Project = project;
     NewFolderPath = newFolderPath;
     SourceFolder = sourceFolder;
     Additions = additions;
     DropEffect = dropEffect;
 }
Esempio n. 47
0
 public DataAdditionsCollection(Character target)
 {
     owner = target.ModelId;
     additions = target._additions;
 }
Esempio n. 48
-1
        public void OnJobChange(byte NewJob,byte ChangeWeapon, ushort postfix)
        {
            //removing passive status

            #region Old Addition handling
            List<string> dellist = new List<string>();
            foreach (string i in this.Char.Tasks.Keys)
            {
                try
                {
                    if (i == "AutoSave" || i == "RegenerationHP" || i == "RegenerationSP" || i == "LPReduction")
                        continue;
                    MultiRunTask task = this.Char.Tasks[i];
                    task.Deactivate();
                    dellist.Add(i);
                }
                catch (Exception ex)
                {
                    Logger.ShowError(ex);
                }
            }
            foreach (string i in dellist)
            {
                this.Char.Tasks.Remove(i);
            }
            #endregion

            #region New Addition Handling
            Addition[] additionlist = new Addition[this.Char.BattleStatus.Additions.Count];
            this.Char.BattleStatus.Additions.Values.CopyTo(additionlist, 0);
            foreach (Addition i in additionlist)
            {
                if (i.Activated)
                    i.AdditionEnd();
            }
            this.Char.BattleStatus.Additions.Clear();
            #endregion

            if (!this.Char.JobLevels.ContainsKey(this.Char.job))
            {
                this.Char.JobLevels.Add(this.Char.job, (byte)this.Char.jLevel);
                MapServer.charDB.NewJobLevel(this.Char, this.Char.job, (byte)this.Char.jLevel);
            }
            else
            {
                this.Char.JobLevels[this.Char.job] = (byte)this.Char.jLevel;
                MapServer.charDB.UpdateJobLevel(this.Char, this.Char.job, (byte)this.Char.jLevel);
            }
            this.Char.job = (JobType)NewJob;
            if (!this.Char.JobLevels.ContainsKey(this.Char.job))
            {
                this.Char.JobLevels.Add(this.Char.job, 1);
                MapServer.charDB.NewJobLevel(this.Char, this.Char.job, 1);
            }
            this.Char.jLevel = this.Char.JobLevels[this.Char.job];
            this.Char.jExp = ExperienceManager.Instance.GetExpForLevel(this.Char.jLevel - 1, ExperienceManager.LevelType.JLEVEL);

            Weapon weapon = WeaponFactory.GetActiveWeapon(this.Char);
            //Change weapon
            if (ChangeWeapon == 1)
            {
                WeaponInfo info;
                switch (this.Char.job)
                {
                    case JobType.ENCHANTER:
                        weapon.type = (ushort)WeaponType.SWORD_STICK;
                        weapon.augeSkillID = 150029;
                        break;
                    case JobType.SWORDMAN:
                        weapon.type = (ushort)WeaponType.LONG_SWORD;
                        weapon.augeSkillID = 150015;
                        break;
                    case JobType.THIEF:
                        weapon.type = (ushort)WeaponType.SHORT_SWORD;
                        weapon.augeSkillID = 150001;
                        break;
                    case JobType.RECRUIT:
                        weapon.type = (ushort)WeaponType.DAMPTFLINTE;
                        weapon.augeSkillID = 150043;
                        break;
                    case JobType.CLOWN:
                        weapon.type = (ushort)WeaponType.SHORT_SWORD;
                        weapon.augeSkillID = 150001;
                        break;
                    case JobType.NOVICE:
                        weapon.type = (ushort)WeaponType.SHORT_SWORD;
                        weapon.augeSkillID = 150001;
                        break;
                }
                info = WeaponFactory.GetWeaponInfo((byte)weapon.type, weapon.level);
                if (weapon.durability > info.maxdurability) weapon.durability = (ushort)info.maxdurability;
            }
            /*this.Char.str = 5;
            this.Char.dex = 3;
            this.Char.con = 3;
            this.Char.intel = 2;
            this.Char.luk = 0;
            this.Char.stpoints = (byte)(2 * (this.Char.cLevel - 1));*/
            SkillHandler.SkillResetOnJobChange(this.Char);
            SkillHandler.CalcHPSP(ref this.client.Char);
            this.client.SendCharStatus(0);
            this.client.SendBattleStatus();
            this.client.SendExtStats();
            Packets.Server.WeaponTypeChange p = new SagaMap.Packets.Server.WeaponTypeChange();
            p.SetType(weapon.type);
            p.SetWeaponAuge(weapon.augeSkillID);
            p.SetPostFix(postfix);
            this.client.netIO.SendPacket(p, client.SessionID);
            //if (this.checkTwoHanded())  //this is not working
                this.MakeInactive(EQUIP_SLOT.LEFT_HAND);
            Packets.Server.ChangedJob p2 = new SagaMap.Packets.Server.ChangedJob();
            p2.SetJob(NewJob);
            p2.SetUnknown(this.Char.id);
            this.client.netIO.SendPacket(p2, client.SessionID);
            if (this.Char.CurTarget != null)
            {
                Npc npc = (Npc)this.Char.CurTarget.e;
                npc.NPCChat(this.Char, 1758);
            }
            else
            {
                Logger.ShowDebug(this.Char.name + "->CurTarget == null ", null);
            }
            if (this.client.Party != null)
                this.client.Party.UpdateMemberInfo(this.client);
        }