use of jkind.api.results.JRealizabilityResult in project AGREE by loonwerks.
the class VerifyHandler method doAnalysis.
protected IStatus doAnalysis(final Element root, final IProgressMonitor globalMonitor) {
Thread analysisThread = new Thread() {
@Override
public void run() {
// Record the analysis start time and get model hashcode for
// saving to property analysis log, if necessary
String modelHash = "";
long startTime = 0;
if (Activator.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.PREF_PROP_LOG)) {
try {
modelHash = AgreeFileUtil.getModelHashcode(root);
startTime = System.currentTimeMillis();
} catch (Exception e) {
System.out.println(e.getMessage());
return;
}
}
try {
activateTerminateHandlers(globalMonitor);
KindApi api = PreferencesUtil.getKindApi();
KindApi consistApi = PreferencesUtil.getConsistencyApi();
JRealizabilityApi realApi = PreferencesUtil.getJRealizabilityApi();
while (!queue.isEmpty() && !globalMonitor.isCanceled()) {
JKindResult result = queue.peek();
NullProgressMonitor subMonitor = new NullProgressMonitor();
monitorRef.set(subMonitor);
Program program = linker.getProgram(result);
if (api instanceof JKindApi) {
String resultName = result.getName();
String adviceFileName = rerunAdviceMap.get(resultName);
if (adviceFileName == null) {
adviceFileName = "agree_advice" + adviceCount++;
rerunAdviceMap.put(resultName, adviceFileName);
} else {
((JKindApi) api).setReadAdviceFile(adviceFileName);
}
((JKindApi) api).setWriteAdviceFile(adviceFileName);
}
try {
if (result instanceof ConsistencyResult) {
consistApi.execute(program, result, subMonitor);
} else if (result instanceof JRealizabilityResult) {
realApi.execute(program, (JRealizabilityResult) result, subMonitor);
} else {
api.execute(program, result, subMonitor);
}
} catch (JKindException e) {
System.out.println("******** JKindException Text ********");
e.printStackTrace(System.out);
// System.out.println("******** JKind Output ********");
// System.out.println(result.getText());
// System.out.println("******** Agree Lustre ********");
// System.out.println(program);
String errStr = e.getMessage();
int l = Math.min(errStr.length(), 300);
System.out.println(e.getMessage().substring(0, l));
// >>>>>>> origin/develop
break;
}
// Print to property analysis log, if necessary
if (Activator.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.PREF_PROP_LOG)) {
AgreeFileUtil.printLog(result, startTime, modelHash);
}
queue.remove();
}
while (!queue.isEmpty()) {
queue.remove().cancel();
}
} finally {
deactivateTerminateHandlers();
enableRerunHandler(root);
}
}
};
analysisThread.start();
return Status.OK_STATUS;
}
use of jkind.api.results.JRealizabilityResult in project AGREE by loonwerks.
the class TestCaseGeneratorResultLabelProvider method getText.
@Override
public String getText(Object element) {
if (element instanceof PropertyResult) {
PropertyResult pr = (PropertyResult) element;
switch(column) {
case PROPERTY:
if (pr.getName().equals(Util.REALIZABLE)) {
return pr.getParent().getName();
} else {
return pr.getName();
}
case RESULT:
Status tcgStatus = StatusToTcgStatus.get(pr.getStatus());
String tcgStatusString = TcgStatusToTcgStatusString.get(tcgStatus);
switch(tcgStatus) {
case WAITING:
return tcgStatusString;
case WORKING:
return tcgStatusString + "..." + getProgress(pr) + " (" + pr.getElapsed() + "s)";
default:
return getFinalStatus(pr) + " (" + pr.getElapsed() + "s)";
}
}
} else if (element instanceof JRealizabilityResult) {
JRealizabilityResult result = (JRealizabilityResult) element;
return getText(result.getPropertyResult());
} else if (element instanceof AnalysisResult) {
AnalysisResult result = (AnalysisResult) element;
switch(column) {
case PROPERTY:
return result.getName();
case RESULT:
return TcgResultsUtil.getMultiStatus(result).toString();
}
}
return "";
}
Aggregations