コード例 #1
0
 public void UnlinkFromAll(Linkable unlinked, int usrId)
 {
     foreach (var edge in unlinked.GetEdge().ToArray())
     {
         Unlink(unlinked, edge.next, usrId);
     }
 }
コード例 #2
0
ファイル: ClusterTopology.cs プロジェクト: gdlprj/duscusys
 public Edge(Linkable curr, Linkable next, int linkShapeId, bool forward)
 {
     this.curr = curr;
     this.next = next;
     this.linkShapeId = linkShapeId;
     this.forward = forward;
 }
コード例 #3
0
 public Edge(Linkable curr, Linkable next, int linkShapeId, bool forward)
 {
     this.curr        = curr;
     this.next        = next;
     this.linkShapeId = linkShapeId;
     this.forward     = forward;
 }
コード例 #4
0
ファイル: ClusterTopology.cs プロジェクト: gdlprj/duscusys
        public Edge RemoveEdge(Linkable next)
        {
            Edge toRemove = null;
            foreach (var e in _edges)
                if (e.next == next)
                    toRemove = e;

            _edges.Remove(toRemove);
            return toRemove;
        }
コード例 #5
0
        private void __linkRemove(Linkable end1, Linkable end2, int linkShapeId, int usrId)
        {
            UnlockDeleteBroadcast(linkShapeId, usrId);

            EventLogger.LogAndBroadcast(new DiscCtx(Discussions.ConfigManager.ConnStr),
                                        _room,
                                        StEvent.LinkRemoved,
                                        usrId,
                                        _topicId);

            _pendingChanges = true;
        }
コード例 #6
0
        public Edge RemoveEdge(Linkable next)
        {
            Edge toRemove = null;

            foreach (var e in _edges)
            {
                if (e.next == next)
                {
                    toRemove = e;
                }
            }

            _edges.Remove(toRemove);
            return(toRemove);
        }
コード例 #7
0
        private void __onLinkableDeleted(Linkable end, int usrId)
        {
            UnlockDeleteBroadcast(end.GetId(), usrId);

            //record event
            if (end is Cluster)
            {
                EventLogger.LogAndBroadcast(new DiscCtx(Discussions.ConfigManager.ConnStr),
                                            _room,
                                            StEvent.ClusterDeleted,
                                            -1, //owner unknown
                                            _topicId);
            }

            _pendingChanges = true;
        }
コード例 #8
0
        public void Link(Linkable end1, Linkable end2, int linkShapeId)
        {
            if (end1 == end2)
            {
                throw new NotSupportedException("no self loops");
            }

            if (end1.HasAdjacent(end2))
            {
                throw new NotSupportedException("no multiedges");
            }

            var fwd = new Edge(end1, end2, linkShapeId, true);

            _forwardEdges.Add(linkShapeId, fwd);
            end1.AddEdge(fwd);
            end2.AddEdge(new Edge(end2, end1, linkShapeId, false));
        }
コード例 #9
0
        public void Unlink(Linkable end1, Linkable end2, int usrId)
        {
            if (end1 == end2)
            {
                throw new NotSupportedException("no self loops");
            }

            if (!end1.HasAdjacent(end2))
            {
                throw new NotSupportedException("no link");
            }

            var edge1 = end1.RemoveEdge(end2);

            if (edge1.forward)
            {
                _forwardEdges.Remove(edge1.linkShapeId);
            }

            var edge2 = end2.RemoveEdge(end1);

            if (edge2.forward)
            {
                _forwardEdges.Remove(edge2.linkShapeId);
            }

            if (edge1.linkShapeId != edge2.linkShapeId)
            {
                throw new NotSupportedException("?");
            }

            if (onLinkRemove != null)
            {
                onLinkRemove(end1, end2, edge1.linkShapeId, usrId);
            }
        }
コード例 #10
0
ファイル: ClusterTopology.cs プロジェクト: gdlprj/duscusys
 public bool HasAdjacent(Linkable next)
 {
     return _edges.FirstOrDefault(edge => edge.next == next) != null;
 }
コード例 #11
0
ファイル: ClusterTopology.cs プロジェクト: gdlprj/duscusys
 public void UnlinkFromAll(Linkable unlinked, int usrId)
 {
     foreach (var edge in unlinked.GetEdge().ToArray())
         Unlink(unlinked, edge.next, usrId);
 }
コード例 #12
0
ファイル: ClusterTopology.cs プロジェクト: gdlprj/duscusys
        public void Unlink(Linkable end1, Linkable end2, int usrId)
        {
            if (end1 == end2)
                throw new NotSupportedException("no self loops");

            if (!end1.HasAdjacent(end2))
                throw new NotSupportedException("no link");

            var edge1 = end1.RemoveEdge(end2);
            if (edge1.forward)
                _forwardEdges.Remove(edge1.linkShapeId);

            var edge2 = end2.RemoveEdge(end1);
            if (edge2.forward)
                _forwardEdges.Remove(edge2.linkShapeId);

            if (edge1.linkShapeId != edge2.linkShapeId)
                throw new NotSupportedException("?");

            if (onLinkRemove != null)
                onLinkRemove(end1, end2, edge1.linkShapeId, usrId);
        }
コード例 #13
0
ファイル: ClusterTopology.cs プロジェクト: gdlprj/duscusys
        public void Link(Linkable end1, Linkable end2, int linkShapeId)
        {
            if (end1 == end2)
                throw new NotSupportedException("no self loops");

            if (end1.HasAdjacent(end2))
                throw new NotSupportedException("no multiedges");

            var fwd = new Edge(end1, end2, linkShapeId, true);
            _forwardEdges.Add(linkShapeId, fwd);
            end1.AddEdge(fwd);
            end2.AddEdge(new Edge(end2, end1, linkShapeId, false));
        }
コード例 #14
0
 public bool HasAdjacent(Linkable next)
 {
     return(_edges.FirstOrDefault(edge => edge.next == next) != null);
 }
コード例 #15
0
ファイル: VectProcessor.cs プロジェクト: gdlprj/duscusys
        private void __onLinkableDeleted(Linkable end, int usrId)
        {
            UnlockDeleteBroadcast(end.GetId(), usrId);

            //record event
            if (end is Cluster)
            {
                EventLogger.LogAndBroadcast(new DiscCtx(Discussions.ConfigManager.ConnStr),
                                            _room,
                                            StEvent.ClusterDeleted,
                                            -1, //owner unknown 
                                            _topicId);
            }

            _pendingChanges = true;
        }
コード例 #16
0
ファイル: VectProcessor.cs プロジェクト: gdlprj/duscusys
        private void __linkRemove(Linkable end1, Linkable end2, int linkShapeId, int usrId)
        {
            UnlockDeleteBroadcast(linkShapeId, usrId);

            EventLogger.LogAndBroadcast(new DiscCtx(Discussions.ConfigManager.ConnStr),
                                        _room,
                                        StEvent.LinkRemoved,
                                        usrId,
                                        _topicId);

            _pendingChanges = true;
        }