Package org.renjin.eval

Examples of org.renjin.eval.EvalException


  public static void warning(CharPtr text) {
    java.lang.System.out.println(text.asString());
  }

  public static void error(CharPtr text) {
    throw new EvalException(text.asString());
  }
View Full Code Here


        return Logical.NA;
      } else {
        return vector.getElementAsLogical(0);
      }
    }
    throw new EvalException(errorMessage);
  }
View Full Code Here

    super(source);
    this.coordinateMatrix = new Matrix((Vector)subscript);
    this.sourceDim = dimAsIntArray(source);
   
    if(sourceDim.length != coordinateMatrix.getNumCols()) {
      throw new EvalException("The number of dimensions in the source (%d) does not " +
          "match the number of columns in the provided coordinate matrix (%d)",
          sourceDim.length,
          coordinateMatrix.getNumCols());
    }   
  }
View Full Code Here

   *
   */
  @Internal("parent.frame")
  public static Environment parentFrame(@Current Context context,  int n) {
    if(n < 1) {
      throw new EvalException("invalid 'n' value");
    }

    // note that we actually climb n+1 parents in order to
    // skip the closure that makes the .Internal(parent.frame()) call

View Full Code Here

        } else if(vector instanceof IntVector) {
          sb.append(cs.internalsprintf(vector.getElementAsInt(j)));
        } else if(vector instanceof StringVector) {
          sb.append(cs.internalsprintf(vector.getElementAsString(j)));
        } else {
          throw new EvalException("Cannot use '%s' as an sprintf argument", vector.getTypeName());
        }
        if (!cs.isPositionalSpecification())
          i++;
      }
    }
View Full Code Here

    * but then we wouldn't be compatible with S.
    **/
  private static int R_sysparent(int n, Context cptr) {
    int j;
    if(n <= 0) {
      throw new EvalException("only positive values of 'n' are allowed");
    }
    while (!cptr.isTopLevel() && n > 1) {
      if (cptr.getType() == Type.FUNCTION ) {
        n--;
      }
View Full Code Here

      n = cptr.getFrameDepth() - n;
    } else {
      n = - n;
    }
    if (n < 0) {
      throw new EvalException("not that many frames on the stack");
    }
    while (!cptr.isTopLevel()) {
      if (cptr.getType() == Type.FUNCTION ) {
        if (n == 0)
          return cptr.getClosure();
        else
          n--;
      }
      cptr = cptr.getParent();
    }
    if (n == 0 && cptr.isTopLevel()) {
      return cptr.getClosure();
    }
    throw new EvalException("not that many frames on the stack");
  }
View Full Code Here

    SEXP exp = o[i];
    if(exp instanceof LogicalVector || exp instanceof DoubleVector || exp instanceof IntVector) {
      int j = cycleIndex % exp.length();
      return ((AtomicVector)exp).getElementAsInt(j);
    } else {
      throw new EvalException("expected integer at argument %d", i+1);
    }
  }
View Full Code Here

    else {
      n = -n;
    }

    if(n < 0) {
      throw new EvalException("not that many frames on the stack");
    }

    while (!cptr.isTopLevel()) {
      if (cptr.getType() == Type.FUNCTION ) {
        if (n == 0) {  /* we need to detach the enclosing env */
          return cptr.getEnvironment();
        } else {
          n--;
        }
      }
      cptr = cptr.getParent();
    }
    if(n == 0 && cptr.isTopLevel()) {
      return cptr.getGlobalEnvironment();
    }
    throw new EvalException("not that many frames on the stack");
  }
View Full Code Here

    if (n > 0)
      n = cptr.getFrameDepth() - n;
    else
      n = - n;
    if(n < 0) {
      throw new EvalException("not that many frames on the stack");
    }
    while (!cptr.isTopLevel() ) {
      if (cptr.getType() == Type.FUNCTION) {
        if (n == 0) {
          return cptr.getCall();
        } else {
          n--;
        }
      }
      cptr = cptr.getParent();
    }
    if (n == 0 && cptr.isTopLevel()) {
      return cptr.getCall();
    }
    throw new EvalException("not that many frames on the stack");
  }
View Full Code Here

TOP

Related Classes of org.renjin.eval.EvalException

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.