edu.washington.cs.supple.trace
Class GraphTransitionCount

java.lang.Object
  extended byedu.washington.cs.supple.trace.GraphTransitionCount
All Implemented Interfaces:
TransitionCount

public class GraphTransitionCount
extends java.lang.Object
implements TransitionCount

Author:
kgajos A graph implementation of transition count -- this class can take a rendering, a set of shortcuts and a trace and output statistics indicating how much usage any of the UI elements receive

Field Summary
protected  float[][] a
           
protected  float[] effortMeasure
           
protected  int[] enterCount
           
protected  int[] leaveCount
           
protected  java.util.Hashtable nameToObject
           
protected  java.util.Collection navShortcuts
           
protected  java.util.ArrayList nodes
           
protected  java.util.Hashtable nodesToIndices
           
protected  java.util.Collection primitiveShortcuts
           
protected  WidgetBag root
           
protected  float shortcutEffortEstimate
           
protected  java.util.ArrayList staticNodes
           
protected  int[] switchCount
           
protected  java.util.Hashtable targetNodesToNavShortcuts
           
protected  java.util.Hashtable targetNodesToPrimitiveShortcuts
           
protected  Trace trace
           
protected  java.util.Hashtable uiObjectsToWidgetBags
           
 
Constructor Summary
GraphTransitionCount(WidgetBag root, java.util.Collection primitiveShortcuts, java.util.Collection navShortcuts, Trace trace)
          Initialized the graph structure with the interface description, a set of shortcuts and a trace
 
Method Summary
 java.lang.String dumpTransitionTable()
           
protected  void fillAdjacencyMatrix(java.util.Collection shortcuts)
          Fills the adjacency matrix with the info gleaned from the shortcut information; at the moment it assumes nav shortcuts
protected  void fillAdjacencyMatrix(WidgetBag root)
          Fills adjacency matrix with the information extracted from a widget bag structure
protected  java.util.Vector getBestPath(java.lang.String sourceName, java.lang.String targetName)
          A convenience method -- takes element names as inputs instead of the elements themselves
protected  java.util.Vector getBestPath(UiObject source, UiObject target)
          Finds the best path from the source to the target; for now it assumes that all shortcuts are visible at all times; will get seriously confused if there is no path between the two...
protected  float getEdgeCost(int fromIndex, int toIndex)
           
 float getEffortEstimate(UiObject object)
          Returns the effort estimate for a leaf node
 int getEnterCount(Shortcut shortcut)
          Returns the enter count for a shortcut
 int getEnterCount(java.lang.String objectName)
           
 int getEnterCount(UiObject object)
           
 UiObject getLeafWithHighestEffortEstimate()
          Returns non-shortcut leaf with the highest effort estimate
 int getLeaveCount(java.lang.String objectName)
           
 int getLeaveCount(UiObject object)
           
protected  int getNodeIndex(java.lang.Object node)
          Returns the index for a given node object
protected  UiObject getObjectForName(java.lang.String name)
           
protected  float getPathCost(java.util.Vector path)
          Returns the cost of following a particular, fully specified, legal path
protected  java.util.Vector getPathThroughNavShortcut(UiObject source, UiObject target)
          Finds a path that goes through a shortcut closest to the target
protected  java.util.Vector getPathToPrimitiveShortcut(UiObject source, UiObject target)
          returns a path to a primitive shortcut for target
 int getSwitchCount(java.lang.String objectName)
           
 int getSwitchCount(UiObject object)
           
 int getTotalEffortEstimate()
           
protected  WidgetBag getWidgetBagForUiObject(UiObject object)
           
protected  void init()
          Initializes the graph data structures
protected  void resetCounts()
           
protected  void updateAdjacencyMatrix(int fromIndex, int toIndex, float value)
           
 void updateGraph()
          Updates the weights in the graph in response to the changes in the widget bag structure; assumes that the shortcuts have not changed
 void updateNavShortcuts(java.util.Collection shortcuts)
          Allows you to set a new list of shortcuts; the entire data structure will be rebuilt in response
 void updatePrimitiveShortcuts(java.util.Collection shortcuts)
          Allows you to set a new list of shortcuts; the entire data structure will be rebuilt in response
 void updateTransitionCounts()
          Goes over the trace and computes new transition counts given the current state of the graph
protected  void updateTransitionCounts(java.util.Vector path)
          Uses information from a single path to increase transition counts of appropriate nodes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

root

protected WidgetBag root

navShortcuts

protected java.util.Collection navShortcuts

primitiveShortcuts

protected java.util.Collection primitiveShortcuts

trace

protected Trace trace

nodes

protected java.util.ArrayList nodes

staticNodes

protected java.util.ArrayList staticNodes

nodesToIndices

protected java.util.Hashtable nodesToIndices

targetNodesToNavShortcuts

protected java.util.Hashtable targetNodesToNavShortcuts

targetNodesToPrimitiveShortcuts

protected java.util.Hashtable targetNodesToPrimitiveShortcuts

uiObjectsToWidgetBags

protected java.util.Hashtable uiObjectsToWidgetBags

nameToObject

protected java.util.Hashtable nameToObject

a

protected float[][] a

switchCount

protected int[] switchCount

enterCount

protected int[] enterCount

leaveCount

protected int[] leaveCount

effortMeasure

protected float[] effortMeasure

shortcutEffortEstimate

protected float shortcutEffortEstimate
Constructor Detail

GraphTransitionCount

public GraphTransitionCount(WidgetBag root,
                            java.util.Collection primitiveShortcuts,
                            java.util.Collection navShortcuts,
                            Trace trace)
Initialized the graph structure with the interface description, a set of shortcuts and a trace

Parameters:
root - interface description passed through the WidgetBag structure
trace - a trace to be used for calculating transition counts
Method Detail

init

protected void init()
Initializes the graph data structures


resetCounts

protected void resetCounts()

fillAdjacencyMatrix

protected void fillAdjacencyMatrix(WidgetBag root)
Fills adjacency matrix with the information extracted from a widget bag structure

Parameters:
root - the root of the widget bag sub tree

fillAdjacencyMatrix

protected void fillAdjacencyMatrix(java.util.Collection shortcuts)
Fills the adjacency matrix with the info gleaned from the shortcut information; at the moment it assumes nav shortcuts

Parameters:
shortcuts - a collection of shortcuts

updateAdjacencyMatrix

protected void updateAdjacencyMatrix(int fromIndex,
                                     int toIndex,
                                     float value)

updatePrimitiveShortcuts

public void updatePrimitiveShortcuts(java.util.Collection shortcuts)
Allows you to set a new list of shortcuts; the entire data structure will be rebuilt in response

Parameters:
shortcuts - a list of shortcuts

updateNavShortcuts

public void updateNavShortcuts(java.util.Collection shortcuts)
Allows you to set a new list of shortcuts; the entire data structure will be rebuilt in response

Parameters:
shortcuts - a list of shortcuts

updateGraph

public void updateGraph()
Updates the weights in the graph in response to the changes in the widget bag structure; assumes that the shortcuts have not changed


updateTransitionCounts

public void updateTransitionCounts()
Goes over the trace and computes new transition counts given the current state of the graph


updateTransitionCounts

protected void updateTransitionCounts(java.util.Vector path)
Uses information from a single path to increase transition counts of appropriate nodes

Parameters:
path - a path

getEdgeCost

protected float getEdgeCost(int fromIndex,
                            int toIndex)

getBestPath

protected java.util.Vector getBestPath(UiObject source,
                                       UiObject target)
Finds the best path from the source to the target; for now it assumes that all shortcuts are visible at all times; will get seriously confused if there is no path between the two...

Parameters:
source - source ui element
target - target ui element
Returns:
the best path

getBestPath

protected java.util.Vector getBestPath(java.lang.String sourceName,
                                       java.lang.String targetName)
A convenience method -- takes element names as inputs instead of the elements themselves

Parameters:
sourceName - name of the source element
targetName - name of the target element
Returns:
the best path

getPathToPrimitiveShortcut

protected java.util.Vector getPathToPrimitiveShortcut(UiObject source,
                                                      UiObject target)
returns a path to a primitive shortcut for target

Parameters:
source - source
target - target functionality
Returns:
a path to a shortcut to the target functionality or null if no ptimitive shortcut for target exists

getPathThroughNavShortcut

protected java.util.Vector getPathThroughNavShortcut(UiObject source,
                                                     UiObject target)
Finds a path that goes through a shortcut closest to the target

Parameters:
source - source node
target - target node
Returns:
the path or null if there exists no shortcut landing anywhere on the branch leading to the target

getPathCost

protected float getPathCost(java.util.Vector path)
Returns the cost of following a particular, fully specified, legal path

Parameters:
path - a path specified as a vector of ui objects and shortcuts (including start and end nodes)
Returns:
the cost (int terms of effort estimates) of following this path

getNodeIndex

protected int getNodeIndex(java.lang.Object node)
Returns the index for a given node object

Parameters:
node - node object
Returns:
the index or -1 if the node object is not known

getWidgetBagForUiObject

protected WidgetBag getWidgetBagForUiObject(UiObject object)

getObjectForName

protected UiObject getObjectForName(java.lang.String name)

getSwitchCount

public int getSwitchCount(java.lang.String objectName)
Specified by:
getSwitchCount in interface TransitionCount

getSwitchCount

public int getSwitchCount(UiObject object)
Specified by:
getSwitchCount in interface TransitionCount

getEnterCount

public int getEnterCount(java.lang.String objectName)
Specified by:
getEnterCount in interface TransitionCount

getEnterCount

public int getEnterCount(UiObject object)
Specified by:
getEnterCount in interface TransitionCount

getEnterCount

public int getEnterCount(Shortcut shortcut)
Returns the enter count for a shortcut

Parameters:
shortcut - the shortcut to be checked
Returns:
the enter count

getLeaveCount

public int getLeaveCount(java.lang.String objectName)
Specified by:
getLeaveCount in interface TransitionCount

getLeaveCount

public int getLeaveCount(UiObject object)
Specified by:
getLeaveCount in interface TransitionCount

getEffortEstimate

public float getEffortEstimate(UiObject object)
Returns the effort estimate for a leaf node

Parameters:
object - the leaf node
Returns:
effort estimate (number of times used times the effort required to reach the element each time)

getTotalEffortEstimate

public int getTotalEffortEstimate()

getLeafWithHighestEffortEstimate

public UiObject getLeafWithHighestEffortEstimate()
Returns non-shortcut leaf with the highest effort estimate

Returns:
non-shortcut leaf with the highest effort estimate

dumpTransitionTable

public java.lang.String dumpTransitionTable()
Specified by:
dumpTransitionTable in interface TransitionCount