cmu.tawc.data
Class Counter

java.lang.Object
  extended by cmu.tawc.data.Counter

public class Counter
extends java.lang.Object


Nested Class Summary
 class Counter.Count
           
 class Counter.CountComparator
           
 class Counter.CountVectorComparator
           
 
Constructor Summary
Counter(javax.swing.table.TableModel tableModel, int[] columnsToCount, Dictionary dictionary)
           
 
Method Summary
 void calculatePercents()
           
 void countAll()
           
 void countByRowsAppendData()
          The tableModel passed in must be a DataTableModel to do this (i.e. we have to be able to create new columns) Appends the data for category counts as new columns to the table.
 void countSentence(java.lang.String text)
           
 void countWord(java.lang.String text)
           
 boolean exportToXLS(java.io.OutputStream outputStream)
          Exports to an excel file, using multiple sheets for word count and for Category count, which is much clearer.
 javax.swing.table.TableModel getOutput()
           
 ProgressListener getProgressListener()
           
 java.lang.Integer getPruneColumnsWithMoreThanPercentZeros()
           
 boolean getSaveCount()
           
 boolean getSavePercent()
          Get whether we will save the percentages of the count, or the count itself.
 java.lang.String getStartColumnNamesWith()
           
static void main(java.lang.String[] args)
           
 void setProgressListener(ProgressListener progressListener)
           
 void setPruneColumnsWithMoreThanPercentZeros(java.lang.Integer pruneColumnsWithMoreThanPercentZeros)
           
 void setSaveCount(boolean saveCount)
           
 void setSavePercent(boolean savePercent)
          Set whether it will save the percentage of the count, or the count itself.
 void setStartColumnNamesWith(java.lang.String startColumnNamesWith)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Counter

public Counter(javax.swing.table.TableModel tableModel,
               int[] columnsToCount,
               Dictionary dictionary)
Method Detail

getProgressListener

public ProgressListener getProgressListener()

setProgressListener

public void setProgressListener(ProgressListener progressListener)

countAll

public void countAll()

countByRowsAppendData

public void countByRowsAppendData()
                           throws java.lang.ClassCastException,
                                  FailedRequest
The tableModel passed in must be a DataTableModel to do this (i.e. we have to be able to create new columns) Appends the data for category counts as new columns to the table. TODO clean this up. We now save all the data into categoryCountList and wordCountList, but in parallel we also save it to the table if we can -- there's no reason to be doing both. We should save to the table second, after pruning -- this is inefficient.

Throws:
java.lang.ClassCastException
FailedRequest

calculatePercents

public void calculatePercents()

countSentence

public void countSentence(java.lang.String text)

countWord

public void countWord(java.lang.String text)

getOutput

public javax.swing.table.TableModel getOutput()

exportToXLS

public boolean exportToXLS(java.io.OutputStream outputStream)
Exports to an excel file, using multiple sheets for word count and for Category count, which is much clearer. I'd be tempted to put more excel features in here, but I'm not sure what yet.

Parameters:
outputStream -
Returns:

main

public static final void main(java.lang.String[] args)
                       throws java.lang.Throwable
Throws:
java.lang.Throwable

getSavePercent

public boolean getSavePercent()
Get whether we will save the percentages of the count, or the count itself.

Returns:

setSavePercent

public void setSavePercent(boolean savePercent)
Set whether it will save the percentage of the count, or the count itself.

Parameters:
savePercent -

getSaveCount

public boolean getSaveCount()

setSaveCount

public void setSaveCount(boolean saveCount)

getStartColumnNamesWith

public java.lang.String getStartColumnNamesWith()

setStartColumnNamesWith

public void setStartColumnNamesWith(java.lang.String startColumnNamesWith)

getPruneColumnsWithMoreThanPercentZeros

public java.lang.Integer getPruneColumnsWithMoreThanPercentZeros()

setPruneColumnsWithMoreThanPercentZeros

public void setPruneColumnsWithMoreThanPercentZeros(java.lang.Integer pruneColumnsWithMoreThanPercentZeros)