Search in sources :

Example 1 with Record

use of com.google.refine.model.Record in project OpenRefine by OpenRefine.

the class SortingRecordVisitor method end.

@Override
public void end(Project project) {
    _visitor.start(project);
    Collections.sort(_records, new Comparator<Record>() {

        Project project;

        Comparator<Record> init(Project project) {
            this.project = project;
            return this;
        }

        @Override
        public int compare(Record o1, Record o2) {
            return SortingRecordVisitor.this.compare(project, o1, o1.recordIndex, o2, o2.recordIndex);
        }
    }.init(project));
    for (Record record : _records) {
        _visitor.visit(project, record);
    }
    _visitor.end(project);
}
Also used : Project(com.google.refine.model.Project) Record(com.google.refine.model.Record) Comparator(java.util.Comparator)

Example 2 with Record

use of com.google.refine.model.Record in project OpenRefine by OpenRefine.

the class ConjunctiveFilteredRecords method accept.

@Override
public void accept(Project project, RecordVisitor visitor) {
    try {
        visitor.start(project);
        int c = project.recordModel.getRecordCount();
        for (int r = 0; r < c; r++) {
            Record record = project.recordModel.getRecord(r);
            if (matchRecord(project, record)) {
                if (visitor.visit(project, record)) {
                    return;
                }
            }
        }
    } finally {
        visitor.end(project);
    }
}
Also used : Record(com.google.refine.model.Record)

Example 3 with Record

use of com.google.refine.model.Record in project OpenRefine by OpenRefine.

the class NumericBinRecordIndex method iterate.

@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);
        preprocessing();
        for (int i = record.fromRowIndex; i < record.toRowIndex; i++) {
            Row row = project.rows.get(i);
            processRow(project, rowEvaluable, allValues, i, row, bindings);
        }
        postprocessing();
    }
}
Also used : Record(com.google.refine.model.Record) Row(com.google.refine.model.Row) Properties(java.util.Properties)

Example 4 with Record

use of com.google.refine.model.Record in project OpenRefine by OpenRefine.

the class TimeBinRecordIndex method iterate.

@Override
protected void iterate(Project project, RowEvaluable rowEvaluable, List<Long> allValues) {
    Properties bindings = ExpressionUtils.createBindings(project);
    int count = project.recordModel.getRecordCount();
    for (int r = 0; r < count; 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);
        }
        postprocessing();
    }
}
Also used : Record(com.google.refine.model.Record) Row(com.google.refine.model.Row) Properties(java.util.Properties)

Aggregations

Record (com.google.refine.model.Record)4 Row (com.google.refine.model.Row)2 Properties (java.util.Properties)2 Project (com.google.refine.model.Project)1 Comparator (java.util.Comparator)1