private void ResolveAddition(string expression)
 {
     foreach (var addition in expression.Split("+", StringSplitOptions.RemoveEmptyEntries))
     {
         if (addition.Contains("/"))
         {
             ResolveDivision(expression);
             if (TryDivide(Divisions, out string resultOfDivision))
             {
                 Additions.Add(resultOfDivision);
             }
             else
             {
                 throw new Exception(resultOfDivision);
             }
         }
         else if (addition.Contains("*"))
         {
             Additions.Add(Multiply(addition.Split("*", StringSplitOptions.RemoveEmptyEntries)));
         }
         else
         {
             Additions.Add(addition);
         }
     }
 }
Exemple #2
0
            /// <summary>
            /// Result of a Difference Lines operation
            /// </summary>
            /// <param name="items"></param>
            /// <param name="leftValue"></param>
            /// <param name="rightValue"></param>
            public LineDifferenceResult(Item[] items, string leftValue, string rightValue)
            {
                var aLines = leftValue.Split('\n');
                var bLines = rightValue.Split('\n');
                var n      = 0;

                for (var fdx = 0; fdx < items.Length; fdx++)
                {
                    var aItem = items[fdx];
                    while ((n < aItem.StartB) && (n < bLines.Length))
                    {
                        Unchanged.Add(bLines[n]);
                        n++;
                    }
                    for (var m = 0; m < aItem.DeletedA; m++)
                    {
                        Deletions.Add(aLines[aItem.StartA + m]);
                    }
                    while (n < aItem.StartB + aItem.InsertedB)
                    {
                        Additions.Add(bLines[n]);
                        n++;
                    }
                    while (n < bLines.Length)
                    {
                        Unchanged.Add(bLines[n]);
                        n++;
                    }
                }
            }
Exemple #3
0
 public DishWithAddition(int id, string name, double price, string description, int dishGroupId,
                         List <Addition> additions) : base(id, name, price, description, dishGroupId)
 {
     foreach (var add in additions)
     {
         Additions.Add(add);
     }
 }
Exemple #4
0
        protected void DeferAdd(ITransient other)
        {
            if (other == null)
            {
                return;
            }

            Deletions.RemoveRef(other);
            Additions.Add(other);
        }
Exemple #5
0
        public Order Add(Product addition)
        {
            var orderAddition = Container.NewTransientInstance <OrderAddition>();

            orderAddition.Order   = this;
            orderAddition.Product = addition;
            Container.Persist(ref orderAddition);
            Price += orderAddition.Product.Price;
            Additions.Add(orderAddition);

            return(this);
        }
Exemple #6
0
        public void Add(params ITransient[] others)
        {
            foreach (var other in others)
            {
                if (other == null)
                {
                    continue;
                }

                Deletions.RemoveRef(other);
                Additions.Add(other);
            }
        }
Exemple #7
0
        public MathContainer SetAddition(AdditionConfig config)
        {
            if (config == null)
            {
                config = new AdditionConfig();
                config.SetDefault();
            }

            config.Repaire();

            for (var i = 0; i < config.Times; i++)
            {
                Additions.Add(GenerateAddition(config));
            }

            return(this);
        }
        public bool Add(T item, OperationDetails od)
        {
            var operation = new Operation <T>(item, od);

            if (Contains(item))
            {
                return(false);
            }

            if (Additions.Add(operation))
            {
                _setRisk(od.Risk);
                return(true);
            }

            return(false);
        }
Exemple #9
0
 public void AddComponent(GameComponent component)
 {
     AdditionMutex.WaitOne();
     Additions.Add(component);
     AdditionMutex.ReleaseMutex();
 }
Exemple #10
0
 public void Add(InstanceData data)
 {
     DataLock.WaitOne();
     Additions.Add(data);
     DataLock.ReleaseMutex();
 }
 /*
  * Dodaje dodatek do dania  aktualizuje cene
  * @param {Addition} add - Dodatek do dania
  * @return void;
  */
 public void Add(Addition add)
 {
     Additions.Add(add);
     Price += add.Price;
 }
Exemple #12
0
 public void AddCourse(TrainingCourse tc)
 {
     sampleData.Add(tc);
     Additions.Add(tc);
 }