public bool Contains(PositiveResourceLedger other) { foreach (var(type, amount) in other.Contents) { if (!Contents.ContainsKey(type) || Contents[type] < amount) { return(false); } } return(true); }
public override bool Remove(PositiveResourceLedger other) { if (base.Remove(other)) { TodaysTransactions.Add(new Transaction(other) * -1); return(true); } else { return(false); } }
public virtual void Add(PositiveResourceLedger other) { foreach (var(resource, amount) in other.Contents) { if (Contents.ContainsKey(resource)) { Contents[resource] += amount; } else { Contents.Add(resource, amount); } } }
public virtual bool Remove(PositiveResourceLedger other) { if (!Contains(other)) { return(false); } else { foreach (var(resource, amount) in other.Contents) { Contents[resource] -= amount; } return(true); } }
public override void Add(PositiveResourceLedger other) { base.Add(other); TodaysTransactions.Add(new Transaction(other)); }