net.sourceforge.olduvai.accordiondrawer
Class StaticSplitLine

java.lang.Object
  extended by net.sourceforge.olduvai.accordiondrawer.SplitLine
      extended by net.sourceforge.olduvai.accordiondrawer.StaticSplitLine
All Implemented Interfaces:
java.lang.Comparable

public class StaticSplitLine
extends SplitLine


Field Summary
private  int splitLineIndex
          Position of split line in array.
 
Fields inherited from class net.sourceforge.olduvai.accordiondrawer.SplitLine
absoluteValue, color, computedFrame, cullingObject, getSplitLine, relativeValue, rowObject, splitLineFound, subTreeSize
 
Constructor Summary
StaticSplitLine(double value, SplitLine parent, SplitLine opAncestor, boolean isVirtual)
          Create a static split line, with the constructor of SplitLine.
 
Method Summary
 int compareTo(java.lang.Object o)
          Natural order comparator that uses indices to determine which object (this or the input) precedes the other, or if they are the same.
 void computeSplitLineIndex(int rightAdd)
          Recursively descend and assign split line index values to all split lines.
 StaticSplitLine[] getBounds(SplitAxis axis)
          Get the bounds of this split line in the given axis, which are the parent and offparent.
 StaticSplitLine getOffParentBound()
          Get the off-parent object, as a StaticSplitLine.
static StaticSplitLine getOverlapStaticSplitCell(java.util.TreeSet searchTree, StaticSplitLine input, SplitAxis axis)
          Returns a SplitLine whose absoluteValue is either equal to the input SplitLine's absoluteValue, or is the closest SplitLine less than the input SplitLine's absoluteValue.
 int getSplitIndex()
          Get the split line index for this line.
 StaticSplitLine getStaticParent()
          Get the parent object, as a StaticSplitLine.
 void setSplitIndex(int splitLineIndex)
          Set the split line index for this line.
 java.lang.String toString()
          debug output function, print the split line index for this line.
 
Methods inherited from class net.sourceforge.olduvai.accordiondrawer.SplitLine
equals, getCachedValue, getCullingObject, getLeftChild, getOpBound, getOverlapSplitCell, getParent, getRightChild, getRowObject, getSubTreeSize, getValue, isLeftChild, isRoot, setCullingObject, setLeftChild, setOpBound, setParent, setRightChild, setRowObject, setSubTreeSize, toLongString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

splitLineIndex

private int splitLineIndex
Position of split line in array. Ssed in TJ with static tree layouts. A cached value of this may be possible in dynamic cases, if a method of detecting changes is added to the split axis class to flush the cache.

Constructor Detail

StaticSplitLine

public StaticSplitLine(double value,
                       SplitLine parent,
                       SplitLine opAncestor,
                       boolean isVirtual)
Create a static split line, with the constructor of SplitLine.

Parameters:
isVirtual - true for virtual split lines, created for rendering but not added to the split axis hierarchy.
value - initial SplitLine.absoluteValue value for this split line. Will be used to place and determine relative value.
parent - SplitLine.parent split line
opAncestor - opposite split line, SplitLine.opBound
Method Detail

getSplitIndex

public int getSplitIndex()
Get the split line index for this line. Stored as state, so this is O(1).

Returns:
value of splitLineIndex

setSplitIndex

public void setSplitIndex(int splitLineIndex)
Set the split line index for this line. O(1) to update state.

Parameters:
splitLineIndex - new value of splitLineIndex.

computeSplitLineIndex

public void computeSplitLineIndex(int rightAdd)
Recursively descend and assign split line index values to all split lines.

Parameters:
rightAdd - The amount to add to a right side child, initially 0 for root.

getStaticParent

public StaticSplitLine getStaticParent()
Get the parent object, as a StaticSplitLine.

Returns:
result of SplitLine.getParent(), casted.

getOffParentBound

public StaticSplitLine getOffParentBound()
Get the off-parent object, as a StaticSplitLine.

Returns:
result of SplitLine.getOpBound(), casted.

toString

public java.lang.String toString()
debug output function, print the split line index for this line.

Overrides:
toString in class SplitLine
Returns:
the split line index splitLineIndex as a string.

compareTo

public int compareTo(java.lang.Object o)
Natural order comparator that uses indices to determine which object (this or the input) precedes the other, or if they are the same. Stores a split line in the static SplitLine.splitLineFound variable if SplitLine.getSplitLine is set to true.

Specified by:
compareTo in interface java.lang.Comparable
Overrides:
compareTo in class SplitLine
Parameters:
o - other object to test.
Returns:
-1 if this is less than o, +1 if greater than, 0 if equal, according to splitLineIndex of each.

getOverlapStaticSplitCell

public static StaticSplitLine getOverlapStaticSplitCell(java.util.TreeSet searchTree,
                                                        StaticSplitLine input,
                                                        SplitAxis axis)
Returns a SplitLine whose absoluteValue is either equal to the input SplitLine's absoluteValue, or is the closest SplitLine less than the input SplitLine's absoluteValue. NOTE: if you return a value smaller than the first line in the partition, this function will RETURN the first line in the partition, not the minStuckLine as you might expect.

Parameters:
searchTree - Partitioned set of split lines from a rendering frame.
input - line that is being looked for in searchTree
axis - axis that line and search tree belong to
Returns:
the lowest split line that is bounded

getBounds

public StaticSplitLine[] getBounds(SplitAxis axis)
Get the bounds of this split line in the given axis, which are the parent and offparent. These are used to give relative position of the split line, and an overall absolute position when computed with all ancestors.

Returns:
ordered (smaller then larger index) pair of static split lines that bounds the movement of this split line (one of which is the parent, other is usually off parent or a min/max stuck line)