Re-organization of classes in the browsing.* packages.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@825 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-05-20 00:33:13 +00:00
parent 598258a326
commit ef2079d0d8
24 changed files with 73 additions and 44 deletions

View File

@ -15,8 +15,9 @@ import com.metaweb.gridworks.browsing.facets.ListFacet;
import com.metaweb.gridworks.browsing.facets.RangeFacet; import com.metaweb.gridworks.browsing.facets.RangeFacet;
import com.metaweb.gridworks.browsing.facets.ScatterplotFacet; import com.metaweb.gridworks.browsing.facets.ScatterplotFacet;
import com.metaweb.gridworks.browsing.facets.TextSearchFacet; import com.metaweb.gridworks.browsing.facets.TextSearchFacet;
import com.metaweb.gridworks.browsing.filters.RecordFilter; import com.metaweb.gridworks.browsing.util.ConjunctiveFilteredRecords;
import com.metaweb.gridworks.browsing.filters.RowFilter; import com.metaweb.gridworks.browsing.util.ConjunctiveFilteredRows;
import com.metaweb.gridworks.browsing.util.FilteredRecordsAsFilteredRows;
import com.metaweb.gridworks.model.Project; import com.metaweb.gridworks.model.Project;
import com.metaweb.gridworks.model.Row; import com.metaweb.gridworks.model.Row;

View File

@ -1,4 +1,4 @@
package com.metaweb.gridworks.browsing.filters; package com.metaweb.gridworks.browsing;
import com.metaweb.gridworks.model.Project; import com.metaweb.gridworks.model.Project;
import com.metaweb.gridworks.model.Record; import com.metaweb.gridworks.model.Record;

View File

@ -1,4 +1,4 @@
package com.metaweb.gridworks.browsing.filters; package com.metaweb.gridworks.browsing;
import com.metaweb.gridworks.model.Project; import com.metaweb.gridworks.model.Project;
import com.metaweb.gridworks.model.Row; import com.metaweb.gridworks.model.Row;

View File

@ -5,8 +5,8 @@ import org.json.JSONObject;
import com.metaweb.gridworks.Jsonizable; import com.metaweb.gridworks.Jsonizable;
import com.metaweb.gridworks.browsing.FilteredRecords; import com.metaweb.gridworks.browsing.FilteredRecords;
import com.metaweb.gridworks.browsing.FilteredRows; import com.metaweb.gridworks.browsing.FilteredRows;
import com.metaweb.gridworks.browsing.filters.RecordFilter; import com.metaweb.gridworks.browsing.RecordFilter;
import com.metaweb.gridworks.browsing.filters.RowFilter; import com.metaweb.gridworks.browsing.RowFilter;
import com.metaweb.gridworks.model.Project; import com.metaweb.gridworks.model.Project;
/** /**

View File

@ -12,10 +12,11 @@ import org.json.JSONWriter;
import com.metaweb.gridworks.browsing.DecoratedValue; import com.metaweb.gridworks.browsing.DecoratedValue;
import com.metaweb.gridworks.browsing.FilteredRecords; import com.metaweb.gridworks.browsing.FilteredRecords;
import com.metaweb.gridworks.browsing.FilteredRows; import com.metaweb.gridworks.browsing.FilteredRows;
import com.metaweb.gridworks.browsing.RecordFilter;
import com.metaweb.gridworks.browsing.RowFilter;
import com.metaweb.gridworks.browsing.filters.AnyRowRecordFilter; import com.metaweb.gridworks.browsing.filters.AnyRowRecordFilter;
import com.metaweb.gridworks.browsing.filters.ExpressionEqualRowFilter; import com.metaweb.gridworks.browsing.filters.ExpressionEqualRowFilter;
import com.metaweb.gridworks.browsing.filters.RecordFilter; import com.metaweb.gridworks.browsing.util.ExpressionNominalValueGrouper;
import com.metaweb.gridworks.browsing.filters.RowFilter;
import com.metaweb.gridworks.expr.Evaluable; import com.metaweb.gridworks.expr.Evaluable;
import com.metaweb.gridworks.expr.MetaParser; import com.metaweb.gridworks.expr.MetaParser;
import com.metaweb.gridworks.expr.ParsingException; import com.metaweb.gridworks.expr.ParsingException;
@ -172,8 +173,8 @@ public class ListFacet implements Facet {
@Override @Override
public void computeChoices(Project project, FilteredRows filteredRows) { public void computeChoices(Project project, FilteredRows filteredRows) {
if (_eval != null && _errorMessage == null) { if (_eval != null && _errorMessage == null) {
ExpressionNominalRowGrouper grouper = ExpressionNominalValueGrouper grouper =
new ExpressionNominalRowGrouper(_eval, _columnName, _cellIndex); new ExpressionNominalValueGrouper(_eval, _columnName, _cellIndex);
filteredRows.accept(project, grouper); filteredRows.accept(project, grouper);
@ -184,8 +185,8 @@ public class ListFacet implements Facet {
@Override @Override
public void computeChoices(Project project, FilteredRecords filteredRecords) { public void computeChoices(Project project, FilteredRecords filteredRecords) {
if (_eval != null && _errorMessage == null) { if (_eval != null && _errorMessage == null) {
ExpressionNominalRowGrouper grouper = ExpressionNominalValueGrouper grouper =
new ExpressionNominalRowGrouper(_eval, _columnName, _cellIndex); new ExpressionNominalValueGrouper(_eval, _columnName, _cellIndex);
filteredRecords.accept(project, grouper); filteredRecords.accept(project, grouper);
@ -193,7 +194,7 @@ public class ListFacet implements Facet {
} }
} }
protected void postProcessGrouper(ExpressionNominalRowGrouper grouper) { protected void postProcessGrouper(ExpressionNominalValueGrouper grouper) {
_choices.clear(); _choices.clear();
_choices.addAll(grouper.choices.values()); _choices.addAll(grouper.choices.values());

View File

@ -8,10 +8,14 @@ import org.json.JSONWriter;
import com.metaweb.gridworks.browsing.FilteredRecords; import com.metaweb.gridworks.browsing.FilteredRecords;
import com.metaweb.gridworks.browsing.FilteredRows; import com.metaweb.gridworks.browsing.FilteredRows;
import com.metaweb.gridworks.browsing.RecordFilter;
import com.metaweb.gridworks.browsing.RowFilter;
import com.metaweb.gridworks.browsing.filters.AnyRowRecordFilter; import com.metaweb.gridworks.browsing.filters.AnyRowRecordFilter;
import com.metaweb.gridworks.browsing.filters.ExpressionNumberComparisonRowFilter; import com.metaweb.gridworks.browsing.filters.ExpressionNumberComparisonRowFilter;
import com.metaweb.gridworks.browsing.filters.RecordFilter; import com.metaweb.gridworks.browsing.util.ExpressionNumericValueBinner;
import com.metaweb.gridworks.browsing.filters.RowFilter; import com.metaweb.gridworks.browsing.util.NumericBinIndex;
import com.metaweb.gridworks.browsing.util.NumericBinRecordIndex;
import com.metaweb.gridworks.browsing.util.NumericBinRowIndex;
import com.metaweb.gridworks.expr.Evaluable; import com.metaweb.gridworks.expr.Evaluable;
import com.metaweb.gridworks.expr.MetaParser; import com.metaweb.gridworks.expr.MetaParser;
import com.metaweb.gridworks.expr.ParsingException; import com.metaweb.gridworks.expr.ParsingException;
@ -187,8 +191,8 @@ public class RangeFacet implements Facet {
retrieveDataFromBaseBinIndex(index); retrieveDataFromBaseBinIndex(index);
ExpressionNumericRowBinner binner = ExpressionNumericValueBinner binner =
new ExpressionNumericRowBinner(_eval, _columnName, _cellIndex, index); new ExpressionNumericValueBinner(_eval, _columnName, _cellIndex, index);
filteredRows.accept(project, binner); filteredRows.accept(project, binner);
retrieveDataFromBinner(binner); retrieveDataFromBinner(binner);
@ -208,8 +212,8 @@ public class RangeFacet implements Facet {
retrieveDataFromBaseBinIndex(index); retrieveDataFromBaseBinIndex(index);
ExpressionNumericRowBinner binner = ExpressionNumericValueBinner binner =
new ExpressionNumericRowBinner(_eval, _columnName, _cellIndex, index); new ExpressionNumericValueBinner(_eval, _columnName, _cellIndex, index);
filteredRecords.accept(project, binner); filteredRecords.accept(project, binner);
@ -237,7 +241,7 @@ public class RangeFacet implements Facet {
} }
} }
protected void retrieveDataFromBinner(ExpressionNumericRowBinner binner) { protected void retrieveDataFromBinner(ExpressionNumericValueBinner binner) {
_bins = binner.bins; _bins = binner.bins;
_numericCount = binner.numericCount; _numericCount = binner.numericCount;
_nonNumericCount = binner.nonNumericCount; _nonNumericCount = binner.nonNumericCount;

View File

@ -20,10 +20,13 @@ import org.slf4j.LoggerFactory;
import com.metaweb.gridworks.browsing.FilteredRecords; import com.metaweb.gridworks.browsing.FilteredRecords;
import com.metaweb.gridworks.browsing.FilteredRows; import com.metaweb.gridworks.browsing.FilteredRows;
import com.metaweb.gridworks.browsing.RecordFilter;
import com.metaweb.gridworks.browsing.RowFilter;
import com.metaweb.gridworks.browsing.filters.AnyRowRecordFilter; import com.metaweb.gridworks.browsing.filters.AnyRowRecordFilter;
import com.metaweb.gridworks.browsing.filters.DualExpressionsNumberComparisonRowFilter; import com.metaweb.gridworks.browsing.filters.DualExpressionsNumberComparisonRowFilter;
import com.metaweb.gridworks.browsing.filters.RecordFilter; import com.metaweb.gridworks.browsing.util.NumericBinIndex;
import com.metaweb.gridworks.browsing.filters.RowFilter; import com.metaweb.gridworks.browsing.util.NumericBinRecordIndex;
import com.metaweb.gridworks.browsing.util.NumericBinRowIndex;
import com.metaweb.gridworks.expr.Evaluable; import com.metaweb.gridworks.expr.Evaluable;
import com.metaweb.gridworks.expr.MetaParser; import com.metaweb.gridworks.expr.MetaParser;
import com.metaweb.gridworks.expr.ParsingException; import com.metaweb.gridworks.expr.ParsingException;

View File

@ -9,10 +9,10 @@ import org.json.JSONWriter;
import com.metaweb.gridworks.browsing.FilteredRecords; import com.metaweb.gridworks.browsing.FilteredRecords;
import com.metaweb.gridworks.browsing.FilteredRows; import com.metaweb.gridworks.browsing.FilteredRows;
import com.metaweb.gridworks.browsing.RecordFilter;
import com.metaweb.gridworks.browsing.RowFilter;
import com.metaweb.gridworks.browsing.filters.AnyRowRecordFilter; import com.metaweb.gridworks.browsing.filters.AnyRowRecordFilter;
import com.metaweb.gridworks.browsing.filters.ExpressionStringComparisonRowFilter; import com.metaweb.gridworks.browsing.filters.ExpressionStringComparisonRowFilter;
import com.metaweb.gridworks.browsing.filters.RecordFilter;
import com.metaweb.gridworks.browsing.filters.RowFilter;
import com.metaweb.gridworks.expr.Evaluable; import com.metaweb.gridworks.expr.Evaluable;
import com.metaweb.gridworks.gel.ast.VariableExpr; import com.metaweb.gridworks.gel.ast.VariableExpr;
import com.metaweb.gridworks.model.Project; import com.metaweb.gridworks.model.Project;

View File

@ -1,5 +1,7 @@
package com.metaweb.gridworks.browsing.filters; package com.metaweb.gridworks.browsing.filters;
import com.metaweb.gridworks.browsing.RecordFilter;
import com.metaweb.gridworks.browsing.RowFilter;
import com.metaweb.gridworks.model.Project; import com.metaweb.gridworks.model.Project;
import com.metaweb.gridworks.model.Record; import com.metaweb.gridworks.model.Record;

View File

@ -3,6 +3,7 @@ package com.metaweb.gridworks.browsing.filters;
import java.util.Collection; import java.util.Collection;
import java.util.Properties; import java.util.Properties;
import com.metaweb.gridworks.browsing.RowFilter;
import com.metaweb.gridworks.expr.Evaluable; import com.metaweb.gridworks.expr.Evaluable;
import com.metaweb.gridworks.expr.ExpressionUtils; import com.metaweb.gridworks.expr.ExpressionUtils;
import com.metaweb.gridworks.model.Cell; import com.metaweb.gridworks.model.Cell;

View File

@ -3,6 +3,7 @@ package com.metaweb.gridworks.browsing.filters;
import java.util.Collection; import java.util.Collection;
import java.util.Properties; import java.util.Properties;
import com.metaweb.gridworks.browsing.RowFilter;
import com.metaweb.gridworks.expr.Evaluable; import com.metaweb.gridworks.expr.Evaluable;
import com.metaweb.gridworks.expr.ExpressionUtils; import com.metaweb.gridworks.expr.ExpressionUtils;
import com.metaweb.gridworks.model.Cell; import com.metaweb.gridworks.model.Cell;

View File

@ -3,6 +3,7 @@ package com.metaweb.gridworks.browsing.filters;
import java.util.Collection; import java.util.Collection;
import java.util.Properties; import java.util.Properties;
import com.metaweb.gridworks.browsing.RowFilter;
import com.metaweb.gridworks.expr.Evaluable; import com.metaweb.gridworks.expr.Evaluable;
import com.metaweb.gridworks.expr.ExpressionUtils; import com.metaweb.gridworks.expr.ExpressionUtils;
import com.metaweb.gridworks.model.Cell; import com.metaweb.gridworks.model.Cell;

View File

@ -2,6 +2,7 @@ package com.metaweb.gridworks.browsing.filters;
import java.util.Properties; import java.util.Properties;
import com.metaweb.gridworks.browsing.RowFilter;
import com.metaweb.gridworks.expr.Evaluable; import com.metaweb.gridworks.expr.Evaluable;
import com.metaweb.gridworks.expr.ExpressionUtils; import com.metaweb.gridworks.expr.ExpressionUtils;
import com.metaweb.gridworks.model.Cell; import com.metaweb.gridworks.model.Cell;

View File

@ -1,9 +1,11 @@
package com.metaweb.gridworks.browsing; package com.metaweb.gridworks.browsing.util;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import com.metaweb.gridworks.browsing.filters.RecordFilter; import com.metaweb.gridworks.browsing.FilteredRecords;
import com.metaweb.gridworks.browsing.RecordFilter;
import com.metaweb.gridworks.browsing.RecordVisitor;
import com.metaweb.gridworks.model.Project; import com.metaweb.gridworks.model.Project;
import com.metaweb.gridworks.model.Record; import com.metaweb.gridworks.model.Record;

View File

@ -1,9 +1,11 @@
package com.metaweb.gridworks.browsing; package com.metaweb.gridworks.browsing.util;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import com.metaweb.gridworks.browsing.filters.RowFilter; import com.metaweb.gridworks.browsing.FilteredRows;
import com.metaweb.gridworks.browsing.RowFilter;
import com.metaweb.gridworks.browsing.RowVisitor;
import com.metaweb.gridworks.model.Project; import com.metaweb.gridworks.model.Project;
import com.metaweb.gridworks.model.Row; import com.metaweb.gridworks.model.Row;

View File

@ -1,4 +1,4 @@
package com.metaweb.gridworks.browsing.facets; package com.metaweb.gridworks.browsing.util;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
@ -8,6 +8,7 @@ import java.util.Properties;
import com.metaweb.gridworks.browsing.DecoratedValue; import com.metaweb.gridworks.browsing.DecoratedValue;
import com.metaweb.gridworks.browsing.RecordVisitor; import com.metaweb.gridworks.browsing.RecordVisitor;
import com.metaweb.gridworks.browsing.RowVisitor; import com.metaweb.gridworks.browsing.RowVisitor;
import com.metaweb.gridworks.browsing.facets.NominalFacetChoice;
import com.metaweb.gridworks.expr.Evaluable; import com.metaweb.gridworks.expr.Evaluable;
import com.metaweb.gridworks.expr.ExpressionUtils; import com.metaweb.gridworks.expr.ExpressionUtils;
import com.metaweb.gridworks.model.Cell; import com.metaweb.gridworks.model.Cell;
@ -16,10 +17,10 @@ import com.metaweb.gridworks.model.Record;
import com.metaweb.gridworks.model.Row; import com.metaweb.gridworks.model.Row;
/** /**
* Visit matched rows and group them into facet choices based on the values computed * Visit matched rows or records and group them into facet choices based on the values computed
* from a given expression. * from a given expression.
*/ */
public class ExpressionNominalRowGrouper implements RowVisitor, RecordVisitor { public class ExpressionNominalValueGrouper implements RowVisitor, RecordVisitor {
static public class IndexedNominalFacetChoice extends NominalFacetChoice { static public class IndexedNominalFacetChoice extends NominalFacetChoice {
int _latestIndex; int _latestIndex;
@ -42,10 +43,14 @@ public class ExpressionNominalRowGrouper implements RowVisitor, RecordVisitor {
final public Map<Object, IndexedNominalFacetChoice> choices = new HashMap<Object, IndexedNominalFacetChoice>(); final public Map<Object, IndexedNominalFacetChoice> choices = new HashMap<Object, IndexedNominalFacetChoice>();
public int blankCount = 0; public int blankCount = 0;
public int errorCount = 0; public int errorCount = 0;
/*
* Scratch pad variables
*/
protected boolean hasBlank; protected boolean hasBlank;
protected boolean hasError; protected boolean hasError;
public ExpressionNominalRowGrouper(Evaluable evaluable, String columnName, int cellIndex) { public ExpressionNominalValueGrouper(Evaluable evaluable, String columnName, int cellIndex) {
_evaluable = evaluable; _evaluable = evaluable;
_columnName = columnName; _columnName = columnName;
_cellIndex = cellIndex; _cellIndex = cellIndex;

View File

@ -1,4 +1,4 @@
package com.metaweb.gridworks.browsing.facets; package com.metaweb.gridworks.browsing.util;
import java.util.Collection; import java.util.Collection;
import java.util.Properties; import java.util.Properties;
@ -13,10 +13,10 @@ import com.metaweb.gridworks.model.Record;
import com.metaweb.gridworks.model.Row; import com.metaweb.gridworks.model.Row;
/** /**
* Visit matched rows and slot them into bins based on the numbers computed * Visit matched rows or records and slot them into bins based on the numbers computed
* from a given expression. * from a given expression.
*/ */
public class ExpressionNumericRowBinner implements RowVisitor, RecordVisitor { public class ExpressionNumericValueBinner implements RowVisitor, RecordVisitor {
/* /*
* Configuration * Configuration
*/ */
@ -42,7 +42,7 @@ public class ExpressionNumericRowBinner implements RowVisitor, RecordVisitor {
protected boolean hasNumeric; protected boolean hasNumeric;
protected boolean hasNonNumeric; protected boolean hasNonNumeric;
public ExpressionNumericRowBinner(Evaluable evaluable, String columnName, int cellIndex, NumericBinIndex index) { public ExpressionNumericValueBinner(Evaluable evaluable, String columnName, int cellIndex, NumericBinIndex index) {
_evaluable = evaluable; _evaluable = evaluable;
_columnName = columnName; _columnName = columnName;
_cellIndex = cellIndex; _cellIndex = cellIndex;

View File

@ -1,5 +1,8 @@
package com.metaweb.gridworks.browsing; package com.metaweb.gridworks.browsing.util;
import com.metaweb.gridworks.browsing.FilteredRecords;
import com.metaweb.gridworks.browsing.FilteredRows;
import com.metaweb.gridworks.browsing.RowVisitor;
import com.metaweb.gridworks.model.Project; import com.metaweb.gridworks.model.Project;
public class FilteredRecordsAsFilteredRows implements FilteredRows { public class FilteredRecordsAsFilteredRows implements FilteredRows {

View File

@ -1,4 +1,4 @@
package com.metaweb.gridworks.browsing.facets; package com.metaweb.gridworks.browsing.util;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;

View File

@ -1,4 +1,4 @@
package com.metaweb.gridworks.browsing.facets; package com.metaweb.gridworks.browsing.util;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;

View File

@ -1,4 +1,4 @@
package com.metaweb.gridworks.browsing.facets; package com.metaweb.gridworks.browsing.util;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;

View File

@ -1,5 +1,7 @@
package com.metaweb.gridworks.browsing; package com.metaweb.gridworks.browsing.util;
import com.metaweb.gridworks.browsing.RecordVisitor;
import com.metaweb.gridworks.browsing.RowVisitor;
import com.metaweb.gridworks.model.Project; import com.metaweb.gridworks.model.Project;
import com.metaweb.gridworks.model.Record; import com.metaweb.gridworks.model.Record;

View File

@ -18,9 +18,9 @@ import org.slf4j.LoggerFactory;
import com.metaweb.gridworks.browsing.Engine; import com.metaweb.gridworks.browsing.Engine;
import com.metaweb.gridworks.browsing.FilteredRows; import com.metaweb.gridworks.browsing.FilteredRows;
import com.metaweb.gridworks.browsing.facets.NumericBinIndex;
import com.metaweb.gridworks.browsing.facets.ScatterplotDrawingRowVisitor; import com.metaweb.gridworks.browsing.facets.ScatterplotDrawingRowVisitor;
import com.metaweb.gridworks.browsing.facets.ScatterplotFacet; import com.metaweb.gridworks.browsing.facets.ScatterplotFacet;
import com.metaweb.gridworks.browsing.util.NumericBinIndex;
import com.metaweb.gridworks.commands.Command; import com.metaweb.gridworks.commands.Command;
import com.metaweb.gridworks.expr.Evaluable; import com.metaweb.gridworks.expr.Evaluable;
import com.metaweb.gridworks.expr.MetaParser; import com.metaweb.gridworks.expr.MetaParser;

View File

@ -9,8 +9,8 @@ import javax.servlet.http.HttpServletResponse;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONWriter; import org.json.JSONWriter;
import com.metaweb.gridworks.browsing.facets.NumericBinIndex; import com.metaweb.gridworks.browsing.util.NumericBinIndex;
import com.metaweb.gridworks.browsing.facets.NumericBinRowIndex; import com.metaweb.gridworks.browsing.util.NumericBinRowIndex;
import com.metaweb.gridworks.commands.Command; import com.metaweb.gridworks.commands.Command;
import com.metaweb.gridworks.expr.Evaluable; import com.metaweb.gridworks.expr.Evaluable;
import com.metaweb.gridworks.expr.MetaParser; import com.metaweb.gridworks.expr.MetaParser;