public class BSTTree
extends java.lang.Object
Constructor and Description |
---|
BSTTree()
Constructor to set root to null and the two counters to zero
|
BSTTree(java.lang.String filePathAndName)
Constructor to initialize the tree by loading the tree with all
data from the crime report file.
|
Modifier and Type | Method and Description |
---|---|
CrimeRecordList |
bruteForceSearch(CrimeRecord n,
double distance) |
BSTTreeNode |
getChampionPtr() |
int |
getChampionVal() |
int |
getCrimeCount() |
int |
getDistinctCrimeLocations() |
static void |
go(java.lang.String x) |
int |
inOrderFindChampion()
This method would normally be public.
|
void |
inOrderFindChampion(BSTTreeNode t)
This method would normally be private.
|
void |
inOrderPrint()
This method would normally be public.
|
void |
inOrderPrint(BSTTreeNode t)
This method would normally be private.
|
void |
inOrderSearch(BSTTreeNode t,
CrimeRecord n,
CrimeRecordList resultList,
double distance) |
CrimeRecordList |
lookUp(java.lang.String address)
This method finds all crime reports at this address.
|
void |
preOrderPrint()
This method would normally be public.
|
void |
preOrderPrint(BSTTreeNode t)
This method would normally be private.
|
void |
readTree(java.lang.String crimeDataLocation)
This routine handles the actial reading of the file.
|
static void |
sto(java.lang.String x) |
public BSTTree()
public BSTTree(java.lang.String filePathAndName)
filePathAndName
- public int getChampionVal()
public BSTTreeNode getChampionPtr()
public void readTree(java.lang.String crimeDataLocation) throws java.lang.Exception
crimeDataLocation
- is the lcation of the crime filejava.lang.Exception
public int getCrimeCount()
public int getDistinctCrimeLocations()
public void preOrderPrint(BSTTreeNode t)
t
- public void preOrderPrint()
public void inOrderPrint(BSTTreeNode t)
t
- public void inOrderPrint()
public void inOrderFindChampion(BSTTreeNode t)
t
- public int inOrderFindChampion()
public CrimeRecordList lookUp(java.lang.String address)
public CrimeRecordList bruteForceSearch(CrimeRecord n, double distance)
n
- contains a crime record of a crime in the treedistance
- is a distance in feetpublic void inOrderSearch(BSTTreeNode t, CrimeRecord n, CrimeRecordList resultList, double distance)
t
- points to a node in the tree, below which, this code will search all
crimes.n
- is a reference to a crime record with (x,y) state plane coordinatesresultList
- contains a pointer to the list we are buildingdistance
- the search finds crimes within this distance in feet.public static void go(java.lang.String x)
public static void sto(java.lang.String x)