Search in sources :

Example 26 with Row

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

the class TemplatingExporterTests method CreateGrid.

protected void CreateGrid(int noOfRows, int noOfColumns) {
    CreateColumns(noOfColumns);
    for (int i = 0; i < noOfRows; i++) {
        Row row = new Row(noOfColumns);
        for (int j = 0; j < noOfColumns; j++) {
            row.cells.add(new Cell("row" + i + "cell" + j, null));
        }
        project.rows.add(row);
    }
}
Also used : Row(com.google.refine.model.Row) Cell(com.google.refine.model.Cell)

Example 27 with Row

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

the class TsvExporterTests method CreateGrid.

protected void CreateGrid(int noOfRows, int noOfColumns) {
    CreateColumns(noOfColumns);
    for (int i = 0; i < noOfRows; i++) {
        Row row = new Row(noOfColumns);
        for (int j = 0; j < noOfColumns; j++) {
            row.cells.add(new Cell("row" + i + "cell" + j, null));
        }
        project.rows.add(row);
    }
}
Also used : Row(com.google.refine.model.Row) Cell(com.google.refine.model.Cell)

Example 28 with Row

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

the class RowRemovalChange method apply.

@Override
public void apply(Project project) {
    synchronized (project) {
        int count = _rowIndices.size();
        _rows = new ArrayList<Row>(count);
        int offset = 0;
        for (int i = 0; i < count; i++) {
            int index = _rowIndices.get(i);
            Row row = project.rows.remove(index + offset);
            _rows.add(row);
            offset--;
        }
        project.columnModel.clearPrecomputes();
        ProjectManager.singleton.getInterProjectModel().flushJoinsInvolvingProject(project.id);
        project.update();
    }
}
Also used : Row(com.google.refine.model.Row)

Example 29 with Row

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

the class RowStarChange method revert.

@Override
public void revert(Project project) {
    Row row = project.rows.get(rowIndex);
    row.starred = oldStarred;
}
Also used : Row(com.google.refine.model.Row)

Example 30 with Row

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

the class ImporterUtilitiesTests method ensureColumnsInRowExistDoesExpand.

@Test
public void ensureColumnsInRowExistDoesExpand() {
    Row row = new Row(4);
    for (int i = 1; i < 5; i++) {
        row.cells.add(new Cell("value" + i, null));
    }
    ArrayList<String> columnNames = new ArrayList<String>(2);
    ImporterUtilities.ensureColumnsInRowExist(columnNames, row);
    Assert.assertEquals(row.cells.size(), 4);
    Assert.assertEquals(columnNames.size(), 4);
}
Also used : ArrayList(java.util.ArrayList) Row(com.google.refine.model.Row) Cell(com.google.refine.model.Cell) Test(org.testng.annotations.Test) BeforeTest(org.testng.annotations.BeforeTest) RefineTest(com.google.refine.tests.RefineTest)

Aggregations

Row (com.google.refine.model.Row)88 Cell (com.google.refine.model.Cell)36 Test (org.testng.annotations.Test)29 BeforeTest (org.testng.annotations.BeforeTest)28 Column (com.google.refine.model.Column)25 RefineTest (com.google.refine.tests.RefineTest)17 Project (com.google.refine.model.Project)15 ArrayList (java.util.ArrayList)15 JSONObject (org.json.JSONObject)14 Properties (java.util.Properties)12 RowVisitor (com.google.refine.browsing.RowVisitor)8 Serializable (java.io.Serializable)8 JSONException (org.json.JSONException)8 HistoryEntry (com.google.refine.history.HistoryEntry)7 File (java.io.File)6 IOException (java.io.IOException)6 HashMap (java.util.HashMap)6 Evaluable (com.google.refine.expr.Evaluable)5 CellChange (com.google.refine.model.changes.CellChange)5 ColumnModel (com.google.refine.model.ColumnModel)4