Esempio n. 1
0
 /// <summary>
 /// Does not take  abstract products
 /// </summary>
 public void subtract(StorageSet set, bool showMessageAboutNegativeValue = true)
 {
     foreach (Storage stor in set)
     {
         this.subtract(stor, showMessageAboutNegativeValue);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// If duplicated than adds. Doesn't take abstract products
 /// </summary>
 internal void add(StorageSet what)
 {
     foreach (Storage n in what)
     {
         this.add(n);
     }
 }
Esempio n. 3
0
 /// <summary>
 /// checks inside (duplicates?)
 /// </summary>
 public void send(StorageSet whom, Storage howMuch)
 {
     if (has(howMuch))
     {
         Storage targetStorage = new Storage(howMuch);
         whom.Add(targetStorage);
         this.subtract(howMuch);
     }
 }
Esempio n. 4
0
 internal void copyDataFrom(StorageSet consumed)
 {
     foreach (Storage stor in consumed)
     {
         //if (stor.get() > 0f)
         this.set(stor);
     }
     // SetZero();
 }
Esempio n. 5
0
        /// <summary>
        /// returns new copy
        /// </summary>
        internal StorageSet Divide(float v)
        {
            StorageSet result = new StorageSet();

            foreach (Storage stor in container)
            {
                result.set(new Storage(stor.getProduct(), stor.get() / v));
            }
            return(result);
        }
Esempio n. 6
0
        /// <summary>
        /// Does not take  abstract products
        /// </summary>
        internal StorageSet subtractOuside(StorageSet substracting)
        {
            StorageSet result = new StorageSet();

            foreach (Storage stor in substracting)
            {
                result.add(this.subtractOutside(stor));
            }
            return(result);
        }
Esempio n. 7
0
        public StorageSet getCopy()
        {
            StorageSet res = new StorageSet();

            foreach (Storage stor in this)
            {
                res.container.Add(new Storage(stor.getProduct(), stor.get()));
            }
            return(res);
        }
Esempio n. 8
0
        /// <summary>
        /// Do checks outside
        /// </summary>
        public bool send(StorageSet whom, List <Storage> what)
        {
            bool res = true;

            foreach (var item in what)
            {
                whom.add(item);
                this.subtract(item);
            }
            return(res);
        }
Esempio n. 9
0
 /// <summary>Returns False when some check not presented in here</summary>
 internal bool has(StorageSet check)
 {
     foreach (Storage stor in check)
     {
         if (!has(stor))
         {
             return(false);
         }
     }
     return(true);
 }
Esempio n. 10
0
        //public PrimitiveStorageSet Divide(float v)
        //{
        //    PrimitiveStorageSet result = new PrimitiveStorageSet();
        //    foreach (Storage stor in container)
        //        result.Set(new Storage(stor.Product, stor.get() / v));
        //    return result;
        //}

        //public Storage subtractOutside(Storage stor)
        //{
        //    Storage find = this.findStorage(stor.Product);
        //    if (find == null)
        //        return new Storage(stor);
        //    else
        //        return new Storage(stor.Product, find.subtractOutside(stor).get());
        //}
        //public void subtract(StorageSet set, bool showMessageAboutNegativeValue = true)
        //{
        //    base.subtract(set, showMessageAboutNegativeValue);
        //    throw new DontUseThatMethod();
        //}

        // removed form ancestor
        //public void copyDataFrom(StorageSet consumed)
        //{
        //    base.copyDataFrom(consumed);
        //    throw new DontUseThatMethod();
        //}
        public void sendAll(StorageSet toWhom)
        {
            used.Add(this);
            base.sendAll(toWhom);
        }
Esempio n. 11
0
        //internal PrimitiveStorageSet Divide(float v)
        //{
        //    PrimitiveStorageSet result = new PrimitiveStorageSet();
        //    foreach (Storage stor in container)
        //        result.Set(new Storage(stor.getProduct(), stor.get() / v));
        //    return result;
        //}



        //internal Storage subtractOutside(Storage stor)
        //{
        //    Storage find = this.findStorage(stor.getProduct());
        //    if (find == null)
        //        return new Storage(stor);
        //    else
        //        return new Storage(stor.getProduct(), find.subtractOutside(stor).get());
        //}
        //internal void subtract(StorageSet set, bool showMessageAboutNegativeValue = true)
        //{
        //    base.subtract(set, showMessageAboutNegativeValue);
        //    throw new DontUseThatMethod();
        //}
        internal void copyDataFrom(StorageSet consumed)
        {
            base.copyDataFrom(consumed);
            throw new DontUseThatMethod();
        }
Esempio n. 12
0
 internal void sendAll(StorageSet toWhom)
 {
     used.add(this);
     base.sendAll(toWhom);
 }
Esempio n. 13
0
 public void sendAll(StorageSet whom)
 {
     this.send(whom, this);
 }
Esempio n. 14
0
 public Procent(StorageSet numerator, List <Storage> denominator, bool showMessageAboutOperationFails = true)
     : this(numerator.GetTotalQuantity(), denominator.Sum(), showMessageAboutOperationFails)
 {
 }
Esempio n. 15
0
 public Procent100(StorageSet numerator, List <Storage> denominator, bool showMessageAboutOperationFails = true) : base(numerator, denominator, showMessageAboutOperationFails)
 {
     clamp100();
 }
Esempio n. 16
0
 internal void sendAll(StorageSet toWhom)
 {
     toWhom.add(this);
     this.setZero();
 }
Esempio n. 17
0
 /// <summary>
 /// Do checks outside
 /// Supports takenAway
 /// </summary>
 public bool send(StorageSet whom, List <Storage> what)
 {
     used.add(what);
     return(base.send(whom, what));
 }
Esempio n. 18
0
 /// <summary>
 /// Do checks outside
 /// </summary>
 public bool send(StorageSet whom, StorageSet what)
 {
     return(send(whom, what.getContainer()));
 }