org.openi.segment
Class SegmentFactory

java.lang.Object
  extended by org.openi.segment.SegmentFactory

public class SegmentFactory
extends java.lang.Object

Generates customizable Lists of SegmentBins


Method Summary
protected static java.util.List createBuckets(float dataMin, float dataMax, int numBuckets, boolean round)
           
static java.util.List createSegments(java.sql.Connection connection, java.lang.String targetTable, java.lang.String targetColumn, int numBuckets, boolean round)
          Constructs SQL based on input table, column, number of buckets executes sql, returns a collection of segment bins suitable for display/creating a chart
static void streamSegmentChart(java.io.OutputStream out, java.lang.String targetColumn, java.util.List segments, int width, int height, org.jfree.chart.plot.PlotOrientation plotOrientation, ProjectContext ctx)
          Does not do any database querying inside of this method, relies completely on the input List of segments to generate a JFreeChart
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createSegments

public static java.util.List createSegments(java.sql.Connection connection,
                                            java.lang.String targetTable,
                                            java.lang.String targetColumn,
                                            int numBuckets,
                                            boolean round)
                                     throws java.sql.SQLException
Constructs SQL based on input table, column, number of buckets executes sql, returns a collection of segment bins suitable for display/creating a chart

Parameters:
connection -
targetTable -
targetColumn -
numBuckets -
round -
Returns:
list of SegmentBin objects, populated with frequencies, cut points
Throws:
java.sql.SQLException - - TODO: wrap in a SegmentException?

streamSegmentChart

public static void streamSegmentChart(java.io.OutputStream out,
                                      java.lang.String targetColumn,
                                      java.util.List segments,
                                      int width,
                                      int height,
                                      org.jfree.chart.plot.PlotOrientation plotOrientation,
                                      ProjectContext ctx)
                               throws java.sql.SQLException,
                                      java.io.IOException
Does not do any database querying inside of this method, relies completely on the input List of segments to generate a JFreeChart

Parameters:
out -
targetColumn -
segments -
width -
height -
plotOrientation -
Throws:
java.sql.SQLException
java.io.IOException

createBuckets

protected static java.util.List createBuckets(float dataMin,
                                              float dataMax,
                                              int numBuckets,
                                              boolean round)