public static boolean saveFormulaForUserBrickParameterChange() {
    InternFormulaParser formulaToParse = formulaEditorEditText.getFormulaParser();
    FormulaElement formulaParseTree = formulaToParse.parseFormula();

    switch (formulaToParse.getErrorTokenIndex()) {
      case PARSER_OK:
        currentFormula.setRoot(formulaParseTree);
        if (onFormulaChangedListener != null) {
          onFormulaChangedListener.onFormulaChanged(
              formulaBrick, currentBrickField, currentFormula);
        }
        if (formulaEditorBrick != null) {
          currentFormula.refreshTextField(brickView);
        }
        formulaEditorEditText.formulaSaved();
        return true;
    }
    return false;
  }
  public boolean saveFormulaIfPossible() {
    InternFormulaParser formulaToParse = formulaEditorEditText.getFormulaParser();
    FormulaElement formulaParseTree = formulaToParse.parseFormula();

    switch (formulaToParse.getErrorTokenIndex()) {
      case PARSER_OK:
        currentFormula.setRoot(formulaParseTree);
        if (onFormulaChangedListener != null) {
          onFormulaChangedListener.onFormulaChanged(
              formulaBrick, currentBrickField, currentFormula);
        }
        if (formulaEditorBrick != null) {
          currentFormula.refreshTextField(brickView);
        }
        formulaEditorEditText.formulaSaved();
        showToast(R.string.formula_editor_changes_saved, false);
        return true;
      case PARSER_STACK_OVERFLOW:
        return checkReturnWithoutSaving(PARSER_STACK_OVERFLOW);
      default:
        formulaEditorEditText.setParseErrorCursorAndSelection();
        return checkReturnWithoutSaving(PARSER_INPUT_SYNTAX_ERROR);
    }
  }