예제 #1
0
        public override void Assign(object value, IGraphProcessingEnvironment procEnv)
        {
            IGraphElement elem = (IGraphElement)DestVar.GetVariableValue(procEnv);
            AttributeType attrType;

            value = ContainerHelper.IfAttributeOfElementIsContainerThenCloneContainer(
                elem, AttributeName, value, out attrType);
            AttributeChangeType changeType = AttributeChangeType.Assign;

            if (elem is INode)
            {
                procEnv.Graph.ChangingNodeAttribute((INode)elem, attrType, changeType, value, null);
            }
            else
            {
                procEnv.Graph.ChangingEdgeAttribute((IEdge)elem, attrType, changeType, value, null);
            }
            elem.SetAttribute(AttributeName, value);
            if (elem is INode)
            {
                procEnv.Graph.ChangedNodeAttribute((INode)elem, attrType);
            }
            else
            {
                procEnv.Graph.ChangedEdgeAttribute((IEdge)elem, attrType);
            }
        }
예제 #2
0
        /////////////////////////////////////////////////////////////////////////////////

        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);
            }
        }
예제 #3
0
 public static object GetGraphElementAttributeOrElementOfMatch(object source, string attributeOrElementName)
 {
     if (source is IMatch)
     {
         IMatch match = (IMatch)source;
         object value = match.getNode(attributeOrElementName);
         if (value != null)
         {
             return(value);
         }
         value = match.getEdge(attributeOrElementName);
         if (value != null)
         {
             return(value);
         }
         value = match.getVariable(attributeOrElementName);
         return(value);
     }
     else
     {
         IGraphElement elem  = (IGraphElement)source;
         object        value = elem.GetAttribute(attributeOrElementName);
         value = ContainerHelper.IfAttributeOfElementIsContainerThenCloneContainer(
             elem, attributeOrElementName, value);
         return(value);
     }
 }
예제 #4
0
 public static object GetAttributeOrElementOfMatch(object source, string attributeOrElementName)
 {
     if (source is IMatch)
     {
         IMatch match = (IMatch)source;
         object value = match.getNode(attributeOrElementName);
         if (value != null)
         {
             return(value);
         }
         value = match.getEdge(attributeOrElementName);
         if (value != null)
         {
             return(value);
         }
         value = match.getVariable(attributeOrElementName);
         return(value);
     }
     else
     {
         IAttributeBearer attributeBearer = (IAttributeBearer)source;
         object           value           = attributeBearer.GetAttribute(attributeOrElementName);
         value = attributeBearer is ITransientObject ? value : ContainerHelper.IfAttributeOfElementIsContainerThenCloneContainer(
             attributeBearer, attributeOrElementName, value);
         return(value);
     }
 }
예제 #5
0
        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);
        }