So i have a file which I am reading in, its in the format components can have arbitrary number of child both components and leafs.
comp1 : data
comp1 childs : comp2, comp3, comp4
comp2 : Data
comp2 childs : leaf 1, comp5
leaf 1 :data
comp5 : data
comp5 childs: leaf2:
Leaf2 : data
comp3 :data
comp4 :data
what is the best easiest way to add childs to parent nodes? My brain is fried and cannot reason this. please help, Im using a composite pattern, comp(osite) implements component, and leaf implements component. my comp class has an Arraylist to hold its children.
Aucun commentaire:
Enregistrer un commentaire