88template<
class VALUETYPE>
98template<
class VALUETYPE>
100 parent(const_cast<
Node*>(&p)),
103 #if NEBULA_BOUNDSCHECKS
111template<
class VALUETYPE>
114 for (
IndexT i = 0; i < this->children.Size(); i++)
123template<
class VALUETYPE>
127 return *(this->children[i]);
133template<
class VALUETYPE>
137 return *(this->children[i]);
143template<
class VALUETYPE>
147 return *(this->children[i]);
153template<
class VALUETYPE>
157 return *(this->children[i]);
163template<
class VALUETYPE>
167 return (0 != this->parent);
173template<
class VALUETYPE>
177 #if NEBULA_BOUNDSCHECKS
180 return *this->parent;
186template<
class VALUETYPE>
190 #if NEBULA_BOUNDSCHECKS
193 return *this->parent;
199template<
class VALUETYPE>
203 this->children.Clear();
209template<
class VALUETYPE>
213 return this->children.Size();
219template<
class VALUETYPE>
223 return this->children.IsEmpty();
229template<
class VALUETYPE>
233 return *(this->children.Front());
239template<
class VALUETYPE>
243 return *(this->children.Back());
249template<
class VALUETYPE>
255 newNode->
value = val;
256 this->children.Append(newNode);
262template<
class VALUETYPE>
266 delete this->children[i];
267 this->children.EraseIndex(i);
273template<
class VALUETYPE>
283template<
class VALUETYPE>
293template<
class VALUETYPE>
298 SizeT num = this->children.Size();
299 for (i = 0; i < num; i++)
301 if (val == this->children[i]->Value())
312template<
class VALUETYPE>
321template<
class VALUETYPE>
331template<
class VALUETYPE>
Nebula's dynamic array class.
Definition array.h:60
public node class
Definition simpletree.h:23
SizeT Size() const
number of children
Definition simpletree.h:211
const Node & operator[](IndexT i) const
get read-only child by index
Definition simpletree.h:125
Node * parent
Definition simpletree.h:69
void Insert(IndexT index, const VALUETYPE &val)
insert element before element at index
Node & Parent()
read/write access to parent
Definition simpletree.h:188
~Node()
destructor
Definition simpletree.h:112
void Append(const VALUETYPE &val)
add element at back of array
Definition simpletree.h:251
IndexT Find(const VALUETYPE &val) const
find identical element (slow);
Definition simpletree.h:295
VALUETYPE value
Definition simpletree.h:70
Node()
default constructor
Definition simpletree.h:89
void Clear()
clear children
Definition simpletree.h:201
void Erase(IndexT i)
erase at index
Definition simpletree.h:264
bool IsEmpty() const
return true if empty
Definition simpletree.h:221
bool HasParent() const
return true if the node has a parent
Definition simpletree.h:165
Node & Front() const
return first element
Definition simpletree.h:231
Node & Back() const
return last element
Definition simpletree.h:241
Array< Node * > children
Definition simpletree.h:71
VALUETYPE & Value()
read/write access to value
Definition simpletree.h:285
const Node & Child(IndexT i) const
get read-only child element at index
Definition simpletree.h:145
A simple tree class which stores its nodes in Util::Arrays.
Definition simpletree.h:19
Node rootNode
Definition simpletree.h:82
const Node & Root() const
read-only access to root element
Definition simpletree.h:333
SimpleTree()
default constructor
Definition simpletree.h:313
Node & Root()
read/write access to root element
Definition simpletree.h:323
#define n_assert(exp)
Definition debug.h:50
A pinned array is an array which manages its own virtual memory.
Definition String.cs:6
static const int InvalidIndex
Definition types.h:54
int SizeT
Definition types.h:49
int IndexT
Definition types.h:48