/// <summary> /// Does not take abstract products /// </summary> public void subtract(StorageSet set, bool showMessageAboutNegativeValue = true) { foreach (Storage stor in set) { this.subtract(stor, showMessageAboutNegativeValue); } }
/// <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); } }
internal void copyDataFrom(StorageSet consumed) { foreach (Storage stor in consumed) { //if (stor.get() > 0f) this.set(stor); } // SetZero(); }
/// <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); }
/// <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); }
public StorageSet getCopy() { StorageSet res = new StorageSet(); foreach (Storage stor in this) { res.container.Add(new Storage(stor.getProduct(), stor.get())); } return(res); }
/// <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); }
/// <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); }
//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); }
//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(); }
internal void sendAll(StorageSet toWhom) { used.add(this); base.sendAll(toWhom); }
public void sendAll(StorageSet whom) { this.send(whom, this); }
public Procent(StorageSet numerator, List <Storage> denominator, bool showMessageAboutOperationFails = true) : this(numerator.GetTotalQuantity(), denominator.Sum(), showMessageAboutOperationFails) { }
public Procent100(StorageSet numerator, List <Storage> denominator, bool showMessageAboutOperationFails = true) : base(numerator, denominator, showMessageAboutOperationFails) { clamp100(); }
internal void sendAll(StorageSet toWhom) { toWhom.add(this); this.setZero(); }
/// <summary> /// Do checks outside /// Supports takenAway /// </summary> public bool send(StorageSet whom, List <Storage> what) { used.add(what); return(base.send(whom, what)); }
/// <summary> /// Do checks outside /// </summary> public bool send(StorageSet whom, StorageSet what) { return(send(whom, what.getContainer())); }