Example #1
0
  @Override
  public void update(Cell changed) {
    if (!spreadSheet.getModified().contains(this)) {
      spreadSheet.getModified().add(this);
      setValue(new vInvalid(expression));

      for (Cell cell : referThis) cell.update(this);
    }
  }
Example #2
0
  public void setExpression(String expression) {
    if (expression.startsWith("=")) expression = expression.replaceFirst("=", "");
    for (CellImpl cell : thisRefer) {
      cell.referThis.remove(this);
    }
    this.thisRefer.clear();

    this.expression = expression;

    setValue(new vInvalid(expression));
    spreadSheet.getModified().add(this);

    for (Location location : SpreadsheetImpl.getReferredLocation(expression)) {
      CellImpl cell = spreadSheet.InsertCellIfNotExistAt(location);
      thisRefer.add(cell);
      cell.referThis.add(this);
    }

    for (Cell cell : referThis) cell.update(this);
  }