Skip to main content
4 of 4
added 590 characters in body

Design pattern for access to tree-like database in Java?

I'm developing a Roleplaying character viewer/manager programme for a locap LARP system. The Characters have access to skills that are layed out in a tree-like structure. There are a lot of skills, and potentially a lot per character.

I know I can just import the Java swing library to get access to a tree, but I feel like this may bog me down, when all that needs to be done is access to a tree-like database, and the character needs only know that they have access to a subset of the skills.

I'm not sure if the tree design pattern is the best choice for this (i.e. instantiate a tree for the skills known per character, and add to/delete parts as needed) or 'do the clever stuff' and use a list per character to see which parts (skills) of database (external tree) are 'owned'.

My skills are broken down roughly as so:
Course catogory -> Weapon Type -> Actual Weapon -> Proficiency-->Special Skill, which goes quite deep. Further to this there is little need to know what is at each level, just that it's children, until you hit the leaf, and the one up.

My database effectively already exists on the LARP website, so if I don't have to reproduce it, that would be good. Here is a sample

Weapons and Shields     Warrior Priest Scout Mage 
1H Weapon Proficiency     3        6     6     9 
1H Weapon Specialisation  6        12    12    18 
1H Weapon Expertise       12       24    24    36 
1H Weapon Mastery         24       48    48    72 

And later on:

Magic           Warrior       Priest        Scout         Mage 
Learn Spell     9 x (l + 1)   9 x (l + 1)   6 x (l + 1)   3 x (l + 1) 
l = spell level,  
...
Create Talisman 9 + l         9 + l         6 + l         3 + l 
l = level,