Examples of ErrorFatal


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

        if (x.op == ExprQt.Op.NO)   return enumerate(null, 0, x, x.sub,       0) == 0;
        if (x.op == ExprQt.Op.SOME) return enumerate(null, 0, x, x.sub,       0) >= 1;
        if (x.op == ExprQt.Op.LONE) return enumerate(null, 0, x, x.sub,       0) <= 1;
        if (x.op == ExprQt.Op.ONEreturn enumerate(null, 0, x, x.sub,       0) == 1;
        if (x.op == ExprQt.Op.SUMreturn trunc(enumerate(null, 0, x, x.sub, 0));
        throw new ErrorFatal(x.pos, "Unsupported operator ("+x.op+") encountered during ExprQt.accept()");
    }
View Full Code Here

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

        try {
            for(XMLNode sub:tuple) if (sub.is("atom")) {
                Tuple x = factory.tuple(sub.getAttribute("label"));
                if (ans==null) ans=x; else ans=ans.product(x);
            }
            if (ans==null) throw new ErrorFatal("Expecting: <tuple> <atom label=\"..\"/> .. </tuple>");
            if (ans.arity()!=arity) throw new ErrorFatal("Expecting: tuple of arity "+arity+" but got tuple of arity "+ans.arity());
            return ans;
        } catch(Throwable ex) {
            throw new ErrorFatal("Expecting: <tuple> <atom label=\"..\"/> .. </tuple>", ex);
        }
    }
View Full Code Here

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

       try {
          if (sigs == null) sigs = new ArrayList<Sig>();
          A4SolutionReader x = new A4SolutionReader(sigs, xml);
          return x.sol;
       } catch(Throwable ex) {
          if (ex instanceof Err) throw ((Err)ex); else throw new ErrorFatal("Fatal error occured: "+ex, ex);
       }
    }
View Full Code Here

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

            if (opt.solverDirectory.length()>0 && ext.indexOf(File.separatorChar)<0) ext=opt.solverDirectory+File.separatorChar+ext;
            try {
                File tmp = File.createTempFile("tmp", ".cnf", new File(opt.tempDirectory));
                tmp.deleteOnExit();
                solver.options().setSolver(SATFactory.externalFactory(ext, tmp.getAbsolutePath(), "", opt.solver.options()));
            } catch(IOException ex) { throw new ErrorFatal("Cannot create temporary directory.", ex); }
        } else if (opt.solver.equals(A4Options.SatSolver.ZChaffJNI)) {
            solver.options().setSolver(SATFactory.ZChaff);
        } else if (opt.solver.equals(A4Options.SatSolver.MiniSatJNI)) {
            solver.options().setSolver(SATFactory.MiniSat);
        } else if (opt.solver.equals(A4Options.SatSolver.MiniSatProverJNI)) {
View Full Code Here

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

     * @param label - the label for the new relation; need not be unique
     * @param lower - the lowerbound; can be null if you want it to be the empty set
     * @param upper - the upperbound; cannot be null; must contain everything in lowerbound
     */
    Relation addRel(String label, TupleSet lower, TupleSet upper) throws ErrorFatal {
       if (solved) throw new ErrorFatal("Cannot add a Kodkod relation since solve() has completed.");
       Relation rel = Relation.nary(label, upper.arity());
       if (lower == upper) {
          bounds.boundExactly(rel, upper);
       } else if (lower == null) {
          bounds.bound(rel, upper);
       } else {
          if (lower.arity() != upper.arity()) throw new ErrorFatal("Relation "+label+" must have same arity for lowerbound and upperbound.");
          bounds.bound(rel, lower, upper);
       }
       return rel;
    }
View Full Code Here

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

    /** Add a new sig to this solution and associate it with the given expression (and if s.isTopLevel then add this expression into Sig.UNIV).
     * <br> The expression must contain only constant Relations or Relations that are already bound in this solution.
     * <br> (If the sig was already added by a previous call to addSig(), then this call will return immediately without altering what it is associated with)
     */
    void addSig(Sig s, Expression expr) throws ErrorFatal {
       if (solved) throw new ErrorFatal("Cannot add an additional sig since solve() has completed.");
       if (expr.arity()!=1) throw new ErrorFatal("Sig "+s+" must be associated with a unary relational value.");
       if (a2k.containsKey(s)) return;
       a2k.put(s, expr);
       sigs.add(s);
       if (s.isTopLevel()) a2k.put(UNIV, a2k.get(UNIV).union(expr));
    }
View Full Code Here

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

    /** Add a new field to this solution and associate it with the given expression.
     * <br> The expression must contain only constant Relations or Relations that are already bound in this solution.
     * <br> (If the field was already added by a previous call to addField(), then this call will return immediately without altering what it is associated with)
     */
    void addField(Field f, Expression expr) throws ErrorFatal {
       if (solved) throw new ErrorFatal("Cannot add an additional field since solve() has completed.");
       if (expr.arity()!=f.type().arity()) throw new ErrorFatal("Field "+f+" must be associated with an "+f.type().arity()+"-ary relational value.");
       if (a2k.containsKey(f)) return;
       a2k.put(f, expr);
    }
View Full Code Here

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

    /** Add a new skolem to this solution and associate it with the given expression.
     * <br> The expression must contain only constant Relations or Relations that are already bound in this solution.
     */
    private ExprVar addSkolem(String label, Type type, Expression expr) throws Err {
       if (solved) throw new ErrorFatal("Cannot add an additional skolem since solve() has completed.");
       int a = type.arity();
       if (a<1) throw new ErrorFatal("Skolem "+label+" must be associated with a relational value.");
       if (a!=expr.arity()) throw new ErrorFatal("Skolem "+label+" must be associated with an "+a+"-ary relational value.");
       ExprVar v = ExprVar.make(Pos.UNKNOWN, label, type);
       a2k.put(v, expr);
       skolems.add(v);
       return v;
    }
View Full Code Here

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

             TupleSet right = query(findUpper, b.right(), false);
             left.addAll(right);
             return left;
          }
       }
       throw new ErrorFatal("Unknown expression encountered during bounds computation: "+expr);
    }
View Full Code Here

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

       throw new ErrorFatal("Unknown expression encountered during bounds computation: "+expr);
    }

    /** Shrink the bounds for the given relation; throws an exception if the new bounds is not sameAs/subsetOf the old bounds. */
    void shrink(Relation relation, TupleSet lowerBound, TupleSet upperBound) throws Err {
       if (solved) throw new ErrorFatal("Cannot shrink a Kodkod relation since solve() has completed.");
       TupleSet oldL = bounds.lowerBound(relation);
       TupleSet oldU = bounds.upperBound(relation);
       if (oldU.containsAll(upperBound) && upperBound.containsAll(lowerBound) && lowerBound.containsAll(oldL)) {
          bounds.bound(relation, lowerBound, upperBound);
       } else {
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.