Exemplo n.º 1
0
 public bool Leq(VcStamp aOther)
 {
     HashSet<string> keys = new HashSet<string>(iContents.Keys);
     keys.UnionWith(aOther.iContents.Keys);
     foreach (string key in keys)
     {
         long valueThis, valueOther;
         // If TryGetValue fails, it sets the output value to default(long),
         // i.e. 0, which is what we want.
         iContents.TryGetValue(key, out valueThis);
         aOther.iContents.TryGetValue(key, out valueOther);
         if (valueThis > valueOther)
             return false;
     }
     return true;
 }
Exemplo n.º 2
0
 static void UpdateDictionary(VcStamp aOther, Dictionary<string, long> aContents)
 {
     foreach (var kvp in aOther.iContents)
     {
         long valueThis;
         if (aContents.TryGetValue(kvp.Key, out valueThis))
         {
             aContents[kvp.Key] = Math.Max(kvp.Value, valueThis);
         }
         else
         {
             aContents[kvp.Key] = kvp.Value;
         }
     }
 }
Exemplo n.º 3
0
 public void UpdateInPlace(VcStamp aOther)
 {
     UpdateDictionary(aOther, iContents);
 }
Exemplo n.º 4
0
 public VcStamp Update(VcStamp aOther)
 {
     var newStamp = Clone();
     newStamp.UpdateInPlace(aOther);
     return newStamp;
 }