Free cookie consent management tool by TermsFeed Policy Generator

source: stable/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Analysis/Connection.Analysis.cs

Last change on this file was 4068, checked in by swagner, 14 years ago

Sorted usings and removed unused usings in entire solution (#1094)

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