1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/External/Aga.Controls/Tree/TreePath.cs Sun May 27 15:16:19 2012 +0000
1.3 @@ -0,0 +1,68 @@
1.4 +using System;
1.5 +using System.Text;
1.6 +using System.Collections.ObjectModel;
1.7 +
1.8 +namespace Aga.Controls.Tree
1.9 +{
1.10 + public class TreePath
1.11 + {
1.12 + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
1.13 + public static readonly TreePath Empty = new TreePath();
1.14 +
1.15 + private object[] _path;
1.16 + public object[] FullPath
1.17 + {
1.18 + get { return _path; }
1.19 + }
1.20 +
1.21 + public object LastNode
1.22 + {
1.23 + get
1.24 + {
1.25 + if (_path.Length > 0)
1.26 + return _path[_path.Length - 1];
1.27 + else
1.28 + return null;
1.29 + }
1.30 + }
1.31 +
1.32 + public object FirstNode
1.33 + {
1.34 + get
1.35 + {
1.36 + if (_path.Length > 0)
1.37 + return _path[0];
1.38 + else
1.39 + return null;
1.40 + }
1.41 + }
1.42 +
1.43 + public TreePath()
1.44 + {
1.45 + _path = new object[0];
1.46 + }
1.47 +
1.48 + public TreePath(object node)
1.49 + {
1.50 + _path = new object[] { node };
1.51 + }
1.52 +
1.53 + public TreePath(object[] path)
1.54 + {
1.55 + _path = path;
1.56 + }
1.57 +
1.58 + public TreePath(TreePath parent, object node)
1.59 + {
1.60 + _path = new object[parent.FullPath.Length + 1];
1.61 + for (int i = 0; i < _path.Length - 1; i++)
1.62 + _path[i] = parent.FullPath[i];
1.63 + _path[_path.Length - 1] = node;
1.64 + }
1.65 +
1.66 + public bool IsEmpty()
1.67 + {
1.68 + return (_path.Length == 0);
1.69 + }
1.70 + }
1.71 +}