Search in sources :

Example 1 with Row

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

the class XlsExporterTests 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 2 with Row

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

the class BooleanTests method SetUp.

@BeforeMethod
public void SetUp() throws IOException, ModelException {
    bindings = new Properties();
    File dir = TestUtils.createTempDirectory("openrefine-test-workspace-dir");
    FileProjectManager.initialize(dir);
    project = new Project();
    ProjectMetadata pm = new ProjectMetadata();
    pm.setName("TNG Test Project");
    ProjectManager.singleton.registerProject(project, pm);
    int index = project.columnModel.allocateNewCellIndex();
    Column column = new Column(index, "Column A");
    project.columnModel.addColumn(index, column, true);
    options = mock(Properties.class);
    bindings.put("project", project);
    // Five rows of a's and five of 1s
    for (int i = 0; i < 10; i++) {
        Row row = new Row(1);
        row.setCell(0, new Cell(i < 5 ? "a" : new Integer(1), null));
        project.rows.add(row);
    }
}
Also used : Project(com.google.refine.model.Project) Column(com.google.refine.model.Column) ProjectMetadata(com.google.refine.ProjectMetadata) Row(com.google.refine.model.Row) Properties(java.util.Properties) File(java.io.File) Cell(com.google.refine.model.Cell) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 3 with Row

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

the class RefineTest method log.

public void log(Project project) {
    // some quick and dirty debugging
    StringBuilder sb = new StringBuilder();
    for (Column c : project.columnModel.columns) {
        sb.append(c.getName());
        sb.append("; ");
    }
    logger.info(sb.toString());
    for (Row r : project.rows) {
        sb = new StringBuilder();
        for (int i = 0; i < r.cells.size(); i++) {
            Cell c = r.getCell(i);
            if (c != null) {
                sb.append(c.value);
                sb.append("; ");
            } else {
                sb.append("null; ");
            }
        }
        logger.info(sb.toString());
    }
}
Also used : Column(com.google.refine.model.Column) Row(com.google.refine.model.Row) Cell(com.google.refine.model.Cell)

Example 4 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 5 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)

Aggregations

Row (com.google.refine.model.Row)188 Test (org.testng.annotations.Test)97 BeforeTest (org.testng.annotations.BeforeTest)92 Cell (com.google.refine.model.Cell)82 RefineTest (com.google.refine.RefineTest)50 Column (com.google.refine.model.Column)38 Project (com.google.refine.model.Project)29 WrappedRow (com.google.refine.expr.WrappedRow)28 ArrayList (java.util.ArrayList)26 HasFieldsListImpl (com.google.refine.expr.HasFieldsListImpl)25 IOException (java.io.IOException)21 Properties (java.util.Properties)20 RefineTest (com.google.refine.tests.RefineTest)17 TreeReaderException (com.google.refine.importers.tree.TreeReaderException)12 UnsupportedEncodingException (java.io.UnsupportedEncodingException)12 XMLStreamException (javax.xml.stream.XMLStreamException)12 HashMap (java.util.HashMap)11 RowVisitor (com.google.refine.browsing.RowVisitor)10 File (java.io.File)9 Serializable (java.io.Serializable)9