Examples of ErrorFatal


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

           if (!expr.errors.isEmpty()) throw expr.errors.pick();
           Object result = TranslateAlloyToKodkod.alloy2kodkod(this, expr);
           if (result instanceof IntExpression) return eval.evaluate((IntExpression)result);
           if (result instanceof Formula) return eval.evaluate((Formula)result);
           if (result instanceof Expression) return new A4TupleSet(eval.evaluate((Expression)result), this);
           throw new ErrorFatal("Unknown internal error encountered in the evaluator.");
        } catch(CapacityExceededException ex) {
           throw TranslateAlloyToKodkod.rethrow(ex);
        }
    }
View Full Code Here

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

    /** Maps a Kodkod formula to an Alloy Expr or Alloy Pos (or null if no such mapping) */
    Object k2pos(Node formula) { return k2pos.get(formula); }

    /** Associates the Kodkod formula to a particular Alloy Expr (if the Kodkod formula is not already associated with an Alloy Expr or Alloy Pos) */
    Formula k2pos(Formula formula, Expr expr) throws Err {
        if (solved) throw new ErrorFatal("Cannot alter the k->pos mapping since solve() has completed.");
        if (formula==null || expr==null || k2pos.containsKey(formula)) return formula;
        k2pos.put(formula, expr);
        if (formula instanceof BinaryFormula) {
            BinaryFormula b = (BinaryFormula)formula;
            if (b.op() == FormulaOperator.AND) { k2pos(b.left(), expr); k2pos(b.right(), expr); }
View Full Code Here

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

        return formula;
    }

    /** Associates the Kodkod formula to a particular Alloy Pos (if the Kodkod formula is not already associated with an Alloy Expr or Alloy Pos) */
    Formula k2pos(Formula formula, Pos pos) throws Err {
        if (solved) throw new ErrorFatal("Cannot alter the k->pos mapping since solve() has completed.");
        if (formula==null || pos==null || pos==Pos.UNKNOWN || k2pos.containsKey(formula)) return formula;
        k2pos.put(formula, pos);
        if (formula instanceof BinaryFormula) {
            BinaryFormula b = (BinaryFormula)formula;
            if (b.op() == FormulaOperator.AND) { k2pos(b.left(), pos); k2pos(b.right(), pos); }
View Full Code Here

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

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

    /** Associates the Kodkod relation to a particular Alloy Type (if it is not already associated with something) */
    void kr2type(Relation relation, Type newType) throws Err {
       if (solved) throw new ErrorFatal("Cannot alter the k->type mapping since solve() has completed.");
       if (!rel2type.containsKey(relation)) rel2type.put(relation, newType);
    }
View Full Code Here

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

       if (!rel2type.containsKey(relation)) rel2type.put(relation, newType);
    }

    /** Remove all mapping from Kodkod relation to Alloy Type. */
    void kr2typeCLEAR() throws Err {
       if (solved) throw new ErrorFatal("Cannot clear the k->type mapping since solve() has completed.");
       rel2type.clear();
    }
View Full Code Here

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

       return cachedPAIR;
    }

    /** Associates the Kodkod variable to a particular Alloy Type and Alloy Pos (if it is not already associated with something) */
    void kv2typepos(Variable var, Type type, Pos pos) throws Err {
       if (solved) throw new ErrorFatal("Cannot alter the k->type mapping since solve() has completed.");
       if (type==null) type=Type.EMPTY;
       if (pos==null) pos=Pos.UNKNOWN;
       if (!decl2type.containsKey(var)) decl2type.put(var, new Pair<Type,Pos>(type, pos));
    }
View Full Code Here

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

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

        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

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

    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

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

    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
TOP
Copyright © 2018 www.massapi.com. 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.