net.sourceforge.olduvai.treejuxtaposer.drawer
Class RangeList

java.lang.Object
  extended by net.sourceforge.olduvai.accordiondrawer.AbstractRangeList
      extended by net.sourceforge.olduvai.treejuxtaposer.drawer.RangeList

public class RangeList
extends AbstractRangeList

A class representing a list of RangeInTrees. A RangeInTree represents ordered pair (min,max)) of TreeNodes. This class is a helper class for TreeJuxtaposer and keeps a resizeable array of RangeInTree's. Note that each RangeInTrees item in a RangeList can be associated with a different Tree.

Author:
Tamara Munzner
See Also:
RangeInTree, TreeNode

Field Summary
private  int groupID
          group ID: key refers to priority, this is for reference to groups by well known static assigned integers to constants.
static RangeInTree matchRange
          Accessor storage for comparator in RangeInTree.
static boolean returnObject
          Accessor flag for comparator in RangeInTree.
private  boolean thisTreeOnly
          Only highlight group items for this tree, not all the others
 
Fields inherited from class net.sourceforge.olduvai.accordiondrawer.AbstractRangeList
color, enabled, key, ranges
 
Constructor Summary
RangeList(int i, int groupID)
          Constuctor for a range list, for storing details about marked groups of nodes.
 
Method Summary
 void addRange(int min, int max, AccordionTreeDrawer t)
          Add a range to the list of ranges.
 void clear()
          Reset rangeList
 AbstractRangeList flipRangeToShrink(int xy, AccordionDrawer ad)
          Invert this range list to perform a shrink operation (which is actually a grow on the unmarked ranges).
 RangeInTree getFirst()
          Get the first range in the set.
 int getNumRanges()
          Get the number of ranges in this list.
 java.util.Set getRanges()
          Get the whole Set of ranges
 double[] getSizesOfAllRanges(SplitAxis splitLine, int frameNum)
          Collate range sizes into an array of doubles.
 int[] getSplitIndices(boolean horizontal)
          Collate split line indices into an array of integers.
 double getUnshrinkableTotal(AccordionDrawer ad, SplitAxis splitAxis, int frameNum)
          Accumulate the unshrinkable total for this set of ranges.
 int groupID()
          Group ID accessor.
 boolean isThisRangeInList(int min, int max, AccordionTreeDrawer atd)
          Determines if the given range of min,max is overlapping with this rangelist
 boolean isThisTreeOnly()
          Flag access to thisTreeOnly.
 RangeList nodeKeyToSplitLine(int xy, boolean horiz)
          Return a list of ranges of split line indices.
 AbstractRangeList onlyThisAD(AccordionDrawer d)
          Prune the range list and return only a range list of ranges for the given drawer.
 void removeRange(int min, int max, AccordionTreeDrawer t)
          Find and remove a given range.
 void setThisTreeOnly(boolean on)
           
 java.lang.String toString()
          Debugging output function.
 
Methods inherited from class net.sourceforge.olduvai.accordiondrawer.AbstractRangeList
getColor, getKey, getSplitLines, isEnabled, setColor, setEnabled, setKey, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

groupID

private int groupID
group ID: key refers to priority, this is for reference to groups by well known static assigned integers to constants.


returnObject

public static boolean returnObject
Accessor flag for comparator in RangeInTree.


matchRange

public static RangeInTree matchRange
Accessor storage for comparator in RangeInTree.


thisTreeOnly

private boolean thisTreeOnly
Only highlight group items for this tree, not all the others

Constructor Detail

RangeList

public RangeList(int i,
                 int groupID)
Constuctor for a range list, for storing details about marked groups of nodes.

Parameters:
i - key for this range list.
groupID - groupID for this range list.
Method Detail

addRange

public void addRange(int min,
                     int max,
                     AccordionTreeDrawer t)
Add a range to the list of ranges. Collates all matches if there is an overlap.

Parameters:
min - min index of new range
max - max index of new range
t - drawer for new range

removeRange

public void removeRange(int min,
                        int max,
                        AccordionTreeDrawer t)
Find and remove a given range.

Parameters:
min - min index of the range to remove
max - max index of the range to remove
t - drawer for the range to remove.

clear

public void clear()
Reset rangeList


isThisTreeOnly

public boolean isThisTreeOnly()
Flag access to thisTreeOnly.

Returns:
value of thisTreeOnly

setThisTreeOnly

public void setThisTreeOnly(boolean on)

getRanges

public java.util.Set getRanges()
Get the whole Set of ranges

Returns:
ranges, the raw set

getFirst

public RangeInTree getFirst()
Get the first range in the set.

Returns:
First range

getNumRanges

public int getNumRanges()
Get the number of ranges in this list.

Returns:
The size of the ranges container.

toString

public java.lang.String toString()
Debugging output function.

Overrides:
toString in class java.lang.Object
Returns:
each range on a separate line

getSplitIndices

public int[] getSplitIndices(boolean horizontal)
Collate split line indices into an array of integers.

Specified by:
getSplitIndices in class AbstractRangeList
Parameters:
horizontal - true for horizontal/X, false for vertical/Y
Returns:
array of indices, two for each range (index[0,1] is a pair for range 0, index[2,3] is a pair for range 1, etc).

getSizesOfAllRanges

public double[] getSizesOfAllRanges(SplitAxis splitLine,
                                    int frameNum)
Collate range sizes into an array of doubles.

Specified by:
getSizesOfAllRanges in class AbstractRangeList
Parameters:
splitLine - Split axis for this range.
frameNum - current frame
Returns:
array of doubles, one for each range.

onlyThisAD

public AbstractRangeList onlyThisAD(AccordionDrawer d)
Prune the range list and return only a range list of ranges for the given drawer.

Specified by:
onlyThisAD in class AbstractRangeList
Parameters:
d - drawer of interest for ranges, all other drawers will not have their ranges added to the return value
Returns:
RangeList of ranges from the given drawer.

nodeKeyToSplitLine

public RangeList nodeKeyToSplitLine(int xy,
                                    boolean horiz)
Return a list of ranges of split line indices. Input ranges (this object's range list) are ranges of tree nodes. Added boolean horiz to fix off-by-one problems between compressing adjacent ranges and comparing adjacent ranges for additions.

Parameters:
xy - X for horizontal, Y for vertical
horiz - redundant? ever different from xy in use?
Returns:
rangeList of split line ranges corresponding to this rangelist of tree node indices

flipRangeToShrink

public AbstractRangeList flipRangeToShrink(int xy,
                                           AccordionDrawer ad)
Invert this range list to perform a shrink operation (which is actually a grow on the unmarked ranges).

Specified by:
flipRangeToShrink in class AbstractRangeList
Parameters:
xy - Axis for this list of ranges
ad - drawer for this range list
Returns:
The list of ranges between the list of ranges of this object.

isThisRangeInList

public boolean isThisRangeInList(int min,
                                 int max,
                                 AccordionTreeDrawer atd)
Determines if the given range of min,max is overlapping with this rangelist

Parameters:
min - min of range to test
max - max of range to test
atd - drawer of testing range
Returns:
true if min,max overlaps with any range in this list of ranges

getUnshrinkableTotal

public double getUnshrinkableTotal(AccordionDrawer ad,
                                   SplitAxis splitAxis,
                                   int frameNum)
Accumulate the unshrinkable total for this set of ranges. This will restrict grows to support a minimum gap between ranges, if possible.

Specified by:
getUnshrinkableTotal in class AbstractRangeList
Parameters:
ad - Drawer for this rangelist
splitAxis - Axis that this range list is on
frameNum - current frame number
Returns:
The total world space that may not be shrunk after stretching.

groupID

public int groupID()
Group ID accessor.

Returns:
value of groupID()