Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Analysis/Connection.Analysis.cs @ 2768

Last change on this file since 2768 was 2768, checked in by mkommend, 14 years ago

added solution folders and sources for the netron library (ticket #867)

File size: 1.7 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Text;
4using Netron.Diagramming.Core.Analysis;
5namespace Netron.Diagramming.Core
6{
7    public partial class Connection : IEdge
8    {
9        #region Fields
10        private bool mIsDirected = false;
11
12        #endregion
13
14
15        bool IEdge.IsDirected
16        {
17            get { return mIsDirected; }
18            set { mIsDirected = value; }
19        }
20
21        INode IEdge.SourceNode
22        {
23            get {
24                if (From.AttachedTo == null)
25                    return null;
26                else
27                    return From.AttachedTo.Parent as INode;
28            }
29        }
30
31        INode IEdge.TargetNode
32        {
33            get {
34                if (To.AttachedTo == null)
35                    return null;
36                else
37                    return To.AttachedTo.Parent as INode;
38            }
39        }
40
41        INode IEdge.AdjacentNode(INode node)
42        {
43            if (From.AttachedTo != null && (node as IShape) == From.AttachedTo.Parent)
44            {
45                if (To.AttachedTo == null)
46                    return null;
47                else
48                    return To.AttachedTo.Parent as INode;
49            }
50            else if (To.AttachedTo.Parent != null && (node as IShape) == To.AttachedTo.Parent)
51            {
52                if (From.AttachedTo == null)
53                    return null;
54                else
55                    return From.AttachedTo.Parent as INode;
56            }
57            else
58                throw new InconsistencyException("The given node is not part of the edge.");
59
60        }
61    }
62}
Note: See TracBrowser for help on using the repository browser.