bass.suggestion
Class SuggestionTool

java.lang.Object
  extended by java.lang.Thread
      extended by bass.suggestion.SuggestionTool
All Implemented Interfaces:
java.lang.Runnable

public class SuggestionTool
extends java.lang.Thread

The Worldfamous Suggestion Tool

Version:
0.1
Author:
Thomas Klein

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private  boolean deepScan
           
private  java.lang.String fontTag
           
private  DTO_Band[] inputData
           
private  java.lang.StringBuffer output
           
private  java.net.URL outputFile
           
(package private)  java.lang.Object[][] sortedList
           
private  java.util.Hashtable<java.lang.Integer,DTO_BandWithPoints> suggList
           
private  java.lang.String[] tdBgs
           
private  Gui theGui
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
SuggestionTool(DTO_Band[] inputBands, Gui gui, boolean deepScan)
          generates a new SuggestionTool
 
Method Summary
private  DTO_Band[] generateBandArray(java.util.Hashtable<java.lang.Integer,DTO_BandWithPoints> input)
          extracts the DTO's from the input and writes them to an DTO array
private  int[] generateIntArray(DTO_Band[] input)
          Deprecated. not in use anymore, just leaving it, in case it makes sense some day
 void generateSuggestions()
          generates suggestions
 void generateTop(int topWhat)
          generates a html formated top XX (param)
 void removeBandsFromInputList()
          removes the bands from the input data from the suggestion list
 void run()
           
private  void shortenHashtable(int lastAverage)
          removes unused elements from the hashtable until the hashtable is smaller than 500 elements (otherwise the sorting the hashtable will take forever)
private  java.lang.String writePointHistory(DTO_BandWithPoints band)
          writes a html (in .
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

inputData

private DTO_Band[] inputData

theGui

private Gui theGui

suggList

private java.util.Hashtable<java.lang.Integer,DTO_BandWithPoints> suggList

sortedList

java.lang.Object[][] sortedList

output

private java.lang.StringBuffer output

outputFile

private java.net.URL outputFile

tdBgs

private java.lang.String[] tdBgs

fontTag

private java.lang.String fontTag

deepScan

private boolean deepScan
Constructor Detail

SuggestionTool

public SuggestionTool(DTO_Band[] inputBands,
                      Gui gui,
                      boolean deepScan)
generates a new SuggestionTool

Parameters:
inputBands - the InputData
gui - the GUI-Reference for progressbar-access
Method Detail

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

generateSuggestions

public void generateSuggestions()
generates suggestions


removeBandsFromInputList

public void removeBandsFromInputList()
removes the bands from the input data from the suggestion list


generateTop

public void generateTop(int topWhat)
generates a html formated top XX (param)

Parameters:
topWhat - e.g. top 10, 100, ...

generateIntArray

private int[] generateIntArray(DTO_Band[] input)
Deprecated. not in use anymore, just leaving it, in case it makes sense some day

extracts the id's from the input and writes them to an int array

Parameters:
input - the input bands
Returns:
int array with the band ids

generateBandArray

private DTO_Band[] generateBandArray(java.util.Hashtable<java.lang.Integer,DTO_BandWithPoints> input)
extracts the DTO's from the input and writes them to an DTO array

Parameters:
input - the input bands
Returns:
DTO array with the band ids / names

writePointHistory

private java.lang.String writePointHistory(DTO_BandWithPoints band)
writes a html (in ./bass/suggestion/pointHistories/.htm) with the bands point history

Parameters:
band - the band whose point history should be written
Returns:
the string representation of the files URL

shortenHashtable

private void shortenHashtable(int lastAverage)
removes unused elements from the hashtable until the hashtable is smaller than 500 elements (otherwise the sorting the hashtable will take forever)