I need a source code that implements the simple tree approach but each node can adjust for more than 2 childs.Is it possilbe or yet another option available.
Plz provide the module or source code.
I need a source code that implements the simple tree approach but each node can adjust for more than 2 childs.Is it possilbe or yet another option available.
Plz provide the module or source code.
You mean the programming concept of a tree instead of a graphical tree? Check the class TreeList from apache or write your own tree.
If you want to write your own tree, think about what the concept of a tree is. You can have a class Node which is a container class for some data (Strings, Integers, other Objects...) plus it has a Collection (Vector, Array, List, ...) of children (also nodes). It must have a "addChild" method and a "getChild" method, maybe a "search" method or similar,... Depends on what you want.
Try writing it and if you need help, ask here! :-)
Hope that helps.
I need a source code that implements the simple tree approach but each node can adjust for more than 2 childs.Is it possilbe or yet another option available.
Plz provide the module or source code.
Nope, we're not going to give you any source code (you want the code so why
should we build it?). An extremely simple implementation for a general tree node
could be this:
[code=java]
public class Node {
private Node child; // ref to first child
private Node sibling; // ref to next sibling
private Node parent; // ref to parent;
}
[/code]
All childs of a node can be reached first through the leftmost child reference
and next through the sibling list of that child. The parent reference is optional
but very handy to have.
Comment