Examples of ErrorAPI


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

    /** If this solution is UNSAT, return itself; else return the next solution (which could be SAT or UNSAT).
     * @throws ErrorAPI if the solver was not an incremental solver
     */
    public A4Solution next() throws Err {
        if (!solved) throw new ErrorAPI("This solution is not yet solved, so next() is not allowed.");
        if (eval==null) return this;
        if (nextCache==null) nextCache=new A4Solution(this);
        return nextCache;
    }
View Full Code Here

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

        out.print("\n</instance>\n");
    }

    /** If this solution is a satisfiable solution, this method will write it out in XML format. */
    static void writeInstance(A4Reporter rep, A4Solution sol, PrintWriter out, Iterable<Func> extraSkolems, Map<String,String> sources) throws Err {
        if (!sol.satisfiable()) throw new ErrorAPI("This solution is unsatisfiable.");
        try {
            Util.encodeXMLs(out, "<alloy builddate=\"", Version.buildDate(), "\">\n\n");
            new A4SolutionWriter(rep, sol, sol.getAllReachableSigs(), sol.getBitwidth(), sol.getMaxSeq(), sol.getOriginalCommand(), sol.getOriginalFilename(), out, extraSkolems);
            if (sources!=null) for(Map.Entry<String,String> e: sources.entrySet()) {
                Util.encodeXMLs(out, "\n<source filename=\"", e.getKey(), "\" content=\"", e.getValue(), "\"/>\n");
View Full Code Here

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

            for(int i=0; i<this.options.length; i++) this.options[i] = options[i];
            if (add) { synchronized(SatSolver.class) { values.add(this); } }
        }
        /** Constructs a new SatSolver value that uses a command-line solver; throws ErrorAPI if the ID is already in use. */
        public static SatSolver make(String id, String toString, String external, String[] options) throws ErrorAPI {
            if (id==null || toString==null || external==null) throw new ErrorAPI("NullPointerException in SatSolver.make()");
            SatSolver ans = new SatSolver(id, toString, external, options, false);
            synchronized(SatSolver.class) {
               for(SatSolver x: values)
                  if (x.id.equals(id))
                     throw new ErrorAPI("The SatSolver id \""+id+"\" is already in use.");
               values.add(ans);
            }
            return ans;
        }
View Full Code Here

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

    /** Returns the number of tuples in this tuple set. */
    public int size() { return tuples.size(); }

    /** Construct a new tupleset as the product of this and that; this and that must be come from the same solution. */
    public A4TupleSet product(A4TupleSet that) throws ErrorAPI {
        if (sol != that.sol) throw new ErrorAPI("A4TupleSet.product() requires 2 tuplesets from the same A4Solution.");
        return new A4TupleSet(tuples.product(that.tuples), sol);
    }
View Full Code Here

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

    /** Construct a new tupleset as the union of this and that; this and that must be come from the same solution.
     * Note: if that==null, then the method returns this A4TupleSet as-is. */
    public A4TupleSet plus(A4TupleSet that) throws ErrorAPI {
        if (that==null) return this;
        if (sol != that.sol) throw new ErrorAPI("A4TupleSet.plus() requires 2 tuplesets from the same A4Solution.");
        if (arity() != that.arity()) throw new ErrorAPI("A4TupleSet.plus() requires 2 tuplesets with the same arity.");
        if (this==that || tuples.size()==0) return that; else if (that.tuples.size()==0) return this; // special short cut
        TupleSet ts = tuples.clone();
        ts.addAll(that.tuples);
        if (tuples.size()==ts.size()) return this;
        if (that.tuples.size()==ts.size()) return that;
View Full Code Here

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

    /** Construct a new tupleset as the subtraction of this and that; this and that must be come from the same solution.
     * Note: if that==null, then the method returns this A4TupleSet as-is. */
    public A4TupleSet minus(A4TupleSet that) throws ErrorAPI {
        if (that==null) return this;
        if (sol != that.sol) throw new ErrorAPI("A4TupleSet.minus() requires 2 tuplesets from the same A4Solution.");
        if (arity() != that.arity()) throw new ErrorAPI("A4TupleSet.minus() requires 2 tuplesets with the same arity.");
        if (tuples.size()==0 || that.tuples.size()==0) return this; // special short cut
        TupleSet ts = tuples.clone();
        ts.removeAll(that.tuples);
        if (tuples.size()!=ts.size()) return new A4TupleSet(ts, sol); else return this;
    }
View Full Code Here

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

        if (tuples.size()!=ts.size()) return new A4TupleSet(ts, sol); else return this;
    }

    /** Construct a new tupleset as the intersection of this and that; this and that must be come from the same solution. */
    public A4TupleSet intersect(A4TupleSet that) throws ErrorAPI {
        if (sol != that.sol) throw new ErrorAPI("A4TupleSet.intersect() requires 2 tuplesets from the same A4Solution.");
        if (arity() != that.arity()) throw new ErrorAPI("A4TupleSet.intersect() requires 2 tuplesets with the same arity.");
        if (this.tuples.size()==0) return this; // special short cut
        if (that.tuples.size()==0) return that; // special short cut
        TupleSet ts = tuples.clone();
        ts.retainAll(that.tuples);
        if (tuples.size()!=ts.size()) return new A4TupleSet(ts, sol); else return this;
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.