Examples of IInteger


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

    }
  }

  public IValue loadTableOrdered(IConstructor connection, IString tableName) {
    try {
      IInteger connectionId = (IInteger) connection.get(0);
      if (connectionMap.containsKey(connectionId)) {
        Connection conn = connectionMap.get(connectionId);
        PreparedStatement stmt = conn.prepareStatement("SELECT * FROM " + tableName.getValue());
        ResultSet rs = stmt.executeQuery();
       
View Full Code Here

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

  private int numberOfStates(ISet st){
    st.size();
    int r = 0;
    for(IValue v : st){
      ITuple t = (ITuple) v;
      IInteger from = (IInteger) t.get(0);
      IInteger to = (IInteger) t.get(2);
      if(from.intValue() > r) r = from.intValue();
      if(to.intValue() > r) r = to.intValue();
    }
    return r + 1;
  }
View Full Code Here

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

 
  private void printTransitions(PrintStream fos, ISet st){
    fos.println("des(0," + st.size() + "," + numberOfStates(st) + ")");
    for(IValue v : st){
      ITuple t = (ITuple) v;
      IInteger from = (IInteger) t.get(0);
      IString act = (IString) t.get(1);
      IInteger to = (IInteger) t.get(2);
      fos.print('(');
      fos.print(from.intValue());
      fos.print(',');
      fos.print("\"" + act.getValue() + "\"");
      fos.print(',');
      fos.print(to.intValue());
      fos.print(')');
      fos.println();
    }
  }
View Full Code Here

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

  public Result<IValue> call(Type[] actualTypes, IValue[] actuals, Map<String, IValue> keyArgValues) {
    Type returnType = getReturnType();
    Type instantiatedReturnType = returnType.instantiate(ctx
        .getCurrentEnvt().getTypeBindings());

    IInteger maxDepth = (IInteger) actuals[0];

    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

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

       */
      throw new UnsupportedSubscript(type, null, ctx.getCurrentAST());
    if (!subsBase.getType().isInteger()){
      throw new UnsupportedSubscript(getTypeFactory().integerType(), subsBase.getType(), ctx.getCurrentAST());
    }
    IInteger index = (IInteger)subsBase.getValue();
    int idx = index.intValue();
    if(idx < 0){
      idx = idx + getValue().arity();
    }
    if ( (idx >= getValue().arity()) || (idx < 0)) {
      throw RuntimeExceptionFactory.indexOutOfBounds(index, ctx.getCurrentAST(), ctx.getStackTrace());
View Full Code Here

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

      IString data = (IString) n.get(1);
      return new ProcessingInstruction(target.getValue(), data.getValue());
     
    }
    if (n.getConstructorType() == Factory.Node_charRef) {
      IInteger code = (IInteger) n.get(0);
      int c = java.lang.Integer.parseInt(code.getStringRepresentation());
      return new Text(new java.lang.String(Character.toChars(c)));
    }
    if (n.getConstructorType() == Factory.Node_entityRef) {
      return new EntityRef(((IString)n.get(0)).getValue());
    }
View Full Code Here

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

    final JavaToRascal jr = new JavaToRascal(new PrintWriter(System.out),
        new PrintWriter(System.err));
    jr.voidValue("import List;");
    System.out.println(jr.stringValue("\"<2+3>\";"));
    System.out.println(jr.stringValue("\"aap:<size([2,3])>\";"));
    final IInteger d1 = vf.integer(1), d2 = vf.integer(2);
    final IList l = vf.list(d1, d2);
    System.out.println(jr.call("size", l));
    // System.out.println(jr.call("+", d1, d2));
  }
View Full Code Here

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

    if (isCharClass(symbol)) {
      IList ranges = getRanges(symbol);
      StringBuilder b = new StringBuilder();
      b.append("[");
      for (IValue range : ranges) {
        IInteger from = getRangeBegin(range);
        IInteger to = getRangeEnd(range);
        if  (from.equals(to)) {
          b.append(escapeChar(from.intValue()));
        }
        else {
          b.append(escapeChar(from.intValue()));
          b.append("-");
          b.append(escapeChar(to.intValue()));
        }
      }
      b.append("]");
      return b.toString();
    }
View Full Code Here

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

      throw new UnexpectedType(TypeFactory.getInstance().integerType(), key.getType(), ctx.getCurrentAST());
    }
    if (getValue().getValue().length() == 0) {
      throw RuntimeExceptionFactory.illegalArgument(ctx.getCurrentAST(), ctx.getStackTrace());
    }
    IInteger index = ((IInteger)key.getValue());
    int idx = index.intValue();
    if(idx < 0){
      idx = idx + getValue().length();
    }
    if ( (idx >= getValue().length()) || (idx < 0) ) {
      throw RuntimeExceptionFactory.indexOutOfBounds(index, ctx.getCurrentAST(), ctx.getStackTrace());
View Full Code Here

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

  // @doc{head -- get the first n elements of a list}
  {
     try {
        return lst.sublist(0, n.intValue());
     } catch(IndexOutOfBoundsException e){
       IInteger end = values.integer(n.intValue() - 1);
        throw RuntimeExceptionFactory.indexOutOfBounds(end, null, null);
     }
  }
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.