PDA

View Full Version : Reasoning behind removing Generic from Parent in Base Tree Model



zooxmusic1
24 Jun 2009, 9:17 AM
Can someone please explain the reasoning behind the change

Removed parent generic from TreeModel.

which reveals the fact that TreeModel's children is a list of ModelData instead of a list of itself (TreeModel). This breaks the composite pattern and makes is awkward at best for recursion.

I feel we should absolutely be able to do



public void someMethod(List<TreeModel> children) {
for(TreeModel child : children) {
//step down through tree
someMethod(child.getChildren());
}
}


but this is impossible now. Shouldn't a tree follow the composite pattern?

Have I been drinking too much lately and overlooking something obvious?

Thanks

zooxmusic1
30 Jun 2009, 8:59 AM
Does anyone have a comment, opinion etc.. on this?

Does the commercial version have this same architecture?

If I had a commercial version what would the process be for this particular issue?