Tabs to spaces.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@874 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-05-27 21:22:27 +00:00
parent 6409f1531c
commit 2f398cfeb3
8 changed files with 101 additions and 101 deletions

View File

@ -9,26 +9,26 @@ import com.metaweb.gridworks.model.Project;
import com.metaweb.gridworks.model.Row;
public class ExpressionBasedRowEvaluable implements RowEvaluable {
final protected String _columnName;
final protected int _cellIndex;
final protected Evaluable _eval;
public ExpressionBasedRowEvaluable(
String columnName, int cellIndex, Evaluable eval) {
_columnName = columnName;
_cellIndex = cellIndex;
_eval = eval;
}
final protected String _columnName;
final protected int _cellIndex;
final protected Evaluable _eval;
public ExpressionBasedRowEvaluable(
String columnName, int cellIndex, Evaluable eval) {
_columnName = columnName;
_cellIndex = cellIndex;
_eval = eval;
}
@Override
public Object eval(
Project project, int rowIndex, Row row, Properties bindings) {
@Override
public Object eval(
Project project, int rowIndex, Row row, Properties bindings) {
Cell cell = row.getCell(_cellIndex);
ExpressionUtils.bind(bindings, row, rowIndex, _columnName, cell);
return _eval.evaluate(bindings);
}
}
}

View File

@ -198,14 +198,14 @@ public class ExpressionNominalValueGrouper implements RowVisitor, RecordVisitor
return getChoiceValueCount(value);
}
public Integer getChoiceValueCount(Object choiceValue) {
if (ExpressionUtils.isError(choiceValue)) {
return errorCount;
} else if (ExpressionUtils.isNonBlankData(choiceValue)) {
IndexedNominalFacetChoice choice = choices.get(choiceValue);
return choice != null ? choice.count : 0;
} else {
return blankCount;
}
}
public Integer getChoiceValueCount(Object choiceValue) {
if (ExpressionUtils.isError(choiceValue)) {
return errorCount;
} else if (ExpressionUtils.isNonBlankData(choiceValue)) {
IndexedNominalFacetChoice choice = choices.get(choiceValue);
return choice != null ? choice.count : 0;
} else {
return blankCount;
}
}
}

View File

@ -6,15 +6,15 @@ import com.metaweb.gridworks.browsing.RowVisitor;
import com.metaweb.gridworks.model.Project;
public class FilteredRecordsAsFilteredRows implements FilteredRows {
final protected FilteredRecords _filteredRecords;
public FilteredRecordsAsFilteredRows(FilteredRecords filteredRecords) {
_filteredRecords = filteredRecords;
}
final protected FilteredRecords _filteredRecords;
public FilteredRecordsAsFilteredRows(FilteredRecords filteredRecords) {
_filteredRecords = filteredRecords;
}
@Override
public void accept(Project project, RowVisitor visitor) {
_filteredRecords.accept(project, new RowVisitorAsRecordVisitor(visitor));
}
@Override
public void accept(Project project, RowVisitor visitor) {
_filteredRecords.accept(project, new RowVisitorAsRecordVisitor(visitor));
}
}

View File

@ -21,12 +21,12 @@ import com.metaweb.gridworks.model.Row;
*/
abstract public class NumericBinIndex {
protected int _totalValueCount;
protected int _numbericValueCount;
protected double _min;
protected double _max;
protected double _step;
protected int[] _bins;
protected int _totalValueCount;
protected int _numbericValueCount;
protected double _min;
protected double _max;
protected double _step;
protected int[] _bins;
protected int _numericRowCount;
protected int _nonNumericRowCount;
@ -130,14 +130,14 @@ abstract public class NumericBinIndex {
return _errorRowCount;
}
protected void processRow(
Project project,
RowEvaluable rowEvaluable,
List<Double> allValues,
int rowIndex,
Row row,
Properties bindings
) {
protected void processRow(
Project project,
RowEvaluable rowEvaluable,
List<Double> allValues,
int rowIndex,
Row row,
Properties bindings
) {
Object value = rowEvaluable.eval(project, rowIndex, row, bindings);
if (ExpressionUtils.isError(value)) {
@ -191,16 +191,16 @@ abstract public class NumericBinIndex {
} else {
_hasBlank = true;
}
}
protected void preprocessing() {
_hasBlank = false;
_hasError = false;
_hasNonNumeric = false;
_hasNumeric = false;
}
protected void postprocessing() {
}
protected void preprocessing() {
_hasBlank = false;
_hasError = false;
_hasNonNumeric = false;
_hasNumeric = false;
}
protected void postprocessing() {
if (_hasError) {
_errorRowCount++;
}
@ -213,7 +213,7 @@ abstract public class NumericBinIndex {
if (_hasNonNumeric) {
_nonNumericRowCount++;
}
}
}
protected void processValue(double v, List<Double> allValues) {
if (!Double.isInfinite(v) && !Double.isNaN(v)) {

View File

@ -9,30 +9,30 @@ import com.metaweb.gridworks.model.Record;
import com.metaweb.gridworks.model.Row;
public class NumericBinRecordIndex extends NumericBinIndex {
public NumericBinRecordIndex(Project project, RowEvaluable rowEvaluable) {
super(project, rowEvaluable);
}
public NumericBinRecordIndex(Project project, RowEvaluable rowEvaluable) {
super(project, rowEvaluable);
}
@Override
protected void iterate(
Project project, RowEvaluable rowEvaluable, List<Double> allValues) {
@Override
protected void iterate(
Project project, RowEvaluable rowEvaluable, List<Double> allValues) {
Properties bindings = ExpressionUtils.createBindings(project);
int count = project.recordModel.getRecordCount();
for (int r = 0; r < count; r++) {
Record record = project.recordModel.getRecord(r);
Record record = project.recordModel.getRecord(r);
preprocessing();
for (int i = record.fromRowIndex; i < record.toRowIndex; i++) {
Row row = project.rows.get(i);
processRow(project, rowEvaluable, allValues, i, row, bindings);
}
for (int i = record.fromRowIndex; i < record.toRowIndex; i++) {
Row row = project.rows.get(i);
processRow(project, rowEvaluable, allValues, i, row, bindings);
}
postprocessing();
}
}
}
}

View File

@ -8,15 +8,15 @@ import com.metaweb.gridworks.model.Project;
import com.metaweb.gridworks.model.Row;
public class NumericBinRowIndex extends NumericBinIndex {
public NumericBinRowIndex(Project project, RowEvaluable rowEvaluable) {
super(project, rowEvaluable);
}
public NumericBinRowIndex(Project project, RowEvaluable rowEvaluable) {
super(project, rowEvaluable);
}
@Override
protected void iterate(
Project project, RowEvaluable rowEvaluable, List<Double> allValues) {
@Override
protected void iterate(
Project project, RowEvaluable rowEvaluable, List<Double> allValues) {
Properties bindings = ExpressionUtils.createBindings(project);
for (int i = 0; i < project.rows.size(); i++) {
@ -28,6 +28,6 @@ public class NumericBinRowIndex extends NumericBinIndex {
postprocessing();
}
}
}
}

View File

@ -6,5 +6,5 @@ import com.metaweb.gridworks.model.Project;
import com.metaweb.gridworks.model.Row;
public interface RowEvaluable {
public Object eval(Project project, int rowIndex, Row row, Properties bindings);
public Object eval(Project project, int rowIndex, Row row, Properties bindings);
}

View File

@ -6,29 +6,29 @@ import com.metaweb.gridworks.model.Project;
import com.metaweb.gridworks.model.Record;
public class RowVisitorAsRecordVisitor implements RecordVisitor {
final protected RowVisitor _rowVisitor;
public RowVisitorAsRecordVisitor(RowVisitor rowVisitor) {
_rowVisitor = rowVisitor;
}
final protected RowVisitor _rowVisitor;
public RowVisitorAsRecordVisitor(RowVisitor rowVisitor) {
_rowVisitor = rowVisitor;
}
@Override
public void start(Project project) {
_rowVisitor.start(project);
_rowVisitor.start(project);
}
@Override
public void end(Project project) {
_rowVisitor.end(project);
_rowVisitor.end(project);
}
@Override
public boolean visit(Project project, Record record) {
for (int r = record.fromRowIndex; r < record.toRowIndex; r++) {
if (_rowVisitor.visit(project, r, project.rows.get(r))) {
return true;
}
}
return false;
}
@Override
public boolean visit(Project project, Record record) {
for (int r = record.fromRowIndex; r < record.toRowIndex; r++) {
if (_rowVisitor.visit(project, r, project.rows.get(r))) {
return true;
}
}
return false;
}
}