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);
        }
Beispiel #2
0
        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;
                }
            }
        }