public void DoUndo(IGraphProcessingEnvironment procEnv) { String attrName = _attrType.Name; LGSPGraphProcessingEnvironment procEnv_ = (LGSPGraphProcessingEnvironment)procEnv; if (_undoOperation == UndoOperation.PutElement) { if (_attrType.Kind == AttributeKind.SetAttr) { ChangingElementAttribute(procEnv_); IDictionary dict = (IDictionary)_elem.GetAttribute(_attrType.Name); dict.Add(_value, null); } else if (_attrType.Kind == AttributeKind.MapAttr) { ChangingElementAttribute(procEnv_); IDictionary dict = (IDictionary)_elem.GetAttribute(_attrType.Name); dict.Add(_keyOfValue, _value); } else if (_attrType.Kind == AttributeKind.ArrayAttr) { ChangingElementAttribute(procEnv_); IList array = (IList)_elem.GetAttribute(_attrType.Name); if (_keyOfValue == null) { array.Add(_value); } else { array.Insert((int)_keyOfValue, _value); } } else //if(_attrType.Kind == AttributeKind.DequeAttr) { ChangingElementAttribute(procEnv_); IDeque deque = (IDeque)_elem.GetAttribute(_attrType.Name); if (_keyOfValue == null) { deque.EnqueueFront(_value); } else { deque.EnqueueAt((int)_keyOfValue, _value); } } } else if (_undoOperation == UndoOperation.RemoveElement) { if (_attrType.Kind == AttributeKind.SetAttr) { ChangingElementAttribute(procEnv_); IDictionary dict = (IDictionary)_elem.GetAttribute(_attrType.Name); dict.Remove(_value); } else if (_attrType.Kind == AttributeKind.MapAttr) { ChangingElementAttribute(procEnv_); IDictionary dict = (IDictionary)_elem.GetAttribute(_attrType.Name); dict.Remove(_keyOfValue); } else if (_attrType.Kind == AttributeKind.ArrayAttr) { ChangingElementAttribute(procEnv_); IList array = (IList)_elem.GetAttribute(_attrType.Name); if (_keyOfValue == null) { array.RemoveAt(array.Count - 1); } else { array.RemoveAt((int)_keyOfValue); } } else //if(_attrType.Kind == AttributeKind.DequeAttr) { ChangingElementAttribute(procEnv_); IDeque deque = (IDeque)_elem.GetAttribute(_attrType.Name); if (_keyOfValue == null) { deque.DequeueBack(); } else { deque.DequeueAt((int)_keyOfValue); } } } else if (_undoOperation == UndoOperation.AssignElement) { if (_attrType.Kind == AttributeKind.ArrayAttr) { ChangingElementAttribute(procEnv_); IList array = (IList)_elem.GetAttribute(_attrType.Name); array[(int)_keyOfValue] = _value; } else if (_attrType.Kind == AttributeKind.DequeAttr) { ChangingElementAttribute(procEnv_); IDeque deque = (IDeque)_elem.GetAttribute(_attrType.Name); deque[(int)_keyOfValue] = _value; } else //if(_attrType.Kind == AttributeKind.MapAttr) { ChangingElementAttribute(procEnv_); IDictionary dict = (IDictionary)_elem.GetAttribute(_attrType.Name); dict[_keyOfValue] = _value; } } else if (_undoOperation == UndoOperation.Assign) { ChangingElementAttribute(procEnv_); _elem.SetAttribute(attrName, _value); } // otherwise UndoOperation.None }