Package edu.mit.csail.sdg.alloy4

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


          case CAST2INT:    return trunc(cset(x.sub).sum());
          case CLOSURE:     return cset(x.sub).closure();
          case RCLOSURE:    return cset(x.sub).closure().union(cset(ExprConstant.IDEN));
          case TRANSPOSE:   return cset(x.sub).transpose();
        }
        throw new ErrorFatal(x.pos, "Unsupported operator ("+x.op+") encountered during ExprUnary.accept()");
    }
View Full Code Here


    @Override public Object visit(ExprVar x) throws Err {
        Object ans = env.get(x);
        if (ans==null) ans = sfs.get(x);
        if (ans==null) {
            SimAtom a = SimAtom.make(x.label);
            if (!hasAtom(a)) throw new ErrorFatal(x.pos, "Variable \""+x+"\" is not bound to a legal value during translation.\n");
            ans = SimTupleset.make(SimTuple.make(a));
        }
        return ans;
    }
View Full Code Here

             cacheUNIV = cacheUNIV.union(visit(Sig.STRING));
          }
          return cacheUNIV;
       }
       Object ans = sfs.get(x);
       if (ans instanceof SimTupleset) return (SimTupleset)ans; else throw new ErrorFatal("Unknown sig "+x+" encountered during evaluation.");
    }
View Full Code Here

            }
            env = oldenv;
            return ans;
        }
        Object ans = sfs.get(x);
        if (ans instanceof SimTupleset) return (SimTupleset)ans; else throw new ErrorFatal("Unknown field "+x+" encountered during evaluation.");
    }
View Full Code Here

        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

        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

       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

            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

     * @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

    /** 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

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.