Exemplo n.º 1
0
 public void insertEdge(uint from, uint to, Types.EdgeKind edge)
 {
     if (selectorFunc != null)
     {
         if (!selectorFunc(fact.getRef(from)))
         {
             return;
         }
     }
     insertEdge(fact.getRef(from), fact.getRef(to), edge);
 }
Exemplo n.º 2
0
        public void removeEdge(uint from, uint to, Types.EdgeKind edge)
        {
            if (reContainer.Count < from + 1)
            {
                return;
            }
            if (reContainer[(int)from] == null)
            {
                return;
            }
            LinkedList <uint> itFind = null;

            if (!reContainer[(int)from].TryGetValue(edge, out itFind))
            {
                return;
            }
            itFind.Remove(find(itFind.First, itFind.Last, to));
        }
Exemplo n.º 3
0
        public void insertEdge(Columbus.Lim.Asg.Nodes.Base.Base from, Columbus.Lim.Asg.Nodes.Base.Base to, Types.EdgeKind edge)
        {
            try {
                if (selectorFunc != null)
                {
                    if (!selectorFunc(from))
                    {
                        return;
                    }
                }

                insertNode(from.Id);
            }
            catch (LimException) {
                StackTrace st = new StackTrace(new StackFrame(true));
                StackFrame sf = st.GetFrame(0);
                throw new LimException(sf.GetFileName() + " : " + sf.GetFileLineNumber(), "Invalid NodeId (" + fact.getRef(from.Id) + ")");
            }

            LinkedList <uint> it = null;

            if (reContainer[(int)from.Id].TryGetValue(edge, out it))
            {
                it.AddLast(to.Id);
            }
            else
            {
                LinkedList <uint> nodeList = new LinkedList <uint>();
                nodeList.AddLast(to.Id);
                reContainer[(int)from.Id].Add(edge, nodeList);
            }
        }
Exemplo n.º 4
0
        public ListIterator <Columbus.Lim.Asg.Nodes.Base.Base> constIteratorEnd(uint id, Types.EdgeKind edge)
        {
            if (reContainer.Count <= id || reContainer[(int)id] == null)
            {
                StackTrace st = new StackTrace(new StackFrame(true));
                StackFrame sf = st.GetFrame(0);
                throw new LimException(sf.GetFileName() + " : " + sf.GetFileLineNumber(), "Invalid NodeId(" + fact.getRef(id) + ")");
            }
            LinkedList <uint> it = null;

            if (reContainer[(int)id].TryGetValue(edge, out it))
            {
                return(new ListIterator <Columbus.Lim.Asg.Nodes.Base.Base>(it, fact, false));
            }
            else
            {
                Columbus.Lim.Asg.Nodes.Base.Base node = fact.getRef(id);
                if (PossibleEdges[(int)node.NodeKind, (int)edge])
                {
                    // creating an empty container and returning with it
                    LinkedList <uint> nodeList = new LinkedList <uint>();
                    reContainer[(int)id].Add(edge, nodeList);
                    return(new ListIterator <Columbus.Lim.Asg.Nodes.Base.Base>(nodeList, fact, false));
                }
                else
                {
                    StackTrace st = new StackTrace(new StackFrame(true));
                    StackFrame sf = st.GetFrame(0);
                    throw new LimException(sf.GetFileName() + " : " + sf.GetFileLineNumber(), "Invalid edge kind");
                }
            }
        }