Dave Jarvis' Repositories

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

Change variable to final, removed superfluous code

AuthorDaveJarvis <email>
Date2020-06-07 12:46:10 GMT-0700
Commit9f57cf6e91cc06e053380cd7175181d14f9addfb
Parent07e1957
Delta24 lines added, 29 lines removed, 5-line decrease
src/main/java/com/scrivenvar/processors/AbstractProcessor.java
* Used while processing the entire chain; null to signify no more links.
*/
- private final Processor<T> next;
+ private final Processor<T> mNext;
/**
*/
public AbstractProcessor( final Processor<T> successor ) {
- this.next = successor;
+ mNext = successor;
}
@Override
public Processor<T> next() {
- return this.next;
+ return mNext;
}
}
src/main/java/com/scrivenvar/processors/DefinitionProcessor.java
package com.scrivenvar.processors;
-import static com.scrivenvar.processors.text.TextReplacementFactory.replace;
-
import java.util.Map;
+
+import static com.scrivenvar.processors.text.TextReplacementFactory.replace;
/**
return mDefinitions;
}
-
}
src/main/java/com/scrivenvar/processors/ProcessorFactory.java
public class ProcessorFactory extends AbstractFileFactory {
- private final HTMLPreviewPane previewPane;
- private final Map<String, String> resolvedMap;
-
- private Processor<String> terminalProcessChain;
+ private final HTMLPreviewPane mPreviewPane;
+ private final Map<String, String> mResolvedMap;
+ private final Processor<String> mCommonProcessor;
/**
* Constructs a factory with the ability to create processors that can perform
* text and caret processing to generate a final preview.
*
* @param previewPane Where the final output is rendered.
- * @param resolvedMap Map of definitions to replace before final render.
+ * @param resolvedMap Flat map of definitions to replace before final render.
*/
public ProcessorFactory(
final HTMLPreviewPane previewPane,
final Map<String, String> resolvedMap ) {
- this.previewPane = previewPane;
- this.resolvedMap = resolvedMap;
+ mPreviewPane = previewPane;
+ mResolvedMap = resolvedMap;
+ mCommonProcessor = createCommonProcessor();
}
return processor;
- }
-
- /**
- * Returns a processor common to all processors: markdown, caret position
- * token replacer, and an HTML preview renderer.
- *
- * @return Processors at the end of the processing chain.
- */
- private Processor<String> getCommonProcessor() {
- if( this.terminalProcessChain == null ) {
- this.terminalProcessChain = createCommonProcessor();
- }
-
- return this.terminalProcessChain;
}
private HTMLPreviewPane getPreviewPane() {
- return this.previewPane;
+ return mPreviewPane;
}
/**
* Returns the variable map of interpolated definitions.
*
* @return A map to help dereference variables.
*/
private Map<String, String> getResolvedMap() {
- return this.resolvedMap;
+ return mResolvedMap;
+ }
+
+ /**
+ * Returns a processor common to all processors: markdown, caret position
+ * token replacer, and an HTML preview renderer.
+ *
+ * @return Processors at the end of the processing chain.
+ */
+ private Processor<String> getCommonProcessor() {
+ return mCommonProcessor;
}
}