Correct error message if no equations are available in the TableDialog.

This commit is contained in:
hneemann 2017-03-13 15:05:14 +01:00
parent bf4b8c3976
commit 22b5e497f5
3 changed files with 14 additions and 1 deletions

View File

@ -595,13 +595,21 @@ public class TableDialog extends JDialog {
expressionListener = new ExpressionListenerJK(expressionListener);
lastGeneratedExpressions = new ExpressionListenerStore(expressionListener);
new ExpressionCreator(model.getTable(), minimizer).create(lastGeneratedExpressions);
final int numVars = model.getTable().getVars().size();
new ExpressionCreator(model.getTable(), getMinimizer(numVars)).create(lastGeneratedExpressions);
} catch (ExpressionException | FormatterException | AnalyseException e1) {
lastGeneratedExpressions = null;
new ErrorMessage(Lang.get("msg_errorDuringCalculation")).addCause(e1).show();
}
}
private MinimizerInterface getMinimizer(int size) {
if (size<=4)
return new MinimizerQuineMcCluskeyExam();
else
return minimizer;
}
private final class SizeAction extends AbstractAction {
private int n;
@ -680,6 +688,9 @@ public class TableDialog extends JDialog {
}
public void create(ExpressionListenerStore expressions) throws ExpressionException, FormatterException {
if (expressions==null)
throw new ExpressionException(Lang.get("err_noExpressionsAvailable"));
ExpressionListener el = new ExpressionListener() {
@Override
public void resultFound(String name, Expression expression) throws FormatterException, ExpressionException {

View File

@ -449,6 +449,7 @@ Es sind nur {1} Variablen erlaubt, es wurden jedoch {2} gefunden.</string>
<string name="err_processDoesNotTerminate_N">Der Prozess &quot;{0}&quot; wird nicht beendet!</string>
<string name="err_processExitedWithError_N1_N2">Der Prozess meldet den Rückgabewert {0}: {1}</string>
<string name="err_errorRunningFitter">Fehler beim Starten des externen Fitters!</string>
<string name="err_noExpressionsAvailable">Es liegen keine minimierten Gleichungen vor!</string>
<string name="key_AddrBits">Adress-Bits</string>
<string name="key_AddrBits_tt">Anzahl der Adress-Bits die verwendet werden.</string>

View File

@ -436,6 +436,7 @@ allowed are {1} variables but {2} are found.</string>
<string name="err_processDoesNotTerminate_N">The process &quot;{0}&quot; does not return!</string>
<string name="err_processExitedWithError_N1_N2">The process returns the non zero value {0}: {1}</string>
<string name="err_errorRunningFitter">Error starting the external fitter!</string>
<string name="err_noExpressionsAvailable">There are no minimized equations!</string>
<string name="key_AddrBits">Address Bits</string>
<string name="key_AddrBits_tt">Number of address bits used.</string>