S
Sorin Gherman
Hi,
I have the following problem: I have this large amount of data, stored
internally in some custom data structures (hierarchical ones, given
the nature of the data - I am using some custom, tree-like structurs
for this).
I have to show the different relations within this data using several
JTrees - one per "viewpoint". (The good news is that I only have to
show one type of view at a time.)
The first implementation I came up with is just creating a tree model
(using DefaultMutableTreeNodes) for each view, and displaying it using
JTree.
Problem: memory consumption is very high (due to the duplication of
the tree structures in memory, and the fact that the user may toggle
between views fast, thus trees are created and thrown away - again,
memory is an issue so I cannot affort to store them).
I read about the possibility to have my own internal data implement
the TreeNode interface, and have the JTree uses the internal data
directly - thus avoiding the creation of extra trees.
Problem: the implementation gets very complicated very fast due to the
different views. I can still live with that, but then I realized that
due to TreeNode.getParent() method, I would still have to duplicate,
in memory, for each view, at least the "parent" references. (This is
due to the fact that most of the internal nodes in my data structures
have different parents in different views...). Which means it doesn't
save that much memory after all... (well, it still saves the child
references and the node duplication).
So I am wondering: is there any well-know "cure" for these type of
problems?
Thanks in advance,
Sorin Gherman
I have the following problem: I have this large amount of data, stored
internally in some custom data structures (hierarchical ones, given
the nature of the data - I am using some custom, tree-like structurs
for this).
I have to show the different relations within this data using several
JTrees - one per "viewpoint". (The good news is that I only have to
show one type of view at a time.)
The first implementation I came up with is just creating a tree model
(using DefaultMutableTreeNodes) for each view, and displaying it using
JTree.
Problem: memory consumption is very high (due to the duplication of
the tree structures in memory, and the fact that the user may toggle
between views fast, thus trees are created and thrown away - again,
memory is an issue so I cannot affort to store them).
I read about the possibility to have my own internal data implement
the TreeNode interface, and have the JTree uses the internal data
directly - thus avoiding the creation of extra trees.
Problem: the implementation gets very complicated very fast due to the
different views. I can still live with that, but then I realized that
due to TreeNode.getParent() method, I would still have to duplicate,
in memory, for each view, at least the "parent" references. (This is
due to the fact that most of the internal nodes in my data structures
have different parents in different views...). Which means it doesn't
save that much memory after all... (well, it still saves the child
references and the node duplication).
So I am wondering: is there any well-know "cure" for these type of
problems?
Thanks in advance,
Sorin Gherman