3 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
5 // Permission is hereby granted, free of charge, to any person obtaining
6 // a copy of this software and associated documentation files (the
7 // "Software"), to deal in the Software without restriction, including
8 // without limitation the rights to use, copy, modify, merge, publish,
9 // distribute, sublicense, and/or sell copies of the Software, and to
10 // permit persons to whom the Software is furnished to do so, subject to
11 // the following conditions:
13 // The above copyright notice and this permission notice shall be
14 // included in all copies or substantial portions of the Software.
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 /// Summary description for Node.
33 protected int _iBalance
; // currently, -2 means 'deleted'
34 internal Node _nNext
; // node of next index (nNext==null || nNext.iId=iId+1)
35 protected Node _nLeft
;
36 protected Node _nRight
;
37 protected Node _nParent
;
39 protected DataRow _row
;
41 public Node(DataRow row
)
46 internal int GetBalance()
49 throw new Exception ("Node is deleted.");
54 internal void Delete()
74 throw new Exception ("Node is deleted.");
81 throw new Exception ("Node is deleted.");
91 throw new Exception ("Node is deleted.");
97 throw new Exception ("Node is deleted.");
108 throw new Exception ("Node is deleted.");
115 throw new Exception ("Node is deleted.");
120 internal bool IsRoot()
122 return _nParent
== null;
126 internal void SetBalance(int b
)
130 throw new Exception ("Node is deleted.");
143 throw new Exception ("Node is deleted.");
144 Node parent
= Parent
;
146 return Equals(parent
.Left
);
149 internal Object
[] GetData()
153 throw new Exception ("Node is deleted.");
154 return _row
.ItemArray
;
157 internal bool Equals(Node n
)
161 throw new Exception ("Node is deleted.");