Examples of SEXP


Examples of org.renjin.sexp.SEXP

  @Test
  public void multipleReads() throws IOException {

    FileObject file = VFS.getManager().resolveFile(getClass().getResource("test2.txt").getFile());
    SEXP conn = topLevelContext.getSession().getConnectionTable().newConnection(new GzFileConnection(file));

    assertThat( Connections.readChar(topLevelContext, conn, 9, false), equalTo("The quick"));
    assertThat( Connections.readChar(topLevelContext, conn, 6, false), equalTo(" brown"));

  }
View Full Code Here

Examples of org.renjin.sexp.SEXP

  public MemberBinding getMemberBinding(Symbol name) {
    if(name == NEW) {
      return classBinding.getConstructorBinding();
    }

    final SEXP staticMember = classBinding.getStaticMember(name);
    if(staticMember == null) {
      throw new EvalException("Class %s has no static member named '%s'",
          classBinding.getBoundClass().getName(), name);
    }
View Full Code Here

Examples of org.renjin.sexp.SEXP

    super(context.getEnvironment(), Symbol.get(name));
  }

  @Override
  protected SEXP doEval(Context context) {
    SEXP value = environment.findVariable((Symbol)expression);
    if(value == Symbol.UNBOUND_VALUE) {
      throw new EvalException("object '" + expression + "' not found");
    }
    return value.force(context);
  }
View Full Code Here

Examples of org.renjin.sexp.SEXP

    Collections.sort(sources);
   
    for(File source : sources) {
      FileReader reader = new FileReader(source);
      try {
        SEXP expr = RParser.parseAllSource(reader);
        evalContext.evaluate(expr);
      } catch(Exception e) {
        throw new RuntimeException("Error evaluating " + source.getName() + ": " + e.getMessage(), e);
      } finally {
        reader.close();       
View Full Code Here

Examples of org.renjin.sexp.SEXP

    nc = data.size();
    nr = 0;                     /* -Wall */
    if (nc > 0) {
      nr = nrows(data.get(0));
      for(int i=0;i<nc;++i) {
        SEXP element = data.get(i);
        if(element instanceof AtomicVector) {
          if(nrows(element) != nr) {
            throw new EvalException("variable lengths differ (found for '%s')", names.get(i));
          }
        } else {
          throw new EvalException("invalid type (%s) for variable '%s'", element.getTypeName(), names.get(i));
        }
      }
    } else {
      nr = row_names.length();
    }
View Full Code Here

Examples of org.renjin.sexp.SEXP

    return sexp == Null.INSTANCE || sexp instanceof ListVector;
  }
 
  public static int nrows(SEXP s) {
    if (s instanceof Vector) {
        SEXP dim = s.getAttribute(Symbols.DIM);
        if(dim == Null.INSTANCE) {
          return s.length();
        } else {
          return ((IntVector)dim).getElementAsInt(0);
        }
View Full Code Here

Examples of org.renjin.sexp.SEXP

  }

  @Override
  public void visitConstant(Constant constant) {
    if(constant.getValue() instanceof SEXP) {
      SEXP exp = (SEXP)constant.getValue();
      exp.accept(new ConstantGeneratingVisitor(mv));
    } else if (constant.getValue() instanceof Integer) {
      ByteCodeUtil.pushInt(mv, (Integer)constant.getValue());
    } else {
      throw new UnsupportedOperationException();
    }
View Full Code Here

Examples of org.renjin.sexp.SEXP

        mv.visitInsn(DUP);
        pushInt(i);
   
        Expression arg = call.getArguments().get(i);
        if(arg instanceof IRThunk) {
          SEXP sexp = ((IRThunk) arg).getSEXP();
          if(sexp instanceof Symbol) {
            // since this is a simple case, just do it inline
            visitEnvironmentVariable(new EnvironmentVariable((Symbol) sexp));
          } else {
            // otherwise call out to the corresponding thunk's
View Full Code Here

Examples of org.renjin.sexp.SEXP

 
  public FactorVariable(String name, SEXP vector) {
    this.name = name;
    this.vector = (Vector)vector;
   
    SEXP contrasts = vector.getAttribute(Symbol.get("contrasts"));
    if(contrasts != Null.INSTANCE) {
      contrastMatrix = new ContrastMatrix(contrasts);
    } else {
      throw new EvalException("Invalid contrast matrix for " + name);
    }
View Full Code Here

Examples of org.renjin.sexp.SEXP

  public Symbol getName() {
    return name;
  }
  @Override
  public Object retrieveValue(Context context, Object[] temps) {
    SEXP value = context.getEnvironment().findVariable(name);
    if(value == Symbol.UNBOUND_VALUE) {
      throw new EvalException("object '" + name + "' not found");
    }
    return value.force(context);
  }
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.