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; }
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."); }
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."); }
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."); }
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); }
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."); }
public ILCOperation MergeWithPrevious(ILCOperation previousOp) { return(this); }
static object EncodeOperation(ILCOperation operation) { return(operation.Encode()); }