Examples of ErrorType


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

        }
    }

    /** Construct a new simulation context with the given bitwidth and the given maximum sequence length. */
    public SimInstance(Module root, int bitwidth, int maxseq) throws Err {
        if (bitwidth<1 || bitwidth>32) throw new ErrorType("Bitwidth must be between 1 and 32.");
        this.root = root;
        this.bitwidth = bitwidth;
        this.maxseq = maxseq;
        this.callbacks = new HashMap<Func,SimCallback>();
        if (bitwidth==32) { max=Integer.MAX_VALUE; min=Integer.MIN_VALUE; } else { max=(1<<(bitwidth-1))-1; min=(0-max)-1; }
View Full Code Here

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

    /** Initializes the given sig to be associated with the given unary value; should only be called at the beginning.
     * <p> The resulting instance may or may not satisfy all facts, and should be checked for consistency.
     */
    public void init(Sig sig, SimTupleset value) throws Err {
        if (value==null) { sfs.remove(sig); return; }
        if (value.arity()>1) throw new ErrorType("Evaluator encountered an error: sig "+sig.label+" arity must not be " + value.arity());
        if (sig.builtin) throw new ErrorAPI("Evaluator cannot prebind the builtin sig \"" + sig.label + "\"");
        sfs.put(sig, value);
        cacheUNIV = null;
        cacheSTRING = null;
        cacheForConstants.clear();
View Full Code Here

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

    /** Initializes the given field to be associated with the given unary value; should only be called at the beginning.
     * <p> The resulting instance may or may not satisfy all facts, and should be checked for consistency.
     */
    public void init(Field field, SimTupleset value) throws Err {
        if (value==null) { sfs.remove(field); return; }
        if (!value.empty() && value.arity()!=field.type().arity()) throw new ErrorType("Evaluator encountered an error: field "+field.label+" arity must not be " + value.arity());
        if (field.defined) throw new ErrorAPI("Evaluator cannot prebind the value of a defined field.");
        sfs.put(field, value);
        cacheUNIV = null;
        cacheSTRING = null;
        cacheForConstants.clear();
View Full Code Here

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

    /** Initializes the given var to be associated with the given unary value; should only be called at the beginning.
     * <p> The resulting instance may or may not satisfy all facts, and should be checked for consistency.
     */
    public void init(ExprVar var, SimTupleset value) throws Err {
        if (value==null) { sfs.remove(var); return; }
        if (!value.empty() && value.arity()!=var.type().arity()) throw new ErrorType("Evaluator encountered an error: skolem "+var.label+" arity must not be " + value.arity());
        sfs.put(var, value);
        cacheUNIV = null;
        cacheSTRING = null;
        cacheForConstants.clear();
    }
View Full Code Here

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

        final Func f = x.fun;
        final int n = f.count();
        final Object candidate = n==0 ? cacheForConstants.get(f) : null;
        if (candidate!=null) return candidate;
        final Expr body = f.getBody();
        if (body.type().arity()<0 || body.type().arity()!=f.returnDecl.type().arity()) throw new ErrorType(body.span(), "Function return value not fully resolved.");
        for(Func ff:current_function) if (ff==f) throw new ErrorSyntax(x.span(), ""+f+" cannot call itself recursively!");
        Env<ExprVar,Object> newenv = new Env<ExprVar,Object>();
        List<SimTupleset> list = new ArrayList<SimTupleset>(x.args.size());
        for(int i=0; i<n; i++) { SimTupleset ts = cset(x.args.get(i)); newenv.put(f.get(i), ts);  list.add(ts); }
        final SimCallback cb = callbacks.get(f);
View Full Code Here

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

    /** {@inheritDoc} */
    @Override public Object visit(ExprConstant x) throws Err {
        switch(x.op) {
          case NUMBER:
             int n = x.num();
             if (n<min) throw new ErrorType(x.pos, "Current bitwidth is set to "+bitwidth+", thus this integer constant "+n+" is smaller than the minimum integer "+min);
             if (n>max) throw new ErrorType(x.pos, "Current bitwidth is set to "+bitwidth+", thus this integer constant "+n+" is bigger than the maximum integer "+max);
             return n;
          case FALSE: return Boolean.FALSE;
          case TRUE: return Boolean.TRUE;
          case MIN: return min;
          case MAX: return max;
View Full Code Here

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

   Expr (Pos pos, Pos closingBracket, boolean ambiguous, Type type, int mult, long weight, JoinableList<Err> errors) {
      this.pos = (pos==null ? Pos.UNKNOWN : pos);
      this.closingBracket = (closingBracket==null ? Pos.UNKNOWN : closingBracket);
      this.ambiguous      = ambiguous;
      if (errors==null) errors = emptyListOfErrors;
      if (type==EMPTY && errors.size()==0) errors = errors.make(new ErrorType(pos, "This expression failed to be typechecked"));
      this.mult   = (mult<0 || mult>2) ? 0 : mult;
      this.type   = (errors.size()>0 || type==null) ? EMPTY : type;
      this.weight = (weight>0) ? weight : 0;
      this.errors = errors;
   }
View Full Code Here

Examples of eu.admire.gateway.common.errors.ErrorType

    }

    @Override
    public void error(int line, int charPositionInLine, String message)
    {
        ErrorType errorType = mObjectFactory.createErrorType();
        String errorMsg = getErrorMessage(line, charPositionInLine, message);
        errorType.setMessage(errorMsg);
        ErrorHelper.getCompiletimeInstance(mErrors).getError().add(errorType);
        LOG.debug(errorMsg);
    }
View Full Code Here

Examples of eu.admire.gateway.common.errors.ErrorType

            final int line,
            final int charPositionInLine,
            final Throwable cause)
    {
        cause.printStackTrace();
        ErrorType errorType = mObjectFactory.createErrorType();
        String errorMsg = getErrorMessage(line, charPositionInLine, cause);
        errorType.setMessage(errorMsg);
        LOG.debug(errorMsg);
        Throwable error = cause.getCause();
        while (error != null)
        {
            ErrorType causeType = mObjectFactory.createErrorType();
            causeType.setMessage(getErrorMessage(line, charPositionInLine, error));
            errorType.setCause(causeType);
            errorType = causeType;
            error = error.getCause();
        }
        ErrorHelper.getCompiletimeInstance(mErrors).getError().add(errorType);
View Full Code Here

Examples of eu.admire.gateway.common.errors.ErrorType

    }
   
   
    public static ErrorType createError(Throwable error)
    {
        ErrorType root = OBJECT_FACTORY.createErrorType();
        ErrorType errorType = root;
        errorType.setMessage(error.toString());
        Throwable cause = error.getCause();
        while (cause != null)
        {
            ErrorType causeType = OBJECT_FACTORY.createErrorType();
            causeType.setMessage(cause.toString());
            errorType.setCause(causeType);
            errorType = causeType;
            cause = cause.getCause();
        }
        return root;
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.