Package org.eclipse.imp.pdb.facts

Examples of org.eclipse.imp.pdb.facts.IValue


      int nrOfArgs = args.length();
      Type[] types = new Type[nrOfArgs];
      IValue[] actuals = new IValue[nrOfArgs];
     
      for(int i = nrOfArgs - 1; i >= 0; --i){
        IValue arg = args.get(i);
        types[i] = RascalTypeFactory.getInstance().nonTerminalType((IConstructor) arg);
        actuals[i] = arg;
      }
     
      return function.call(types, actuals, null);
View Full Code Here


   
    return res;
  }
 
  public static IValue jdbc2pdbValue(ResultSet rs, int idx, IValueFactory vf) {
    IValue res = null;
   
    try {
      if (idx == 0 && rs.getInt(0) == 1219)
        System.err.println(rs.getDate(6));
View Full Code Here

        Type elementType = resultType.getType().getTypeParameters().getFieldType(0);
        int columns = elementType.getArity();

        ISetWriter sw = vf.setWriter(elementType);
        while (rs.next()) {
          IValue tupleValues[] = new IValue[columns];
          for (int idx = 0; idx < columns; ++idx) {
            tupleValues[idx] = JDBC.jdbc2pdbValue(rs, idx + 1, this.vf);
          }
          sw.insert(vf.tuple(tupleValues));
        }
View Full Code Here

        ISetWriter sw = vf.setWriter(elementType);
        int columns = rs.getMetaData().getColumnCount();
       
        while (rs.next()) {
          IValue tupleValues[] = new IValue[columns];
          for (int idx = 0; idx < columns; ++idx) {
            tupleValues[idx] = JDBC.jdbc2pdbValue(rs, idx + 1, this.vf);
          }
          sw.insert(vf.tuple(tupleValues));
        }
View Full Code Here

        Type elementType = resultType.getType().getTypeParameters().getFieldType(0);
        int columns = elementType.getArity();

        IListWriter lw = vf.listWriter(elementType);
        while (rs.next()) {
          IValue tupleValues[] = new IValue[columns];
          for (int idx = 0; idx < columns; ++idx) {
            tupleValues[idx] = JDBC.jdbc2pdbValue(rs, idx + 1, this.vf);
          }
          lw.append(vf.tuple(tupleValues));
        }
View Full Code Here

  public IValue arbitrary(IValue type, IInteger depthLimit, IEvaluatorContext eval) {
    try {
      TypeParameterVisitor tpvisit = new TypeParameterVisitor();
      Type requestedType = Cobra.reifyType(type);
      HashMap<Type, Type> tpbindings = tpvisit.bindTypeParameters(requestedType);
      IValue result = quickcheck.arbitrary(requestedType,
          depthLimit.intValue(), eval.getCurrentEnvt().getRoot(),
          eval.getValueFactory(), tpbindings);
      return result;
    } catch (IllegalArgumentException e) {
      throw RuntimeExceptionFactory.illegalArgument(depthLimit,
View Full Code Here

    private Result<IValue> createVisitedDate(IEvaluator<Result<IValue>> eval, String datePart, org.rascalmpl.ast.JustDate.Lexical x) {
      try {
        datePart.replaceAll("-", "");

        StandardTextReader parser = new StandardTextReader();
        IValue result = parser.read(VF, new StringReader("$" + datePart));
        return makeResult(TF.dateTimeType(), result, eval);
      } catch (FactTypeUseException e) {
        throw new DateTimeSyntax(e.getMessage(), eval.getCurrentAST().getLocation());
      } catch (FactParseError e) {
          throw new DateTimeSyntax(e.getMessage(), eval.getCurrentAST().getLocation());
View Full Code Here

    RandomValueTypeVisitor v = new RandomValueTypeVisitor(
        getValueFactory(), (ModuleEnvironment) getEnv().getRoot(),
        maxDepth.intValue(), generators, ctx.getCurrentEnvt().getTypeBindings());

    IValue returnVal = instantiatedReturnType.accept(v);

    return makeResult(instantiatedReturnType, returnVal, eval);

  }
View Full Code Here

      IValueFactory vf, Map<Type, Type> typeParameters) {

    RandomValueTypeVisitor visitor = new RandomValueTypeVisitor(vf,
        (ModuleEnvironment) env, depthLimit, generators, typeParameters);

    IValue result = visitor.generate(type);
    if (result == null) {
      throw new IllegalArgumentException("No construction possible at this depth or less.");
    }
    return result;
  }
View Full Code Here

      try {
        Type[] actualTypes = new Type[formals.getArity()];
        for(int j = 0; j < types.length; j ++) {
          actualTypes[j] = types[j].instantiate(tpbindings);
        }
        IValue result = function.call(actualTypes, values, null).getValue();
        function.getEval().getStdOut().flush();
        if (!((IBool) result).getValue()) {
          reportFailed(fname, "test returns false", tpbindings, formals, values, out);
          return false;
        } else if (verbose && formals.getArity() > 0) {
View Full Code Here

TOP

Related Classes of org.eclipse.imp.pdb.facts.IValue

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.