Esempio n. 1
0
        public bool Contains(PositiveResourceLedger other)
        {
            foreach (var(type, amount) in other.Contents)
            {
                if (!Contents.ContainsKey(type) || Contents[type] < amount)
                {
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 2
0
 public override bool Remove(PositiveResourceLedger other)
 {
     if (base.Remove(other))
     {
         TodaysTransactions.Add(new Transaction(other) * -1);
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 3
0
 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);
         }
     }
 }
Esempio n. 4
0
 public virtual bool Remove(PositiveResourceLedger other)
 {
     if (!Contains(other))
     {
         return(false);
     }
     else
     {
         foreach (var(resource, amount) in other.Contents)
         {
             Contents[resource] -= amount;
         }
         return(true);
     }
 }
Esempio n. 5
0
 public override void Add(PositiveResourceLedger other)
 {
     base.Add(other);
     TodaysTransactions.Add(new Transaction(other));
 }