I want to save the results of reading the lucene index in jTable so that I can sort it by different columns. From the index I read terms with various measurements of their frequencies.
Column columns: [string term] [int absFrequency] [int docFrequency] [double invFrequency]
So, in AbstractTableModel I can define the column names, but I donβt know how to get the Object [] [] data with the results from the following method:
public static void FrequencyMap(Directory indexDir) throws Exception { List<ArrayList>redoviLista = new ArrayList<ArrayList>(); //final Map<String,TermRow> map = new TreeMap<String,TermRow>(); List<String>termList = new ArrayList<String>(); IndexReader iReader = IndexReader.open(indexDir); FilterIndexReader fReader = new FilterIndexReader(iReader); int numOfDocs = fReader.numDocs(); TermEnum terms = fReader.terms(); while (terms.next()){ Term term = terms.term(); String termText = term.text(); termList.add(termText); //Calculating the frequencies int df = iReader.docFreq(term); double idf = 0.0F; idf = Math.log10((double) numOfDocs / df); double tfidf = (df*idf); //Here comes important part //Changes according to takoi answer ArrayList<Object> oneRow = new ArrayList<Object>(); oneRow.add(termText); oneRow.add(df); oneRow.add(idf); oneRow.add(tfidf); redoviLista.add(oneRow); } iReader.close(); // So I need something like this, and i Neeed this array to be stored out of this method
So, I became famous here to continue the implementation of AbstractTableModel and populate and display this table ....: /
Please, help!
java swing jtable tablemodel abstracttablemodel
Julia
source share