Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Creating a tree in java

Name: Anonymous 2012-08-02 13:35

I need to create a web application Tree structure
The rules are:
- every leaf will be used to hold a number
- every root needs also to show the sum of the leafs and nodes before it
- infinity extendible
- its must Work with a GUI (so u need to see the root, leafs etc.)
- be able to change a leaf/node (CRUD)
- be able to copy/paste/move a leaf/node (optional)
- save it
- test cases (not sure what that means)
- it should be a .war

framework etc doesn't matter, i need it to get a apprenticeship i didn't code for like 1/2-1 year and never used java. I don´t really need the solution more some key words what i will need like "dynamic list" (does java even has this?) or a good GUI builder and what i need to be concerned about also data or database.

Name: Anonymous 2012-08-02 15:48

you can make a tree in a similar manner like this/with a framework like this:

public class Tree<E extends Tree<E>>{
E value;
Tree[] children;
Tree parent;
public Tree(E val){
value = val;
}

//code
public Tree getChildren(){
//code
}
public Tree getParent(){
//code
}
public Tree listAllChildren(){
//enumerate children
}
public void addTree(){//adds a tree to the current tree
//code
}
public void deleteTree(){//removes tree from current tree
//code
}
//copy and pasting can be done with adding and then deleting
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List