@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bundle extras = getIntent().getExtras();

    final Input input = (Input) extras.getSerializable(INPUT);

    try {
      this.expression = Expression.valueOf(input.getExpression());
      this.variable = new Constant(input.getVariableName());

      String title = extras.getString(ChartFactory.TITLE);
      if (title == null) {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
      } else if (title.length() > 0) {
        setTitle(title);
      }

      setContentView(R.layout.calc_plot_view);

      final Object lastNonConfigurationInstance = getLastNonConfigurationInstance();
      setGraphicalView(
          lastNonConfigurationInstance instanceof PlotBoundaries
              ? (PlotBoundaries) lastNonConfigurationInstance
              : null);

    } catch (ParseException e) {
      Toast.makeText(this, e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
      finish();
    } catch (ArithmeticException e) {
      Toast.makeText(this, e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
      finish();
    }
  }
 public CalculatorParseException(@NotNull jscl.text.ParseException jsclParseException) {
   this.message = jsclParseException;
   this.expression = jsclParseException.getExpression();
   this.position = jsclParseException.getPosition();
 }