- tokenEntryDatas.clear();
- final int indexRow = index.sortedIndexEntries.size();
- index.sortedIndexEntries.add(new Index.IndexEntry(tokenData.token, rows.size()));
- rows.add(new TokenRow(indexRow, rows.size(), index));
- int count = 0;
- System.out.println("TOKEN: " + tokenData.token);
- for (final Map.Entry<EntryTypeName, List<EntryData>> typeToEntry : tokenData.typeToEntries.entrySet()) {
- for (final EntryData entryData : typeToEntry.getValue()) {
- if (tokenEntryDatas.add(entryData)) {
- rows.add(new PairEntry.Row(entryData.index(), rows.size(), index));
- ++count;
+ tokenIndexedEntries.clear();
+ final int indexIndex = index.sortedIndexEntries.size();
+ final int startRow = rows.size();
+
+ TokenRow tokenRow = null;
+ if (!tokenData.htmlEntries.isEmpty()) {
+ tokenRow = new TokenRow(indexIndex, rows.size(), index, tokenData.hasMainEntry);
+ rows.add(tokenRow);
+ }
+
+// System.out.println("Added TokenRow: " + rows.get(rows.size() - 1));
+
+ int numRows = 0; // off by one--doesn't count the token row!
+// System.out.println("TOKEN: " + tokenData.token);
+ for (final Map.Entry<EntryTypeName, List<IndexedEntry>> typeToIndexedEntries : tokenData.typeToEntries.entrySet()) {
+ for (final IndexedEntry indexedEntry : typeToIndexedEntries.getValue()) {
+ if (!indexedEntry.isValid) {
+ continue;
+ }
+
+ if (tokenRow == null) {
+ tokenRow = new TokenRow(indexIndex, rows.size(), index, tokenData.hasMainEntry);
+ rows.add(tokenRow);
+ }
+
+ if (indexedEntry.entry.index() == -1) {
+ indexedEntry.entry.addToDictionary(dictionaryBuilder.dictionary);
+ assert indexedEntry.entry.index() >= 0;
+ }
+ if (tokenIndexedEntries.add(indexedEntry) && !tokenData.htmlEntries.contains(indexedEntry.entry)) {
+ rows.add(indexedEntry.entry.CreateRow(rows.size(), index));
+ ++indexedEntry.entry.entrySource.numEntries;
+ ++numRows;