From e2d1f0af258ee9f3e0b26e31017247c5bc1c79cf Mon Sep 17 00:00:00 2001 From: Dave Parker Date: Wed, 29 Jul 2015 18:25:12 +0000 Subject: [PATCH] Bug fix in CNF conversion. git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@10461 bbc10eb1-c90d-0410-af57-cb519fbb1720 --- prism/src/parser/BooleanUtils.java | 4 ++-- prism/src/prism/Prism.java | 25 +------------------------ 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/prism/src/parser/BooleanUtils.java b/prism/src/parser/BooleanUtils.java index d70b35af..8d2109f2 100644 --- a/prism/src/parser/BooleanUtils.java +++ b/prism/src/parser/BooleanUtils.java @@ -309,8 +309,8 @@ public class BooleanUtils } return cnf; } - // Or - if (Expression.isOr(expr)) { + // And + if (Expression.isAnd(expr)) { Expression a = ((ExpressionBinaryOp) expr).getOperand1(); Expression b = ((ExpressionBinaryOp) expr).getOperand2(); List> aCnf = doConversionToCNF(a); diff --git a/prism/src/prism/Prism.java b/prism/src/prism/Prism.java index 4ce7050f..a03d0781 100644 --- a/prism/src/prism/Prism.java +++ b/prism/src/prism/Prism.java @@ -1424,30 +1424,7 @@ public class Prism extends PrismComponent implements PrismSettingsListener */ public ModulesFile importPepaString(String s) throws PrismException, PrismLangException { - File pepaFile = null; - String modelString; - - // create temporary file containing pepa model - try { - pepaFile = File.createTempFile("tempPepa" + System.currentTimeMillis(), ".pepa"); - FileWriter write = new FileWriter(pepaFile); - write.write(s); - write.close(); - } catch (IOException e) { - if (pepaFile != null) - pepaFile.delete(); - throw new PrismException("Couldn't create temporary file for PEPA conversion"); - } - - // compile pepa file to string - try { - modelString = pepa.compiler.Main.compile("" + pepaFile); - } catch (pepa.compiler.InternalError e) { - if (pepaFile != null) - pepaFile.delete(); - throw new PrismException("Could not import PEPA file:\n" + e.getMessage()); - } - + String prismModelString = new PrismLanguageImporter().convert("pepa", s); // parse string as prism model and return return parseModelString(modelString); }