org.rosuda.REngine.REXPDouble Java Examples

The following examples show how to use org.rosuda.REngine.REXPDouble. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Rsession.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
public static REXPList asRList(Map<?, ?> m) {
  RList l = new RList();
  for (Object o : m.keySet()) {
    Object v = m.get(o);
    if (v instanceof Double) {
      l.put(o.toString(), new REXPDouble((Double) v));
    } else if (v instanceof double[]) {
      l.put(o.toString(), new REXPDouble((double[]) v));
    } else if (v instanceof Integer) {
      l.put(o.toString(), new REXPInteger((Integer) v));
    } else if (v instanceof int[]) {
      l.put(o.toString(), new REXPInteger((int[]) v));
    } else if (v instanceof String) {
      l.put(o.toString(), new REXPString((String) v));
    } else if (v instanceof String[]) {
      l.put(o.toString(), new REXPString((String[]) v));
    } else if (v instanceof Boolean) {
      l.put(o.toString(), new REXPLogical((Boolean) v));
    } else if (v instanceof boolean[]) {
      l.put(o.toString(), new REXPLogical((boolean[]) v));
    } else if (v instanceof Map) {
      l.put(o.toString(), asRList((Map<?, ?>) v));
    } else if (v instanceof RList) {
      l.put(o.toString(), (RList) v);
    } else if (v == null) {
      l.put(o.toString(), new REXPNull());
    } else {
      System.err.println("Could not cast object " + o + " : " + v);
    }
  }
  return new REXPList(l);
}
 
Example #2
Source File: Rsession.java    From mzmine2 with GNU General Public License v2.0 5 votes vote down vote up
public static REXPList asRList(Map<?, ?> m) {
  RList l = new RList();
  for (Object o : m.keySet()) {
    Object v = m.get(o);
    if (v instanceof Double) {
      l.put(o.toString(), new REXPDouble((Double) v));
    } else if (v instanceof double[]) {
      l.put(o.toString(), new REXPDouble((double[]) v));
    } else if (v instanceof Integer) {
      l.put(o.toString(), new REXPInteger((Integer) v));
    } else if (v instanceof int[]) {
      l.put(o.toString(), new REXPInteger((int[]) v));
    } else if (v instanceof String) {
      l.put(o.toString(), new REXPString((String) v));
    } else if (v instanceof String[]) {
      l.put(o.toString(), new REXPString((String[]) v));
    } else if (v instanceof Boolean) {
      l.put(o.toString(), new REXPLogical((Boolean) v));
    } else if (v instanceof boolean[]) {
      l.put(o.toString(), new REXPLogical((boolean[]) v));
    } else if (v instanceof Map) {
      l.put(o.toString(), asRList((Map<?, ?>) v));
    } else if (v instanceof RList) {
      l.put(o.toString(), (RList) v);
    } else if (v == null) {
      l.put(o.toString(), new REXPNull());
    } else {
      System.err.println("Could not cast object " + o + " : " + v);
    }
  }
  return new REXPList(l);
}