AccordionDrawer
Class BinaryTree

java.lang.Object
  |
  +--AccordionDrawer.BinaryTree

public class BinaryTree
extends java.lang.Object

A class which implements a quadtree This class is a tree of GridCells; each GridCell has up to 4 children.


Field Summary
static int depthAdd
           
static int[][] gridSize
           
 BinaryGridCell rootCell
           
static int totalDepth
           
 
Constructor Summary
BinaryTree(AccordionDrawer theowner)
          Constructor.
 
Method Summary
 GridCell getChildAt(BinaryGridCell cell, int ddepth, int x, int y)
          Gets a child at a specified x, y, depth location.
 GridCell getGridCell(int level, int row, int col)
          Returns the GridCell at the specified row, column and level.
static int getGridSize(int xy, int level)
           
 AccordionDrawer getOwner()
           
 void init(int depth, int row, int depthAdd)
          Initializes a few variables.
 GridCell makeChildAt(BinaryGridCell cell, int ddepth, int x, int y)
          Like getChildAt, but makes new cells whenever necessary.
 GridCell putChildAt(BinaryGridCell cell, int ddepth, int x, int y, GridCell insertCell)
          Like makeChildAt, but the instead of creating a new cell at the specified location, puts the specified cell there.
static void setGridSize(int xy, int level, int is)
           
 void setRootCell(BinaryGridCell g)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rootCell

public BinaryGridCell rootCell

totalDepth

public static int totalDepth

depthAdd

public static int depthAdd

gridSize

public static int[][] gridSize
Constructor Detail

BinaryTree

public BinaryTree(AccordionDrawer theowner)
Constructor.

Method Detail

init

public void init(int depth,
                 int row,
                 int depthAdd)
Initializes a few variables. Should probably be absorbed into the constructor


getOwner

public AccordionDrawer getOwner()

setRootCell

public void setRootCell(BinaryGridCell g)

getGridCell

public GridCell getGridCell(int level,
                            int row,
                            int col)
Returns the GridCell at the specified row, column and level. Time is linear in the depth of the requested cell.


getChildAt

public GridCell getChildAt(BinaryGridCell cell,
                           int ddepth,
                           int x,
                           int y)
Gets a child at a specified x, y, depth location.


makeChildAt

public GridCell makeChildAt(BinaryGridCell cell,
                            int ddepth,
                            int x,
                            int y)
Like getChildAt, but makes new cells whenever necessary.


putChildAt

public GridCell putChildAt(BinaryGridCell cell,
                           int ddepth,
                           int x,
                           int y,
                           GridCell insertCell)
Like makeChildAt, but the instead of creating a new cell at the specified location, puts the specified cell there. TOTALLY BACKWARDS CONVENTION FROM REST OF CODE!! (but i'm not bitter) x == column, y == row


getGridSize

public static int getGridSize(int xy,
                              int level)
Returns:

setGridSize

public static void setGridSize(int xy,
                               int level,
                               int is)
Parameters:
is -