IVariableDef IDecisionTree.ChangeVariable(IVariableDef previousVar) { IVariableDef result = null; switch (previousVar.VariableType) { case eVariableType.character: result = IDecisionTreeInterface.CreateNewNode(typeof(CharVariableImpl).ToString()) as IVariableDef; break; case eVariableType.numeric: result = IDecisionTreeInterface.CreateNewNode(typeof(NumericVariableImpl).ToString()) as IVariableDef; break; case eVariableType.enumeration: result = IDecisionTreeInterface.CreateNewNode(typeof(EnumVariableImpl).ToString()) as IVariableDef; break; case eVariableType.date: result = IDecisionTreeInterface.CreateNewNode(typeof(DateVariableImpl).ToString()) as IVariableDef; break; case eVariableType.boolean: result = IDecisionTreeInterface.CreateNewNode(typeof(BoolVariableImpl).ToString()) as IVariableDef; break; } if (result != null) { result.Name = previousVar.Name; int index = previousVar.Parent.Nodes.IndexOf(previousVar); previousVar.Parent.Nodes.Remove(previousVar); previousVar.Parent.Nodes.Insert(index, result); result.Parent = previousVar.Parent; (result as IBaseNode).Tree = this; OnUpdated(); } return(result); }