Beispiel #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);
     }
 }
Beispiel #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);
     }
 }
 /// <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);
     }
 }
Beispiel #4
0
 internal void copyDataFrom(StorageSet consumed)
 {
     foreach (Storage stor in consumed)
     {
         //if (stor.get() > 0f)
         this.set(stor);
     }
     // SetZero();
 }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
 }
Beispiel #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);
        }
Beispiel #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();
        }
Beispiel #12
0
 internal void sendAll(StorageSet toWhom)
 {
     used.add(this);
     base.sendAll(toWhom);
 }
 public void sendAll(StorageSet whom)
 {
     this.send(whom, this);
 }
Beispiel #14
0
 public Procent(StorageSet numerator, List <Storage> denominator, bool showMessageAboutOperationFails = true)
     : this(numerator.GetTotalQuantity(), denominator.Sum(), showMessageAboutOperationFails)
 {
 }
Beispiel #15
0
 public Procent100(StorageSet numerator, List <Storage> denominator, bool showMessageAboutOperationFails = true) : base(numerator, denominator, showMessageAboutOperationFails)
 {
     clamp100();
 }
Beispiel #16
0
 internal void sendAll(StorageSet toWhom)
 {
     toWhom.add(this);
     this.setZero();
 }
Beispiel #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));
 }
Beispiel #18
0
 /// <summary>
 /// Do checks outside
 /// </summary>
 public bool send(StorageSet whom, StorageSet what)
 {
     return(send(whom, what.getContainer()));
 }