Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Request Make TreeBot treat null children properly

Joined
Dec 10, 2014
Messages
3,255
I'm the opposite, I wouldn't mind the idea but I'm definitely leaning in favour of restriction. In my opinion if you're going to have a branch with a null sub-node, that branch should be replaced by a leaf.
I think I get what you're saying, but there are cases where you can't replace that branch with a leaf easily and elegantly
 
Client Developer
Joined
Oct 12, 2015
Messages
3,760
I think I get what you're saying, but there are cases where you can't replace that branch with a leaf easily and elegantly

Can you think of one? Rather than the condition being returned in validate() it would just be an if statement within execute().
 
Java Warlord
Joined
Nov 17, 2014
Messages
4,906
I'm the opposite, I wouldn't mind the idea but I'm definitely leaning in favour of restriction. In my opinion if you're going to have a branch with a null sub-node, that branch should be replaced by a leaf.
Thats like saying if you have a leaf in a tree (by definition a node without children), this leaf needs two leafs as children. It doesnt make sense to me
 
Can you think of one? Rather than the condition being returned in validate() it would just be an if statement within execute().
Gl with that if the subtree is fairly complex
 
Client Developer
Joined
Oct 12, 2015
Messages
3,760
Thats like saying if you have a leaf in a tree (by definition a node without children), this leaf needs two leafs as children. It doesnt make sense to me
 

Gl with that if the subtree is fairly complex

That's not what it's like saying at all.
 
I mean don't get me wrong I'm not against the idea, I just haven't come across a use case.
 
Client Developer
Joined
Oct 12, 2015
Messages
3,760
Yes it is, you are saying that null children should be replaced with leafs. Well leafs are defined by having no/null children.

No, I'm saying if you have a branch with one child, the branch and child should be consolidated into a leaf node.
 
Top