コード例 #1
0
 private void handleFailure(final Result<? extends MpsatSynthesisChainResult> result) {
   String errorMessage = "Error: MPSat synthesis failed.";
   Throwable genericCause = result.getCause();
   if (genericCause != null) {
     // Exception was thrown somewhere in the chain task run() method (not in any of the subtasks)
     errorMessage += ERROR_CAUSE_PREFIX + genericCause.toString();
   } else {
     MpsatSynthesisChainResult returnValue = result.getReturnValue();
     Result<? extends Object> exportResult =
         (returnValue == null) ? null : returnValue.getExportResult();
     Result<? extends ExternalProcessResult> punfResult =
         (returnValue == null) ? null : returnValue.getPunfResult();
     Result<? extends ExternalProcessResult> mpsatResult =
         (returnValue == null) ? null : returnValue.getMpsatResult();
     if ((exportResult != null) && (exportResult.getOutcome() == Outcome.FAILED)) {
       errorMessage += "\n\nCould not export the model as a .g file.";
       Throwable exportCause = exportResult.getCause();
       if (exportCause != null) {
         errorMessage += ERROR_CAUSE_PREFIX + exportCause.toString();
       }
     } else if ((punfResult != null) && (punfResult.getOutcome() == Outcome.FAILED)) {
       errorMessage += "\n\nPunf could not build the unfolding prefix.";
       Throwable punfCause = punfResult.getCause();
       if (punfCause != null) {
         errorMessage += ERROR_CAUSE_PREFIX + punfCause.toString();
       } else {
         ExternalProcessResult punfReturnValue = punfResult.getReturnValue();
         if (punfReturnValue != null) {
           errorMessage += ERROR_CAUSE_PREFIX + new String(punfReturnValue.getErrors());
         }
       }
     } else if ((mpsatResult != null) && (mpsatResult.getOutcome() == Outcome.FAILED)) {
       errorMessage += "\n\nMPSat did not execute as expected.";
       Throwable mpsatCause = mpsatResult.getCause();
       if (mpsatCause != null) {
         errorMessage += ERROR_CAUSE_PREFIX + mpsatCause.toString();
       } else {
         ExternalProcessResult mpsatReturnValue = mpsatResult.getReturnValue();
         if (mpsatReturnValue != null) {
           String mpsatError = new String(mpsatReturnValue.getErrors());
           errorMessage += ERROR_CAUSE_PREFIX + mpsatError;
         }
       }
     } else {
       errorMessage += "\n\nMPSat chain task returned failure status without further explanation.";
     }
   }
   MainWindow mainWindow = Framework.getInstance().getMainWindow();
   JOptionPane.showMessageDialog(mainWindow, errorMessage, TITLE, JOptionPane.ERROR_MESSAGE);
 }
コード例 #2
0
 @Override
 public void finished(
     final Result<? extends MpsatSynthesisChainResult> result, String description) {
   switch (result.getOutcome()) {
     case FINISHED:
       handleSuccess(result);
       break;
     case FAILED:
       handleFailure(result);
       break;
     default:
       break;
   }
 }