Class amaze.browser.BrowserTree
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class amaze.browser.BrowserTree

java.lang.Object
   |
   +----amaze.browser.BrowserTree

class BrowserTree
extends Object
A BrowserRow object displays a subtree of a graph defined by some relation in an Algernon KB. In order to support this display the BrowserRow needs to maintain the structure of the tree itself even for those parts not currently displayed. Since methods to build, change and inspect such a tree are totally independent of any particular display scheme, the BrowserTree class encapsulates this functionality to keep it separate from any contamination by the UI. BrowserTree accesses the information it needs from Algernon through a KBManager object that it is configured with a the time of its construction or through a call to setKBManager().

Now, you might be wondering just what information from Algernon a BrowserTree really represents. Well, accessing and building the entire tree defined by some relation in an Algernon KB just is practical, and in some cases impossible (when the relation contains cycles). So what BrowserTree actually represents is a selected prefix of what I would call an "augmented branch". For instance, if the relation you are interested in is "friend" and you start at the frame "bob", then what BrowserTree actually represents would be something like:

 -----------------------------------------
|        JANE                    / JOE    |
|       /                       / /       |
|      /        BOB   SUE----BOB--        |
|     /  JOE   /     /          \---MARY  |
|    /  /     /     /            \        |
| BOB --     /     /              \       |
|    \---MARY---JOE---MARY         \      |
|     \      \                      AL    |
|      \      \                           |
|       \      \                          |
|        AL     SUE                       |
|                                         |
|  0     1       2     3       4     5    |
|             level numbers               |
 -----------------------------------------
What happens is this: The user of BrowserTree selects "friend" as the default slot and BOB as the root in level 0. BrowserTree automatically fills in and makes available the next "level", ie. the frames to which BOB stands in the friend relation. (Note that the way I'm using the term "level" isn't exactly correct because we aren't actually representing a full level, just a complete set of siblings on a level.) Then, MARY is designated as the selected element on level 1 so BrowserTree automatically fills in level 2, and so on. If the user of BrowserTree later designates JOE as the selected element on level 1, then levels 2 on up disappear and children of JOE are filled in as level 2.

There is one small complication to this representation that merits mentioning. Since slots/relations in Algernon aren't restricted to the binary case, we need to deal with the possibility of having multiple values in a single node in the tree. This is why the interface to BrowserTree has functions like setSelectedElem(level_no, node_ndx, elem_ndx) rather than setSelectedNode(level_no, node_ndx).

See Also:
AlgyBrowser, BrowserRow, KBManager

This class is not public and can therefore cannot be used outside this package.


All Packages  Class Hierarchy  This Package  Previous  Next  Index