gumbo.visualize.data
Class TestGraphModels

java.lang.Object
  |
  +--gumbo.visualize.data.TestGraphModels

public class TestGraphModels
extends java.lang.Object

Utilities for building test data models.

Author:
Jon Barrilleaux (jonb@jmbaai.com) of JMB and Associates Inc.

Field Summary
static int RANDOM_CHAR_COUNT_MAX
           
static int RANDOM_EDGE_COUNT_MAX
           
static javax.swing.Icon RANDOM_EDGE_ICON
           
static int RANDOM_LINE_COUNT_MAX
           
static int RANDOM_VERT_COUNT_MAX
           
static javax.swing.Icon RANDOM_VERT_ICON
           
 
Method Summary
static void addDefaultTreeModel(VertexModel root, java.lang.String prefix)
          Adds a default subtree graph to an existing graph.
static java.lang.Object buildData(java.lang.String text, javax.swing.Icon icon)
           
static java.lang.String buildText(java.lang.String name, int lineMax, int charMax)
           
static GraphModel newDefaultGraphModel(java.lang.Object clientId, java.lang.Object clientData)
          Default graph that includes a variety of topology.
static GraphModel newDefaultTreeModel(java.lang.Object clientId, java.lang.Object clientData, java.lang.String prefix)
          Creates a new default tree graph.
static GraphModel newEmptyGraphModel(java.lang.Object clientId, java.lang.Object clientData)
          Empty test graph.
static GraphModel newLinearGraphModel(java.lang.Object clientId, java.lang.Object clientData)
          Calls newLinearGraphModel() with a random number of entries up to (RANDOM_VERT_COUNT_MAX).
static GraphModel newLinearGraphModel(java.lang.Object clientId, java.lang.Object clientData, int vertexCount)
          Used to build a linear graph, with one root and one leaf, for serialization stress testing.
static GraphModel newRandomGraphModel(java.lang.Object clientId, java.lang.Object clientData)
          Calls newRandomGraphModel() with default parameters (RANDOM_???_COUNT_MAX, RANDOM_???_ICON).
static GraphModel newRandomGraphModel(java.lang.Object clientId, java.lang.Object clientData, int vertMax, int edgeMax, int lineMax, int charMax, javax.swing.Icon vertIcon, javax.swing.Icon edgeIcon)
          Builds and returns a new graph model with a random number of vertices (from 1 to vertMax) and edges (from 1 to edgeMax), connected randomly.
static AspectModel newRandomPathModel(java.lang.Object clientId, java.lang.Object clientData, GraphModel graph)
          Builds and returns a new aspect model of a random walk path in a graph.
static GraphModel newSemiRandomGraphModel(java.lang.Object clientId, java.lang.Object clientData, int vertexCount, int edgeCount)
          Used to build random graphs of a known size for performance and stress testing.
static void removeDefaultTreeModel(VertexModel root, java.lang.String prefix)
          Removes the default subtree graph from an existing graph based on the part model client IDs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RANDOM_VERT_COUNT_MAX

public static final int RANDOM_VERT_COUNT_MAX
See Also:
Constant Field Values

RANDOM_EDGE_COUNT_MAX

public static final int RANDOM_EDGE_COUNT_MAX
See Also:
Constant Field Values

RANDOM_LINE_COUNT_MAX

public static final int RANDOM_LINE_COUNT_MAX
See Also:
Constant Field Values

RANDOM_CHAR_COUNT_MAX

public static final int RANDOM_CHAR_COUNT_MAX
See Also:
Constant Field Values

RANDOM_VERT_ICON

public static final javax.swing.Icon RANDOM_VERT_ICON

RANDOM_EDGE_ICON

public static final javax.swing.Icon RANDOM_EDGE_ICON
Method Detail

newEmptyGraphModel

public static GraphModel newEmptyGraphModel(java.lang.Object clientId,
                                            java.lang.Object clientData)
Empty test graph.


newDefaultGraphModel

public static GraphModel newDefaultGraphModel(java.lang.Object clientId,
                                              java.lang.Object clientData)
Default graph that includes a variety of topology. Vertex and edge client IDs are strings of the form "v#" and "e#", where # is the unique vertex or edge number, starting with 0. Vertex and edge client data is the client ID as a string.


newSemiRandomGraphModel

public static GraphModel newSemiRandomGraphModel(java.lang.Object clientId,
                                                 java.lang.Object clientData,
                                                 int vertexCount,
                                                 int edgeCount)
Used to build random graphs of a known size for performance and stress testing. Builds and returns a new graph model with a specified number of vertices and edges, connected randomly. Vertex and edge client IDs are strings of the form "v#" and "e#", where # is the unique vertex or edge number, starting with 0. Note that successive graphs will likeley contain elements with the same client IDs, which facilitates aspect model testing. Vertex and edge client data is the client ID as a string.


newRandomGraphModel

public static GraphModel newRandomGraphModel(java.lang.Object clientId,
                                             java.lang.Object clientData)
Calls newRandomGraphModel() with default parameters (RANDOM_???_COUNT_MAX, RANDOM_???_ICON).


newRandomGraphModel

public static GraphModel newRandomGraphModel(java.lang.Object clientId,
                                             java.lang.Object clientData,
                                             int vertMax,
                                             int edgeMax,
                                             int lineMax,
                                             int charMax,
                                             javax.swing.Icon vertIcon,
                                             javax.swing.Icon edgeIcon)
Builds and returns a new graph model with a random number of vertices (from 1 to vertMax) and edges (from 1 to edgeMax), connected randomly. Vertices and edges will have labels with the client ID as the first line followed by a random number of lines (0 to lineMax-1), with each line having a random number of characters (1 to to charMax), and with corresponding icons (which may be null). Vertex and edge client IDs are strings of the form "v#" and "e#", where # is the unique vertex or edge number, starting with 0. Note that successive graphs will likely contain elements with the same client IDs, which facilitates aspect model testing. Vertex and edge client data is the client ID as a string.


buildText

public static java.lang.String buildText(java.lang.String name,
                                         int lineMax,
                                         int charMax)

buildData

public static java.lang.Object buildData(java.lang.String text,
                                         javax.swing.Icon icon)

newRandomPathModel

public static AspectModel newRandomPathModel(java.lang.Object clientId,
                                             java.lang.Object clientData,
                                             GraphModel graph)
Builds and returns a new aspect model of a random walk path in a graph. Since aspect models use client IDs, creating and presenting a new graph (such as with newRandomGraphModel()) containing elements with the same client IDs should maintain the aspect presentation, although it may no longer be a connected path in the new graph.


newLinearGraphModel

public static GraphModel newLinearGraphModel(java.lang.Object clientId,
                                             java.lang.Object clientData)
Calls newLinearGraphModel() with a random number of entries up to (RANDOM_VERT_COUNT_MAX).


newLinearGraphModel

public static GraphModel newLinearGraphModel(java.lang.Object clientId,
                                             java.lang.Object clientData,
                                             int vertexCount)
Used to build a linear graph, with one root and one leaf, for serialization stress testing. Builds and returns a new graph model with a specified number of vertices. Vertex and edge client IDs are strings of the form "v#" and "e#", where # is the unique vertex or edge number, starting with 0 at the root vertex and edge.


newDefaultTreeModel

public static GraphModel newDefaultTreeModel(java.lang.Object clientId,
                                             java.lang.Object clientData,
                                             java.lang.String prefix)
Creates a new default tree graph. See addDefaultTreeModel() for the client ID format. The root node is vertex "*v0", where * is the prefix.

Parameters:
clientId - Client ID for the whole model. Default ID if null.
clientData - Client data for the whole model. None if null.
prefix - Client ID prefix. None if null.

addDefaultTreeModel

public static void addDefaultTreeModel(VertexModel root,
                                       java.lang.String prefix)
Adds a default subtree graph to an existing graph. Vertex and edge client IDs are strings of the form "*v#" and "*e#", where * is a custom prefix and # is the unique vertex or edge number in the subtree, starting with 0 for edges and 1 for vertices. Part model client data is the same as the client ID.

Parameters:
root - The root node of the subtree. Never null.
prefix - Client ID prefix. None if null.

removeDefaultTreeModel

public static void removeDefaultTreeModel(VertexModel root,
                                          java.lang.String prefix)
Removes the default subtree graph from an existing graph based on the part model client IDs. See addDefaultTreeModel() for the client ID format.

Parameters:
root - The root node of the subtree. Never null.
prefix - Client ID prefix. None if null.