org.caida.otter
Class ColumnSet

java.lang.Object
  |
  +--org.caida.otter.ColumnSet

public class ColumnSet
extends java.lang.Object

Encapsulates a DisplayObjects object, it keeps track of elements in terms of columns as well. Columns may be treated as a single unit when managing the location of nodes on the display.


Constructor Summary
ColumnSet(int columnWidth, int rowHeight)
          Create an empty ColumnSet.
ColumnSet(int columnWidth, int rowHeight, DisplayObjects displayData)
          Initialize a new ColumnSet object with a pre-made DisplayObjects object.
 
Method Summary
 void addDisplayObjects(DisplayObjects displayData)
          Add data to the column object and its encapsulted DisplayObjects object by specifying a DisplayObjects object.
 void addLabel(Label label)
          Add a label to the encapsulated DisplayObjects object, and include the label in it's appropriate column.
 void addLine(Line line)
          Add a line to the encapsulated DisplayObjects object, but no column specific stuff is done.
 void addNode(Node node)
          Add a node to the encapsulated DisplayObjects object, and include the node in it's appropriate column and row.
 void debug()
           
 void debugColSize()
           
 void disperseNotFoundColumn(java.util.Vector disperseColList)
          Disperse an entire column into the rest of the graph.
 int findDistanceBetweenColumns(Column col1, Column col2)
          helper method to find distance between columns.
 DisplayObjects getDisplayObjects()
          Return the encapsulated DisplayObjects object.
 void insertHiddenNodes()
          Insert hidden nodes into all columns that have overlapping vertical links on nodes.
 void orderColumnsByBoundingBoxes()
          Order columns trying to minimize the number of overlapping links.
 void setXandYvalues()
          Set our respective coordinates X and Y values with default values for the row and column, starting a 0.
 void setXandYvalues(int columnStart)
          Set our respective coordinates X and Y values with default values for the row and column, starting at the specified offset.
 void setXandYvalues(int columnStart, int columnSpacing, int rowSpacing)
          Set our respective coordinates X and Y values based on their row and column.
 void spaceColumnsByNodeCount(int minNodeSpacing)
          Space columns by node count with default column width
 void spaceColumnsByNodeCount(int minNodeSpacing, int minColSpacing)
          Update X coords of nodes such that each column receives space on account of how many nodes are contained on one level.
 void spaceColumnsEvenly()
          Space each column in the DisplayObjects evenly using the default column spacing.
 void spaceColumnsEvenly(int colSpacing)
          Space each column in the DisplayObjects evenly.
 void spaceColumnsEvenly(int min_x, int max_x)
          Space each column in the DisplayObjects evenly.
 void spaceNodesByParentMean(int minNodeSpacing, int maxChildSearchDepth)
          Space out overlapping nodes by looking at their parent and sorting nodes by the mean of the parent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColumnSet

public ColumnSet(int columnWidth,
                 int rowHeight)
Create an empty ColumnSet.

ColumnSet

public ColumnSet(int columnWidth,
                 int rowHeight,
                 DisplayObjects displayData)
Initialize a new ColumnSet object with a pre-made DisplayObjects object. Values are copied out of the argument, such that the encapsulated data has its own copy.
Parameters:
columnWidth - The space between columns.
rowHeight - The space between rows.
displayData - The DisplayObjects object to sort into rows and columns.
Method Detail

spaceNodesByParentMean

public void spaceNodesByParentMean(int minNodeSpacing,
                                   int maxChildSearchDepth)
Space out overlapping nodes by looking at their parent and sorting nodes by the mean of the parent.
Parameters:
minNodeSpacing - The minimum space between nodes when spreading a row.

orderColumnsByBoundingBoxes

public void orderColumnsByBoundingBoxes()
Order columns trying to minimize the number of overlapping links. This is the second try at optimizing the link crossing. Before any link crossing a column was considered a problem. Now scoring will only count links that overlap with a bounding box of the column Links may now cross a column with no penalty provided they do not enter one of the bounding boxes that specifies a colunmn

findDistanceBetweenColumns

public int findDistanceBetweenColumns(Column col1,
                                      Column col2)
helper method to find distance between columns.
Parameters:
col1 - The first column to compare.
col2 - The second column used in the comparison.
Returns:
The distance between the two specified columns.

spaceColumnsEvenly

public void spaceColumnsEvenly(int min_x,
                               int max_x)
Space each column in the DisplayObjects evenly.
Parameters:
min_x - The starting X value used.
max_x - The ending X value used.

spaceColumnsEvenly

public void spaceColumnsEvenly(int colSpacing)
Space each column in the DisplayObjects evenly.
Parameters:
colSpacing - The space to put between neighboring columns.

spaceColumnsEvenly

public void spaceColumnsEvenly()
Space each column in the DisplayObjects evenly using the default column spacing.

spaceColumnsByNodeCount

public void spaceColumnsByNodeCount(int minNodeSpacing)
Space columns by node count with default column width
Parameters:
minNodeSpacing - The minimum space between nodes when they are spread along a row. This is needed to estimate the width of each column, and then its new width considering its size in nodes.

spaceColumnsByNodeCount

public void spaceColumnsByNodeCount(int minNodeSpacing,
                                    int minColSpacing)
Update X coords of nodes such that each column receives space on account of how many nodes are contained on one level. The X coords will be distributed among the same range as before, but the location of nodes within that range will change. Columns are also spead out to accomidate the new width of the column - especially if the new column is a lot fatter.
Parameters:
minNodeSpacing - The minimum space between nodes when they are spread along a row. This is needed to estimate the width of each column, and then its new width considering its size in nodes.
minColSpacing - The minimum column Spacing regardless of node count.

addNode

public void addNode(Node node)
Add a node to the encapsulated DisplayObjects object, and include the node in it's appropriate column and row.
Parameters:
node - The new node.

disperseNotFoundColumn

public void disperseNotFoundColumn(java.util.Vector disperseColList)
Disperse an entire column into the rest of the graph. Here nodes are found in a "not found" column are sorted into the column that they have the most links into. This makes the resulting picture better, as well as being a best guess where the node really belongs.

addLine

public void addLine(Line line)
Add a line to the encapsulated DisplayObjects object, but no column specific stuff is done. The ColumnSet behavior is pretty transparent here. The real work is still done by the DisplayObject.
Parameters:
line - Line to add to DisplayObjects and the column / row object

addLabel

public void addLabel(Label label)
Add a label to the encapsulated DisplayObjects object, and include the label in it's appropriate column.
Parameters:
label - The new label

getDisplayObjects

public DisplayObjects getDisplayObjects()
Return the encapsulated DisplayObjects object. Useful when we're finally ready to draw and we want to see what we have. The object returned is not a copy, its the real thing.

setXandYvalues

public void setXandYvalues(int columnStart,
                           int columnSpacing,
                           int rowSpacing)
Set our respective coordinates X and Y values based on their row and column.
Parameters:
columnStart - The offset for the first column.
coumnSpacing - The spacing between columns.
rowSpacing - The spacing between rows.

setXandYvalues

public void setXandYvalues(int columnStart)
Set our respective coordinates X and Y values with default values for the row and column, starting at the specified offset.
Parameters:
columnStart - The offset of the first column.

setXandYvalues

public void setXandYvalues()
Set our respective coordinates X and Y values with default values for the row and column, starting a 0.

addDisplayObjects

public void addDisplayObjects(DisplayObjects displayData)
Add data to the column object and its encapsulted DisplayObjects object by specifying a DisplayObjects object. Values are actually copied out of the argument and into the encapsulated data object.
Parameters:
displayData - The DisplayObjects object to process

insertHiddenNodes

public void insertHiddenNodes()
Insert hidden nodes into all columns that have overlapping vertical links on nodes.

debug

public void debug()

debugColSize

public void debugColSize()