Package com.google.refine.model

Examples of com.google.refine.model.Row


    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);
        }
View Full Code Here


                    headerLines--;
                    if (headerLines == 0) {
                        ImporterUtilities.setupColumns(project, columnNames);
                    }
                } else { // data lines
                    Row row = new Row(columnNames.size());
                   
                    if (storeBlankRows) {
                        rowsWithData++;
                    } else if (cells.size() > 0) {
                        rowsWithData++;
                    }
                   
                    if (skipDataLines <= 0 || rowsWithData > skipDataLines) {
                        boolean rowHasData = false;
                        for (int c = 0; c < cells.size(); c++) {
                            Column column = ImporterUtilities.getOrAllocateColumn(
                                project, columnNames, c, hasOurOwnColumnNames);
                           
                            Object value = cells.get(c);
                            if (value instanceof Cell) {
                                row.setCell(column.getCellIndex(), (Cell) value);
                                rowHasData = true;
                            } else if (ExpressionUtils.isNonBlankData(value)) {
                                Serializable storedValue;
                                if (value instanceof String) {
                                    storedValue = guessCellValueTypes ?
                                        ImporterUtilities.parseCellValue((String) value) : (String) value;
                                } else {
                                    storedValue = ExpressionUtils.wrapStorable(value);
                                }
                               
                                row.setCell(column.getCellIndex(), new Cell(storedValue, null));
                                rowHasData = true;
                            } else if (!storeBlankCellsAsNulls) {
                                row.setCell(column.getCellIndex(), new Cell("", null));
                            } else {
                                row.setCell(column.getCellIndex(), null);
                            }
                        }
                       
                        if (rowHasData || storeBlankRows) {
                            if (includeFileSources) {
                                row.setCell(
                                    project.columnModel.getColumnByName(fileNameColumnName).getCellIndex(),
                                    new Cell(fileSource, null));
                            }
                            project.rows.add(row);
                        }
View Full Code Here

        this.newStarred = newStarred;
    }

    @Override
    public void apply(Project project) {
        Row row = project.rows.get(rowIndex);
        if (oldStarred == null) {
            oldStarred = row.starred;
        }
        row.starred = newStarred;
    }
View Full Code Here

        row.starred = newStarred;
    }

    @Override
    public void revert(Project project) {
        Row row = project.rows.get(rowIndex);
       
        row.starred = oldStarred;
    }
View Full Code Here

        protected boolean internalVisit(Project project, Record record) {
            options.put("recordIndex", record.recordIndex);
           
            for (int r = record.fromRowIndex; r < record.toRowIndex; r++) {
                try {
                    Row row = project.rows.get(r);
                   
                    options.put("rowIndex", r);
                   
                    row.write(writer, options);
                   
                } catch (JSONException e) {
                }
               
                options.remove("recordIndex");
View Full Code Here

    @Override
    public void revert(Project project) {
        synchronized (project) {
            for (CellAtRow cell : _newCells) {
                Row row = project.rows.get(cell.row);
                row.setCell(_newCellIndex, null);
            }
           
            project.columnModel.columns.remove(_columnIndex);
           
            project.columnModel.columnGroups.clear();
View Full Code Here

           
            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--;
            }
           
View Full Code Here

        synchronized (project) {
            int count = _rowIndices.size();
           
            for (int i = 0; i < count; i++) {
                int index = _rowIndices.get(i);
                Row row = _rows.get(i);
               
                project.rows.add(index, row);
            }
           
            project.update();
View Full Code Here

        hasBlank = false;

        Properties bindings = ExpressionUtils.createBindings(project);

        for (int r = record.fromRowIndex; r < record.toRowIndex; r++) {
            Row row = project.rows.get(r);
            visitRow(project, r, row, bindings, record.recordIndex);
        }

        if (hasError) {
            errorCount++;
View Full Code Here

            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();
View Full Code Here

TOP

Related Classes of com.google.refine.model.Row

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.