Presentation View Configuration

Note that the presentation view and configuration dialog are under development. Many features will be added and problems will be worked out in the near future.

The presentation view configuration allows the user to specify or change the mapping between a class and a presentation viewer. When a class is viewed using the presentation viewer for the first time, the class is analyzed to determine potential mappings between the class and a linked list or binary tree view. Each of these is ranked with a confidence level. If at least one candidate is found, the viewer will use the mapping with the highest confidence level initially. These mappings only consider linked objects where class fields form the links. For other types of links (stored in an array, stored in a map, etc.) the user will have to configure the mapping.


 
 

Structure Page

This page allows the structure type and class-to-view mapping to be edited.

Structure - allows the user to choose one of the structure mappings that were found by the automatic structure identification system. Structures are listed in order of confidence. This may be empty if no mappings were found. Choosing one of the mappings will select a structure type, link mapping expressions, and other settings for the mapping. Those expressions and settings can then be modified if necessary.

Structure Type - manually selects the structure type.

Link Expressions - these expressions specify the way that links are followed when elaborating the structure.

For linked lists, the variable _list_ can be used in these expression to refer to the list itself, and for binary trees, _tree_ can be used to refer to the tree. Note that for local variable node display, these values will be null (except that the root node or head node expression will not be used for local variables). If the mapping is such that the list or tree reference itself is necessary to follow links, it should be obtained from the node reference if possible. Otherwise, the null case for _list_ or _tree_ should be handled by specifying expressions that evaluate to null in this situation.

The root node or head node expression specifies the first node in the tree or list. This should be left blank in cases where "the node is the structure". Unless this is a simple field reference (or blank), local variable nodes will not be displayed. In the future, a "Node Class" entry will be added to rectify this problem. If there is no actual node class (consider a linked list or binary tree encoded in an int array), a "simulated node" may be returned. This will be provided as the "node" in the other expressions. See the int array example in this section for an application of this method.

For other expressions, the variable _node_ refers to the current node. The expressions specify how to reach neighboring nodes from a node, and what value to display in a node.

Non-expression settings for the mapping may also be present.


 
 

Fields Display Page

This page allows the selection of fields to display in the viewer. These will display the "toString()" value of the field, or an arrow to the value if the value is a node and appears in one of the displayed structures.


 
 

Linked List Example

Consider a singly linked list class, where "head" points to the first node, and in a node, "next" points to the next node while "value" holds the value of interest. The first node holds a real value and the "next" link for the last node is null.

Head Node Expression: _list_.head

Next Node Expression: _node_.next

Previous Node Expression: <left blank>

Value Expression: _node_.value

Last Node Links to First, First Node Links to Last, First Node is Dummy: all checked off


 
 

Int Array Binary Tree Example

Consider an int array used to hold a binary tree. Sets of three ints specify a node. The first is the index of the left child, the seconds is the index of the right child, and the third holds the value. A -1 index is used to represent null links. So new int[] { 3, 6, 0, -1, -1, 1, 9, -1, -1 } would be a tree containing three nodes, with "0" at the root, "1" as the left child, and "9" as the right child. In this case, there is no node class, so we will use an Integer as a stand-in node class, to hold the node index. The root expression just returns an Integer with value 0, or null if the array is empty. The left and right expressions return the Integer index of the left or right link, where _node_ is an Integer holding the index of the current link, or null if the index of the left or right link is -1.

Root Node Expression: (_tree_.length > 0)?Integer.valueOf(0):null

Left Node Expression: (_tree_[_node_.intValue()] >= 0)?Integer.valueOf(_tree_[_node_.intValue()]):null

Right Node Expression: (_tree_[_node_.intValue() + 1] >= 0)?Integer.valueOf(_tree_[_node_.intValue() + 1]):null

Value Expression: _tree_[_node_.intValue() + 2]

Note that we used "Integer.valueOf()" instead of "new Integer()". Because "Integer.valueOf()" caches results, there is a good chance that most or all of the animation will be displayed. The viewer animation relies on nodes being the same object (equal by ==). For "new Integer()", this would never be the case. Obviously a node ".equals()" comparison would make more sense here. This may be added as an option in the future. In any case, this will not affect the correct display of the structure, just whether or not all "moved" nodes will be shown in the process of moving.