net.charlesames.utility.html
Class ContinuousGraphBuilder

java.lang.Object
  extended by net.charlesames.utility.html.HtmlBuilder
      extended by net.charlesames.utility.html.ContinuousGraphBuilder

public class ContinuousGraphBuilder
extends HtmlBuilder

Generates continuous graphs using HTML formatting tags.

Author:
Charles Ames

Nested Class Summary
 class ContinuousGraphBuilder.Column
           
 class ContinuousGraphBuilder.HistogramRegion
           
 class ContinuousGraphBuilder.Row
           
 
Nested classes/interfaces inherited from class net.charlesames.utility.html.HtmlBuilder
HtmlBuilder.Tags
 
Field Summary
 
Fields inherited from class net.charlesames.utility.html.HtmlBuilder
FILE_EXTENSION
 
Constructor Summary
ContinuousGraphBuilder()
          Constructor for ContinuousGraphBuilder instances.
 
Method Summary
 ContinuousGraphBuilder.Column addColumn()
           
 ContinuousGraphBuilder.Row addRow(int value, boolean occurence)
          Add a row
 java.lang.String build()
           
 void clear()
          Clear all graph data.
 HtmlColor getBarColor()
           
 int getCellWidth()
           
 int getZeroValue()
           
 ContinuousGraphBuilder.HistogramRegion locateHistogramRegion(int value, int low, int high)
          Locate the histogram region corresponding to the indicated value.
 void setBarColor(HtmlColor barColor)
           
 void setCellWidth(int cellWidth)
           
 void setZeroValue(int zeroValue)
           
 
Methods inherited from class net.charlesames.utility.html.HtmlBuilder
addTableCell, append, appendLineBreak, beginBlockQuote, beginBody, beginCenter, beginDiv, beginHead, beginHtml, beginListItem, beginOrderedList, beginParagraph, beginSpan, beginStyle, beginStyleRule, beginTable, beginTableBody, beginTableCell, beginTableHeader, beginTableHeaderCell, beginTableRow, beginTag, beginUnorderedList, buildAttribute, buildColorDeclaration, buildLink, buildStyleDeclaration, endBlockQuote, endBody, endCenter, endDiv, endHead, endHtml, endListItem, endOrderedList, endParagraph, endSpan, endStyle, endStyleRule, endTable, endTableBody, endTableCell, endTableHeader, endTableHeaderCell, endTableRow, endTag, endUnorderedList, newline, popTag, pushTag, reset, save, tab, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ContinuousGraphBuilder

public ContinuousGraphBuilder()
Constructor for ContinuousGraphBuilder instances.

Method Detail

clear

public void clear()
Clear all graph data.


getBarColor

public HtmlColor getBarColor()
Returns:
The bar color.

setBarColor

public void setBarColor(HtmlColor barColor)
Parameters:
barColor - The bar color.

getCellWidth

public int getCellWidth()
Returns:
The cell width.

setCellWidth

public void setCellWidth(int cellWidth)
Parameters:
cellWidth - The cell width (should be small).

getZeroValue

public int getZeroValue()
Returns:
The value where the horizontal axis is drawn.

setZeroValue

public void setZeroValue(int zeroValue)
Parameters:
zeroValue - The value where the horizontal axis is drawn.

addColumn

public ContinuousGraphBuilder.Column addColumn()
Returns:
The newly created Column object.

addRow

public ContinuousGraphBuilder.Row addRow(int value,
                                         boolean occurence)
Add a row

Parameters:
value -
occurence -
Returns:
The newly created Row instance.

build

public java.lang.String build()
Returns:
The HTML text encoding the continuous graph.

locateHistogramRegion

public ContinuousGraphBuilder.HistogramRegion locateHistogramRegion(int value,
                                                                    int low,
                                                                    int high)
Locate the histogram region corresponding to the indicated value.

Parameters:
value - The indicated value.
low - Lower limit for value used by binary search.
high - Higher limit for value by binary search.
Returns:
The histogram region that contains the indicated value.