예제 #1
0
 void ApplyOperation(string key, ILCOperation op)
 {
     if (op is LCDeleteOperation)
     {
         estimatedData.Remove(key);
     }
     else
     {
         if (estimatedData.TryGetValue(key, out object oldValue))
         {
             estimatedData[key] = op.Apply(oldValue, key);
         }
         else
         {
             estimatedData[key] = op.Apply(null, key);
         }
     }
     if (operationDict.TryGetValue(key, out ILCOperation previousOp))
     {
         operationDict[key] = op.MergeWithPrevious(previousOp);
     }
     else
     {
         operationDict[key] = op;
     }
     IsDirty = true;
 }
예제 #2
0
 public ILCOperation MergeWithPrevious(ILCOperation previousOp)
 {
     if (previousOp is LCIgnoreHookOperation ignoreHookOp)
     {
         ignoreHooks.UnionWith(ignoreHookOp.ignoreHooks);
         return(this);
     }
     throw new ArgumentException("Operation is invalid after previous operation.");
 }
예제 #3
0
 public ILCOperation MergeWithPrevious(ILCOperation previousOp)
 {
     if (previousOp is LCSetOperation || previousOp is LCDeleteOperation)
     {
         return(previousOp);
     }
     if (previousOp is LCRemoveOperation removeOp)
     {
         valueList.AddRange(removeOp.valueList);
     }
     throw new ArgumentException("Operation is invalid after previous operation.");
 }
예제 #4
0
 public ILCOperation MergeWithPrevious(ILCOperation previousOp)
 {
     if (previousOp is LCSetOperation || previousOp is LCDeleteOperation)
     {
         return(previousOp);
     }
     if (previousOp is LCAddUniqueOperation addUniqueOp)
     {
         values.UnionWith(addUniqueOp.values);
         return(this);
     }
     throw new ArgumentException("Operation is invalid after previous operation.");
 }
예제 #5
0
 public ILCOperation MergeWithPrevious(ILCOperation previousOp)
 {
     if (previousOp is LCSetOperation || previousOp is LCDeleteOperation)
     {
         return(previousOp);
     }
     if (previousOp is LCNumberOperation incrementOp)
     {
         object otherAmount = incrementOp.value;
         return(new LCNumberOperation(Add(otherAmount, value)));
     }
     return(this);
 }
예제 #6
0
 ILCOperation ILCOperation.MergeWithPrevious(ILCOperation previousOp)
 {
     if (previousOp is LCSetOperation || previousOp is LCDeleteOperation)
     {
         return(previousOp);
     }
     if (previousOp is LCAddOperation addOp)
     {
         List <object> list = new List <object>(addOp.valueList);
         list.AddRange(valueList);
         valueList = list;
         return(this);
     }
     if (previousOp is LCAddUniqueOperation addUniqueOp)
     {
         List <object> list = addUniqueOp.values.ToList();
         list.AddRange(valueList);
         valueList = list;
         return(this);
     }
     throw new ArgumentException("Operation is invalid after previous operation.");
 }
예제 #7
0
 public ILCOperation MergeWithPrevious(ILCOperation previousOp)
 {
     return(this);
 }
예제 #8
0
 static object EncodeOperation(ILCOperation operation)
 {
     return(operation.Encode());
 }