/** * Returns the last timestamp included in the interval that corresponds to the given timestamp. * * @param timestamp * @return The timestamp in question. */ private long computeLastTimestampInInterval(final long timestamp, final AggregationVariableSet variables) { final long referenceTimePoint = variables.getFirstIntervalStart(); return referenceTimePoint + (((((timestamp - referenceTimePoint) / this.aggregationSpan) + 1) * this.aggregationSpan) - 1); } }
/** * Format usage output. * * @return the formatter */ protected HelpFormatter getHelpFormatter() { return new CLIHelpFormatter(); }
public static void loadDefaultLogger() { ToolsUtil.loadLogger("logging.properties"); }
/** * * @param input * inputstring * @return Rdata */ public String eString(final String input) { final String resultOnFailure = ""; try { final Object evaluationResult = this.evalWithR(input); final REXPString stringResult = (REXPString) evaluationResult; return stringResult.toString(); } catch (final InvalidREvaluationResultException exc) { RBridgeControl.LOGGER.error(exc.getMessage(), exc); return resultOnFailure; } }
private void initializeLogger(final CommandLine commandLine) { if (commandLine.hasOption('d')) { ToolsUtil.loadDebugLogger(); } else if (commandLine.hasOption('v')) { ToolsUtil.loadVerboseLogger(); } else { ToolsUtil.loadDefaultLogger(); } }
/** * * @param variable * variable to R * @throws InvalidREvaluationResultException */ public void toTS(final String variable) throws InvalidREvaluationResultException { if (variable != null) { final StringBuffer buf = new StringBuffer(); buf.append(variable); buf.append(" <- ts("); buf.append(variable); buf.append(')'); this.evalWithR(buf.toString()); } }
/** * Test to make sure that InvalidREvaluationResultException within the evalWithR() method are caught correctly. * * @throws InvalidREvaluationResultException * if exceptions are handled correctly. */ @Test(expected = InvalidREvaluationResultException.class) public void testNullPointerEvaluationEvalWithR() { final RBridgeControl r = RBridgeControl.getInstance(); r.evalWithR("accuracy(NULL)[6]"); } }
/** * Returns the first timestamp included in the interval that corresponds to the given timestamp. * * @param timestamp * * @return The timestamp in question. */ private long computeFirstTimestampInInterval(final long timestamp, final AggregationVariableSet variables) { final long referenceTimePoint; if (variables.getFirstIntervalStart() == -1) { variables.setFirstIntervalStart(timestamp); } referenceTimePoint = variables.getFirstIntervalStart(); return referenceTimePoint + (((timestamp - referenceTimePoint) / this.aggregationSpan) * this.aggregationSpan); }
/** * * @param input * inputstring * @return Rdata */ public double[] eDblArr(final String input) { final double[] resultOnFailure = new double[0]; try { final Object evaluationResult = this.evalWithR(input); final REXPVector vectorResult = (REXPVector) evaluationResult; return vectorResult.asDoubles(); } catch (final REXPMismatchException e) { return resultOnFailure; } catch (final InvalidREvaluationResultException e) { RBridgeControl.LOGGER.error(e.getMessage(), e); return resultOnFailure; } }
private void initializeLogger(final CommandLine commandLine) { if (commandLine.hasOption('d')) { ToolsUtil.loadDebugLogger(); } else if (commandLine.hasOption('v')) { ToolsUtil.loadVerboseLogger(); } else { ToolsUtil.loadDefaultLogger(); } }
/** * * @param variable * variable to R * @throws InvalidREvaluationResultException */ public void toTS(final String variable) throws InvalidREvaluationResultException { if (variable != null) { final StringBuffer buf = new StringBuffer(); buf.append(variable) .append(" <- ts(") .append(variable) .append(')'); this.evalWithR(buf.toString()); } }
public static void loadDebugLogger() { ToolsUtil.loadLogger("logging.debug.properties"); }
protected HelpFormatter getHelpFormatter() { return new CLIHelpFormatter(); }
/** * * @param input * inputstring * @return Rdata */ public String eString(final String input) { final String resultOnFailure = ""; try { final Object evaluationResult = this.evalWithR(input); final REXPString stringResult = (REXPString) evaluationResult; return stringResult.toString(); } catch (final InvalidREvaluationResultException exc) { RBridgeControl.LOG.error(exc.getMessage(), exc); return resultOnFailure; } }
public static void loadVerboseLogger() { ToolsUtil.loadLogger("logging.verbose.properties"); }
@Override protected HelpFormatter getHelpFormatter() { final HelpFormatter helpFormatter = new CLIHelpFormatter(); helpFormatter.setOptionComparator(new OptionComparator()); return helpFormatter; }
/** * * @param input * inputstring * @return Rdata */ public double[] eDblArr(final String input) { final double[] resultOnFailure = new double[0]; try { final Object evaluationResult = this.evalWithR(input); final REXPVector vectorResult = (REXPVector) evaluationResult; return vectorResult.asDoubles(); } catch (final REXPMismatchException e) { return resultOnFailure; } catch (final InvalidREvaluationResultException e) { RBridgeControl.LOG.error(e.getMessage(), e); return resultOnFailure; } }
public static void loadVerboseLogger() { ToolsUtil.loadLogger("logging.verbose.properties"); }
public static void loadDefaultLogger() { ToolsUtil.loadLogger("logging.properties"); }
public static void loadDebugLogger() { ToolsUtil.loadLogger("logging.debug.properties"); }