Example usage for org.apache.commons.math3.exception MathArithmeticException getLocalizedMessage

List of usage examples for org.apache.commons.math3.exception MathArithmeticException getLocalizedMessage

Introduction

In this page you can find the example usage for org.apache.commons.math3.exception MathArithmeticException getLocalizedMessage.

Prototype

@Override
public String getLocalizedMessage() 

Source Link

Usage

From source file:controller.CLI.java

private String pivot(int e, int l, boolean dual) {
    try {/*from ww  w  .  j  a  va2 s . c  o  m*/
        LP lp;
        if (e == -1 && l == -1)
            lp = lps.get(p - 1).pivot(dual);
        else if (dual)
            lp = lps.get(p - 1).pivot(l, e);
        else
            lp = lps.get(p - 1).pivot(e, l);

        lps.add(p++, lp);
        redo = 0;

        if (dual)
            return Output.dual(lp, stdPrec);
        return Output.primal(lp, stdPrec);
    } catch (MathArithmeticException err) {
        return "Invalid pivot";
    } catch (RuntimeException err) {
        return err.getLocalizedMessage();
    }
}