Package edu.mit.csail.sdg.alloy4

Examples of edu.mit.csail.sdg.alloy4.ErrorFatal


    //===================================================================================================//

    /** Add the given formula to the list of Kodkod formulas, and associate it with the given Pos object (pos can be null if unknown). */
    void addFormula(Formula newFormula, Pos pos) throws Err {
        if (solved) throw new ErrorFatal("Cannot add an additional formula since solve() has completed.");
        if (formulas.size()>0 && formulas.get(0)==Formula.FALSE) return; // If one formula is false, we don't need the others
        if (newFormula==Formula.FALSE) formulas.clear(); // If one formula is false, we don't need the others
        formulas.add(newFormula);
        if (pos!=null && pos!=Pos.UNKNOWN) k2pos(newFormula, pos);
    }
View Full Code Here


        if (pos!=null && pos!=Pos.UNKNOWN) k2pos(newFormula, pos);
    }

    /** Add the given formula to the list of Kodkod formulas, and associate it with the given Expr object (expr can be null if unknown) */
    void addFormula(Formula newFormula, Expr expr) throws Err {
        if (solved) throw new ErrorFatal("Cannot add an additional formula since solve() has completed.");
        if (formulas.size()>0 && formulas.get(0)==Formula.FALSE) return; // If one formula is false, we don't need the others
        if (newFormula==Formula.FALSE) formulas.clear(); // If one formula is false, we don't need the others
        formulas.add(newFormula);
        if (expr!=null) k2pos(newFormula, expr);
    }
View Full Code Here

    public void writeXML(String filename, Iterable<Func> macros, Map<String,String> sourceFiles) throws Err {
        PrintWriter out=null;
        try {
            out=new PrintWriter(filename,"UTF-8");
            writeXML(out, macros, sourceFiles);
            if (!Util.close(out)) throw new ErrorFatal("Error writing the solution XML file.");
        } catch(IOException ex) {
            Util.close(out);
            throw new ErrorFatal("Error writing the solution XML file.", ex);
        }
    }
View Full Code Here

    public void writeXML(A4Reporter rep, String filename, Iterable<Func> macros, Map<String,String> sourceFiles) throws Err {
        PrintWriter out=null;
        try {
            out=new PrintWriter(filename,"UTF-8");
            writeXML(rep, out, macros, sourceFiles);
            if (!Util.close(out)) throw new ErrorFatal("Error writing the solution XML file.");
        } catch(IOException ex) {
            Util.close(out);
            throw new ErrorFatal("Error writing the solution XML file.", ex);
        }
    }
View Full Code Here

    }

    /** Helper method to write out a full XML file. */
    public void writeXML(PrintWriter writer, Iterable<Func> macros, Map<String,String> sourceFiles) throws Err {
        A4SolutionWriter.writeInstance(null, this, writer, macros, sourceFiles);
        if (writer.checkError()) throw new ErrorFatal("Error writing the solution XML file.");
    }
View Full Code Here

    }

    /** Helper method to write out a full XML file. */
    public void writeXML(A4Reporter rep, PrintWriter writer, Iterable<Func> macros, Map<String,String> sourceFiles) throws Err {
        A4SolutionWriter.writeInstance(rep, this, writer, macros, sourceFiles);
        if (writer.checkError()) throw new ErrorFatal("Error writing the solution XML file.");
    }
View Full Code Here

          int lastSize = (-1);
          while(true) {
             A4TupleSet ts = (A4TupleSet)(sol.eval(expr.minus(sum)));
             int n = ts.size();
             if (n<=0) break;
             if (lastSize>0 && lastSize<=n) throw new ErrorFatal("An internal error occurred in the evaluator.");
             lastSize=n;
             Type extra = ts.iterator().next().type();
             type = type.merge(extra);
             sum = sum.plus(extra.toExpr());
          }
View Full Code Here

           if (sol!=null && x!=Sig.UNIV && x!=Sig.SIGINT && x!=Sig.SEQIDX) {
              ts = (A4TupleSet)(sol.eval(x));
              for(A4Tuple t: ts.minus(ts2))  Util.encodeXMLs(out, "   <atom label=\"", t.atom(0), "\"/>\n");
           }
       } catch(Throwable ex) {
           throw new ErrorFatal("Error evaluating sig " + x.label, ex);
       }
       if (x instanceof SubsetSig) for(Sig p:((SubsetSig)x).parents) Util.encodeXMLs(out, "   <type ID=\"", map(p), "\"/>\n");
       out.print("</sig>\n");
       for(Field field: x.getFields()) writeField(field);
       return ts;
View Full Code Here

          if (x.isMeta!=null) out.print("\" meta=\"yes");
          out.print("\">\n");
          writeExpr("", x);
          out.print("</field>\n");
       } catch(Throwable ex) {
          throw new ErrorFatal("Error evaluating field "+x.sig.label+"."+x.label, ex);
       }
    }
View Full Code Here

          if (x.type().hasNoTuple()) return;   // we do not allow "none" in the XML file's type declarations
          StringBuilder sb = new StringBuilder();
          Util.encodeXMLs(sb, "\n<skolem label=\"", x.label, "\" ID=\"", map(x), "\">\n");
          if (writeExpr(sb.toString(), x)) { out.print("</skolem>\n"); }
       } catch(Throwable ex) {
          throw new ErrorFatal("Error evaluating skolem "+x.label, ex);
       }
    }
View Full Code Here

TOP

Related Classes of edu.mit.csail.sdg.alloy4.ErrorFatal

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.