GeTeTaImporter.java 文件源码

java
阅读 29 收藏 0 点赞 0 评论 0

项目:stvs 作者:
/**
 * Builds a {@link VerificationResult} from a GeTeTa {@link Message}.
 *
 * @param source the original top-level XML node of the verification result
 * @param importedMessage the JAXB-converted GeTeTa {@link Message} object
 * @return the imported result
 * @throws ImportException if an error occurs while importing
 */
private VerificationResult makeVerificationResult(Node source, Message importedMessage)
    throws ImportException {
  try {
    /* Write log to file */
    File logFile = File.createTempFile("log-verification-", ".xml");
    TransformerFactory transformerFactory = TransformerFactory.newInstance();
    Transformer transformer = transformerFactory.newTransformer();
    DOMSource domSource = new DOMSource(source);
    StreamResult result = new StreamResult(logFile);
    transformer.transform(domSource, result);

    /* Return appropriate VerificationResult */
    switch (importedMessage.getReturncode()) {
      case RETURN_CODE_SUCCESS:
        return new VerificationSuccess(logFile);
      case RETURN_CODE_NOT_VERIFIED:
        return new edu.kit.iti.formal.stvs.model.verification.Counterexample(
            parseCounterexample(importedMessage), logFile);
      default:
        return new VerificationError(VerificationError.Reason.ERROR, logFile);
    }
  } catch (TransformerException | IOException exception) {
    throw new ImportException(exception);
  }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号