private static REXPLogical stringToREXPLogical(String value) { return new REXPLogical (stringToByte(value)); }
private static void setForecastModuleAvailableAndLoadedFlag(final Object forecastPackageLoadResult) { if ((forecastPackageLoadResult != null) && (forecastPackageLoadResult instanceof REXPLogical)) { final REXPLogical returnValue = (REXPLogical) forecastPackageLoadResult; final boolean hasAttr = returnValue.hasAttribute("attr"); final boolean[] isTrue = returnValue.isTRUE(); if (!hasAttr && (isTrue.length > 0) && isTrue[0]) { forecastPackageAvailable = true; return; } } forecastPackageAvailable = false; }
/** returns a boolean array of the same langth as the receiver with <code>true</code> for <code>FALSE</code> values and <code>false</code> for <code>TRUE</code> and <code>NA</code> values. @return boolean array @deprecated replaced by {@link #isTRUE()} for consistency with R nomenclature. */ public boolean[] isFalse() { return isFALSE(); }
Boolean[] bArr = new Boolean[1]; bArr[0] = (Boolean)value; connectable.getRengine().assign(key, new REXPLogical(bArr[0])); break; case REXP_ARRAY_INT: break; case REXP_ARRAY_BOOL: connectable.getRengine().assign(key, new REXPLogical((boolean[])value)); break; default: Boolean[] bAList = new Boolean[len]; for (int i = 0; i < len; i++) { bAList[i] = ((REXPLogical)retVal).isTRUE()[i]; bData = (((REXPLogical)retVal).isTRUE()); boolOutput.emit(bData[0]);
/** returns a boolean array of the same langth as the receiver with <code>true</code> for <code>TRUE</code> values and <code>false</code> for <code>FALSE</code> and <code>NA</code> values. @return boolean array @deprecated replaced by {@link #isTRUE()} for consistency with R nomenclature. */ public boolean[] isTrue() { return isTRUE(); }
/** * Wraps the execution of an arbitrary R expression. Both errors and results are logged. * * @param input * The R expression to evaluate. * * @return The result or the error of the evaluation of the given R expression. The method tries to convert it into a string, if possible. */ public Object evalWithR(final String input) throws InvalidREvaluationResultException { Object out = null; try { out = this.rCon.eval(input); Object output = null; if (out instanceof REXPString) { output = ((REXPString) out).asString(); } else if (out instanceof REXPLogical) { output = ((REXPLogical) out).toDebugString(); } else if (out != null) { output = out; } else { throw new InvalidREvaluationResultException("Got a null result for evaluation input: \"" + input + "\""); } RBridgeControl.LOGGER.trace("> REXP: {} return: {}", input, output); } catch (final REXPMismatchException exc) { RBridgeControl.LOGGER.error("Error R expr.: {} Cause: {}", input, exc.getMessage(), exc); } return out; }
if (((REXPLogical)value).length() == 1) { script = inputName + " <- " + value.asString() + ";\n" + script; } else {
Boolean[] bArr = new Boolean[1]; bArr[0] = (Boolean) value; connectable.getRengine().assign(key, new REXPLogical(bArr[0])); break; case REXP_ARRAY_INT: break; case REXP_ARRAY_BOOL: connectable.getRengine().assign(key, new REXPLogical((boolean[]) value)); break; default: Boolean[] bAList = new Boolean[len]; for (int i = 0; i < len; i++) { bAList[i] = ((REXPLogical) retVal).isTRUE()[i]; bData = (((REXPLogical) retVal).isTRUE()); boolOutput.emit(bData[0]);
/** returns a boolean array of the same langth as the receiver with <code>true</code> for <code>TRUE</code> values and <code>false</code> for <code>FALSE</code> and <code>NA</code> values. @return boolean array @deprecated replaced by {@link #isTRUE()} for consistency with R nomenclature. */ public boolean[] isTrue() { return isTRUE(); }
/** * Wraps the execution of an arbitrary R expression. Both errors and results are logged. * * @param input * The R expression to evaluate. * * @return The result or the error of the evaluation of the given R expression. The method tries to convert it into a string, if possible. */ public Object evalWithR(final String input) throws InvalidREvaluationResultException { Object out = null; try { out = this.rCon.eval(input); Object output = null; if (out instanceof REXPString) { output = ((REXPString) out).asString(); } else if (out instanceof REXPLogical) { output = ((REXPLogical) out).toDebugString(); } else if (out != null) { output = out; } else { throw new InvalidREvaluationResultException("Got a null result for evaluation input: \"" + input + "\""); } RBridgeControl.LOG.trace("> REXP: " + input + " return: " + output); } catch (final REXPMismatchException exc) { RBridgeControl.LOG.error("Error R expr.: " + input + " Cause: " + exc, exc); } return out; }
return stringToREXPLogical((String) value); return new REXPLogical(REXPLogical.NA); bValues[i++] = stringToByte(s); return new REXPLogical(bValues);
private static void setForecastModuleAvailableAndLoadedFlag(final Object forecastPackageLoadResult) { if ((forecastPackageLoadResult != null) && (forecastPackageLoadResult instanceof REXPLogical)) { final REXPLogical returnValue = (REXPLogical) forecastPackageLoadResult; final boolean hasAttr = returnValue.hasAttribute("attr"); final boolean[] isTrue = returnValue.isTRUE(); if (!hasAttr && (isTrue.length > 0) && isTrue[0]) { forecastPackageAvailable = true; return; } } forecastPackageAvailable = false; }
return (new Double(logical.isTRUE()[0] ? 1.0 : 0.0)); for (boolean b : logical.isTRUE()) { doubleResult.add(new Double(b ? 1.0 : 0.0)); return (new Integer(logical.isTRUE()[0] ? 1 : 0)); for (boolean b : logical.isTRUE()) { integerResult.add(new Integer(b ? 1 : 0)); return (Arrays.toString(logical.isTRUE())); for (boolean b : logical.isTRUE()) { stringResult.add(b ? "true" : "false");
/** returns a boolean array of the same langth as the receiver with <code>true</code> for <code>FALSE</code> values and <code>false</code> for <code>TRUE</code> and <code>NA</code> values. @return boolean array @deprecated replaced by {@link #isTRUE()} for consistency with R nomenclature. */ public boolean[] isFalse() { return isFALSE(); }
return new REXPLogical( ((Boolean)o).booleanValue() ) ; return new REXPLogical( (boolean[])o ) ; b[i] = booleans[i].booleanValue() ; return new REXPLogical( b );
return new REXPLogical( ((Boolean)o).booleanValue() ) ; return new REXPLogical( (boolean[])o ) ; b[i] = booleans[i].booleanValue() ; return new REXPLogical( b );
byte b[] = new byte[] { buf[o] }; if (b[0] != 0 && b[0] != 1) b[0] = REXPLogical.NA; cont = new REXPLogical(b, getAttr()); o++; if (o!=eox) { o = eox; for (int j = 0; j < d.length; j++) if (d[j] != 0 && d[j] != 1) d[j] = REXPLogical.NA; cont = new REXPLogical(d, getAttr()); return o; for (int j = 0; j < d.length; j++) if (d[j] != 0 && d[j] != 1) d[j] = REXPLogical.NA; o = eox; cont = new REXPLogical(d, getAttr()); return o;
byte b[] = new byte[] { buf[o] }; if (b[0] != 0 && b[0] != 1) b[0] = REXPLogical.NA; cont = new REXPLogical(b, getAttr()); o++; if (o!=eox) { o = eox; for (int j = 0; j < d.length; j++) if (d[j] != 0 && d[j] != 1) d[j] = REXPLogical.NA; cont = new REXPLogical(d, getAttr()); return o; for (int j = 0; j < d.length; j++) if (d[j] != 0 && d[j] != 1) d[j] = REXPLogical.NA; o = eox; cont = new REXPLogical(d, getAttr()); return o;