Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/keenwrite.git

Initialize R engine upon parsing a document

AuthorDaveJarvis <email>
Date2021-12-30 14:10:39 GMT-0800
Commitd8a84b53b83c34e5384b7bc8d20d3dade0840e51
Parent68c1521
Delta18 lines added, 0 lines removed, 18-line increase
src/main/java/com/keenwrite/processors/r/InlineRProcessor.java
private final Processor<String> mPostProcessor = new ROutputProcessor();
+ /**
+ * Set to {@code true} when the R bootstrap script is loaded successfully.
+ */
private final AtomicBoolean mReady = new AtomicBoolean();
}
+ /**
+ * Answers whether R has been initialized without failures.
+ *
+ * @return {@code true} the R engine is ready to process inline R statements.
+ */
public boolean isReady() {
return mReady.get();
src/main/java/com/keenwrite/processors/r/RProcessor.java
}
+ /**
+ * Called when the {@link InlineRProcessor} is instantiated, which triggers
+ * a re-evaluation of all R expressions in the document. Without this, when
+ * the document is first viewed, no R expressions are evaluated until the
+ * user interacts with the document.
+ */
+ public void init() {
+ mInlineRProcessor.init();
+ }
+
public boolean isReady() {
return mInlineRProcessor.isReady();