Package com.google.refine.model

Examples of com.google.refine.model.Cell


                    _newRows.add(newRow);
                   
                    for (int c = 0; c < tuple.size(); c++) {
                        Serializable value = tuple.get(c);
                        if (value != null) {
                            newRow.setCell(_firstNewCellIndex + c, new Cell(value, null));
                        }
                    }
                   
                    if (_removeOriginalColumn) {
                        newRow.setCell(cellIndex, null);
View Full Code Here


            this.value = value;
        }

        @Override
        protected HistoryEntry createHistoryEntry(long historyEntryID) throws Exception {
            Cell cell = _project.rows.get(rowIndex).getCell(cellIndex);
            Column column = _project.columnModel.getColumnByCellIndex(cellIndex);
            if (column == null) {
                throw new Exception("No such column");
            }

            newCell = new Cell(
                value,
                cell != null ? cell.recon : null
            );

            String description =
View Full Code Here

            _oldCells = new CellAtRow[project.rows.size()];
            int cellIndex = _oldColumn.getCellIndex();
            for (int i = 0; i < _oldCells.length; i++) {
                Row row = project.rows.get(i);
               
                Cell oldCell = null;
                if (cellIndex < row.cells.size()) {
                    oldCell = row.cells.get(cellIndex);
                }
                _oldCells[i] = new CellAtRow(i, oldCell);
               
View Full Code Here

                    List<Object> cells = new ArrayList<Object>();
                    org.apache.poi.ss.usermodel.Row row = sheet.getRow(nextRow++);
                    if (row != null) {
                        short lastCell = row.getLastCellNum();
                        for (short cellIndex = 0; cellIndex < lastCell; cellIndex++) {
                            Cell cell = null;
                           
                            org.apache.poi.ss.usermodel.Cell sourceCell = row.getCell(cellIndex);
                            if (sourceCell != null) {
                                cell = extractCell(sourceCell, reconMap);
                            }
View Full Code Here

                       
                    }
                }
            }
           
            return new Cell(value, recon);
        } else {
            return null;
        }
    }
View Full Code Here

        synchronized (project) {
            for (int r = 0; r < project.rows.size(); r++) {
                Row row = project.rows.get(r);
               
                for (int c = 0; c < row.cells.size(); c++) {
                    Cell cell = row.cells.get(c);
                    if (cell != null && cell.recon != null) {
                        Recon recon = cell.recon;
                       
                        if (reconMap.containsKey(recon.id)) {
                            row.setCell(c, new Cell(cell.value, reconMap.get(recon.id)));
                        }
                    }
                }
            }
        }
View Full Code Here

                                }
                            }
                        }
                        return new CellAtRow(
                                urlData.row,
                                new Cell(
                                        ParsingUtilities.inputStreamToString(
                                                is, encoding != null ? encoding : "UTF-8"),
                                                null));

                    } finally {
                        is.close();
                    }
                } catch (IOException e) {
                    String message;
                    if (urlConnection instanceof HttpURLConnection) {
                        int status = ((HttpURLConnection)urlConnection).getResponseCode();
                        String errorString = "";
                        InputStream errorStream = ((HttpURLConnection)urlConnection).getErrorStream();
                        if (errorStream != null) {
                            errorString = ParsingUtilities.inputStreamToString(errorStream);
                        }
                        message = String.format("HTTP error %d : %s | %s",status,
                                ((HttpURLConnection)urlConnection).getResponseMessage(),
                                errorString);
                    } else {
                        message = e.toString();
                    }
                    return _onError == OnError.StoreError ?
                            new CellAtRow(urlData.row, new Cell(new EvalError(message), null)) : null;
                }
            } catch (Exception e) {
                return _onError == OnError.StoreError ?
                        new CellAtRow(urlData.row, new Cell(new EvalError(e.getMessage()), null)) : null;
            }
        }
View Full Code Here

                    // nothing to do
                }
               
                @Override
                public boolean visit(Project project, int rowIndex, Row row) {
                    Cell cell = row.getCell(cellIndex);
                    Cell newCell = null;
                   
                    ExpressionUtils.bind(bindings, row, rowIndex, _baseColumnName, cell);
                   
                    Object o = _eval.evaluate(bindings);
                    if (o != null) {
                        if (o instanceof Cell) {
                            newCell = (Cell) o;
                        } else if (o instanceof WrappedCell) {
                            newCell = ((WrappedCell) o).cell;
                        } else {
                            Serializable v = ExpressionUtils.wrapStorable(o);
                            if (ExpressionUtils.isNonBlankData(v)) {
                                newCell = new Cell(v.toString(), null);
                            }
                        }
                    }
                   
                    if (newCell != null) {
View Full Code Here

                // nothing to do
            }
           
            @Override
            public boolean visit(Project project, int rowIndex, Row row) {
                Cell cell = row.getCell(cellIndex);
                Cell newCell = null;

                ExpressionUtils.bind(bindings, row, rowIndex, _baseColumnName, cell);
               
                Object o = eval.evaluate(bindings);
                if (o != null) {
                    if (o instanceof Cell) {
                        newCell = (Cell) o;
                    } else if (o instanceof WrappedCell) {
                        newCell = ((WrappedCell) o).cell;
                    } else {
                        Serializable v = ExpressionUtils.wrapStorable(o);
                        if (ExpressionUtils.isError(v)) {
                            if (_onError == OnError.SetToBlank) {
                                return false;
                            } else if (_onError == OnError.KeepOriginal) {
                                v = cell != null ? cell.value : null;
                            }
                        }
                       
                        if (v != null) {
                            newCell = new Cell(v, null);
                        }
                    }
                }
               
                if (newCell != null) {
View Full Code Here

            }

            @Override
            public boolean visit(Project project, int rowIndex, Row row) {
                if (cellIndex < row.cells.size()) {
                    Cell cell = row.cells.get(cellIndex);
                    if (cell != null && cell.recon != null) {
                        ReconCandidate candidate = cell.recon.getBestCandidate();
                        if (candidate != null) {
                            Recon newRecon;
                            if (dupReconMap.containsKey(cell.recon.id)) {
                                newRecon = dupReconMap.get(cell.recon.id);
                                newRecon.judgmentBatchSize++;
                            } else {
                                newRecon = cell.recon.dup(historyEntryID);
                                newRecon.judgmentBatchSize = 1;
                                newRecon.match = candidate;
                                newRecon.matchRank = 0;
                                newRecon.judgment = Judgment.Matched;
                                newRecon.judgmentAction = "mass";
                               
                                dupReconMap.put(cell.recon.id, newRecon);
                            }
                            Cell newCell = new Cell(
                                cell.value,
                                newRecon
                            );
                           
                            CellChange cellChange = new CellChange(rowIndex, cellIndex, cell, newCell);
View Full Code Here

TOP

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

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.