public override void Assign(object value, IGraphProcessingEnvironment procEnv) { IGraphElement elem = (IGraphElement)DestVar.GetVariableValue(procEnv); object container = elem.GetAttribute(AttributeName); object key = KeyExpression.Evaluate(procEnv); AttributeType attrType = elem.Type.GetAttributeType(AttributeName); BaseGraph.ChangingAttributeAssignElement(procEnv.Graph, elem, attrType, value, key); if(container is IList) { IList array = (IList)container; array[(int)key] = value; } else if(container is IDeque) { IDeque deque = (IDeque)container; deque[(int)key] = value; } else { IDictionary map = (IDictionary)container; map[key] = value; } BaseGraph.ChangedAttribute(procEnv.Graph, elem, attrType); }
///////////////////////////////////////////////////////////////////////////////// public static void AssignAttribute(object target, object value, string attributeName, IGraph graph) { if (target is IGraphElement) { IGraphElement elem = (IGraphElement)target; AttributeType attrType; value = ContainerHelper.IfAttributeOfElementIsContainerThenCloneContainer( elem, attributeName, value, out attrType); BaseGraph.ChangingAttributeAssign(graph, elem, attrType, value); elem.SetAttribute(attributeName, value); BaseGraph.ChangedAttribute(graph, elem, attrType); } else if (target is IObject) { IObject elem = (IObject)target; AttributeType attrType = elem.Type.GetAttributeType(attributeName); BaseGraph.ChangingAttributeAssign(graph, elem, attrType, value); elem.SetAttribute(attributeName, value); } else //if(target is ITransientObject) { ITransientObject elem = (ITransientObject)target; elem.SetAttribute(attributeName, value); } }
public override void Assign(object value, IGraphProcessingEnvironment procEnv) { IGraphElement elem = (IGraphElement)DestVar.GetVariableValue(procEnv); AttributeType attrType; value = ContainerHelper.IfAttributeOfElementIsContainerThenCloneContainer( elem, AttributeName, value, out attrType); BaseGraph.ChangingAttributeAssign(procEnv.Graph, elem, attrType, value); elem.SetAttribute(AttributeName, value); BaseGraph.ChangedAttribute(procEnv.Graph, elem, attrType); }
public static void AssignAttributeIndexed(object target, object key, object value, string attributeName, IGraph graph) { if (target is IGraphElement) { IGraphElement elem = (IGraphElement)target; object container = elem.GetAttribute(attributeName); AttributeType attrType = elem.Type.GetAttributeType(attributeName); BaseGraph.ChangingAttributeAssignElement(graph, elem, attrType, value, key); if (container is IList) { IList array = (IList)container; array[(int)key] = value; } else if (container is IDeque) { IDeque deque = (IDeque)container; deque[(int)key] = value; } else { IDictionary map = (IDictionary)container; map[key] = value; } BaseGraph.ChangedAttribute(graph, elem, attrType); } else if (target is IObject) { IObject elem = (IObject)target; object container = elem.GetAttribute(attributeName); AttributeType attrType = elem.Type.GetAttributeType(attributeName); if (container is IList) { IList array = (IList)container; array[(int)key] = value; } else if (container is IDeque) { IDeque deque = (IDeque)container; deque[(int)key] = value; } else { IDictionary map = (IDictionary)container; map[key] = value; } } else { ITransientObject elem = (ITransientObject)target; object container = elem.GetAttribute(attributeName); AttributeType attrType = elem.Type.GetAttributeType(attributeName); if (container is IList) { IList array = (IList)container; array[(int)key] = value; } else if (container is IDeque) { IDeque deque = (IDeque)container; deque[(int)key] = value; } else { IDictionary map = (IDictionary)container; map[key] = value; } } }