예제 #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);
        }
예제 #2
0
 public override bool Remove(PositiveResourceLedger other)
 {
     if (base.Remove(other))
     {
         TodaysTransactions.Add(new Transaction(other) * -1);
         return(true);
     }
     else
     {
         return(false);
     }
 }
예제 #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);
         }
     }
 }
예제 #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);
     }
 }
예제 #5
0
 public override void Add(PositiveResourceLedger other)
 {
     base.Add(other);
     TodaysTransactions.Add(new Transaction(other));
 }