Hello,

I have some questions about the archetype definition. Currently, I am using the 
java parser to get an archetype object and from that object I get the archetype 
definition, which is a CComplexObject. I then pass this object to a recursive 
function of mine to get hold of some node id's, reference model type names, 
reference model attribute names and so on. In the function I first get the 
attributes of the complex object, then I get the children of each attribute and 
finally I also get some of the children's actual values in the case they aren't 
complex objects that have to be passed to the function again.

Sadly, I haven't found another way to get the children's actual values, than 
doing a lot of type casting, i.e. to get the value of an object of the type 
DvBoolean I first have to check if the child is a CPrimitiveObject to get the 
CPrimitive and then I have to check if the CPrimitive is a CBoolean to get the 
DvBoolean and finally I can get the actual value of the boolean. I think this 
is rather tedious, and I would be glad if anyone knows an easier way to do this.

In the recursive function I've just described I also try to build a tree 
structure of the java type DefaultMutableTreeNode in order to to display the 
archetype definition in a swing object called JTree. I have almost got it 
right, but I have problems with the levels of the nodes because I cannot simply 
do recursion over the CComplexObject that represents the definition since I 
have to get its attributes and the attributes' children (e.g. to see if the 
children are another CComplexObject), and thus this gets complicated and the 
assembled final tree is somewhat messed up. I would be glad if anybody had any 
ideas or advice about this problem and I hope my questions aren't too stupid.

Regards,

Mattias Forss (MSc student)

Medical Informatics group at the Department of Biomedical Engineering
Link?pings universitet, Sweden
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.openehr.org/mailman/private/openehr-technical_lists.openehr.org/attachments/20050928/48a98e02/attachment.html>

Reply via email to