View Single Post
  #2 (permalink)  
Old 08-02-2007, 03:50 PM
shanePreater shanePreater is offline
Member
 
Join Date: Jul 2007
Location: England, Bath
Posts: 47
shanePreater is on a distinguished road
You could implement this using a simple class structure:
Code:
public class Person { private List<Person> parents; private List<Person> children; ... public void addParent(Person parent) { this.getParents().add(parent); parent.getChildren().add(this); } public void addChild(Person child) { this.getChildren().add(child); child.getParents().add(this); } }
Obviously you will need to implement the getters and setters for the lists but that will allow you to construct your family tree. Also you may wish to limit the parent list to 2 entries or change this for :
Code:
private Person mother; private Person father;
instead.

Hope this gets you started.
__________________
Shane Preater -
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Reply With Quote