moel@345: using System; moel@345: using System.Text; moel@345: using System.Collections.ObjectModel; moel@345: moel@345: namespace Aga.Controls.Tree moel@345: { moel@345: public class TreePath moel@345: { moel@345: [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] moel@345: public static readonly TreePath Empty = new TreePath(); moel@345: moel@345: private object[] _path; moel@345: public object[] FullPath moel@345: { moel@345: get { return _path; } moel@345: } moel@345: moel@345: public object LastNode moel@345: { moel@345: get moel@345: { moel@345: if (_path.Length > 0) moel@345: return _path[_path.Length - 1]; moel@345: else moel@345: return null; moel@345: } moel@345: } moel@345: moel@345: public object FirstNode moel@345: { moel@345: get moel@345: { moel@345: if (_path.Length > 0) moel@345: return _path[0]; moel@345: else moel@345: return null; moel@345: } moel@345: } moel@345: moel@345: public TreePath() moel@345: { moel@345: _path = new object[0]; moel@345: } moel@345: moel@345: public TreePath(object node) moel@345: { moel@345: _path = new object[] { node }; moel@345: } moel@345: moel@345: public TreePath(object[] path) moel@345: { moel@345: _path = path; moel@345: } moel@345: moel@345: public TreePath(TreePath parent, object node) moel@345: { moel@345: _path = new object[parent.FullPath.Length + 1]; moel@345: for (int i = 0; i < _path.Length - 1; i++) moel@345: _path[i] = parent.FullPath[i]; moel@345: _path[_path.Length - 1] = node; moel@345: } moel@345: moel@345: public bool IsEmpty() moel@345: { moel@345: return (_path.Length == 0); moel@345: } moel@345: } moel@345: }