MarkdownImporter(final InputFile fileName, final ImportEventListener listener) { this.file = fileName; this.listener = listener; this.stateMachine = new MarkdownImporterStateMachine(this.transitions); }
private void rememberTitle() { this.lastTitle = this.stateMachine.getLastToken(); }
/** * Step the state machine * * @param line * the text fragment on which the state machine decides the next * state and action */ public void step(final String line) { for (final Transition entry : this.transitions) { if ((this.state == entry.getFrom()) && matchToken(line, entry)) { LOG.finest(() -> entry + " : '" + line + "'"); entry.getTransition().transit(); this.state = entry.getTo(); break; } } }
@Override public void runImport() { LOG.fine(() -> "Starting import of file " + this.file); String line; this.lineNumber = 0; try (BufferedReader reader = this.file.createReader()) { while ((line = reader.readLine()) != null) { ++this.lineNumber; this.stateMachine.step(line); } } catch (final IOException exception) { throw new ImporterException( "Error reading \"" + this.file.getPath() + "\" at line " + this.lineNumber, exception); } finishImport(); }
/** * Step the state machine * * @param line * the text fragment on which the state machine decides the next * state and action */ public void step(final String line) { for (final Transition entry : this.transitions) { if ((this.state == entry.getFrom()) && matchToken(line, entry)) { LOG.finest(() -> entry + " : '" + line + "'"); entry.getTransition().transit(); this.state = entry.getTo(); break; } } }
@Override public void runImport() { LOG.fine(() -> "Starting import of file " + this.file); String line; this.lineNumber = 0; try (BufferedReader reader = this.file.createReader()) { while ((line = reader.readLine()) != null) { ++this.lineNumber; this.stateMachine.step(line); } } catch (final IOException exception) { throw new ImporterException( "Error reading \"" + this.file.getPath() + "\" at line " + this.lineNumber, exception); } finishImport(); }
private void rememberTitle() { this.lastTitle = this.stateMachine.getLastToken(); }
MarkdownImporter(final InputFile fileName, final ImportEventListener listener) { this.file = fileName; this.listener = listener; this.stateMachine = new MarkdownImporterStateMachine(this.transitions); }
private void beginDescription() { this.lastDescription = new StringBuilder(this.stateMachine.getLastToken()); }
private void beginDescription() { this.lastDescription = new StringBuilder(this.stateMachine.getLastToken()); }
private void appendRationale() { if (this.lastRationale.length() > 0) { this.lastRationale.append(System.lineSeparator()); } this.lastRationale.append(this.stateMachine.getLastToken()); }
private void appendDescription() { this.lastDescription.append(System.lineSeparator()) .append(this.stateMachine.getLastToken()); }
private void appendDescription() { this.lastDescription.append(System.lineSeparator()) .append(this.stateMachine.getLastToken()); }
private void appendComment() { if (this.lastComment.length() > 0) { this.lastComment.append(System.lineSeparator()); } this.lastComment.append(this.stateMachine.getLastToken()); }
private void appendRationale() { if (this.lastRationale.length() > 0) { this.lastRationale.append(System.lineSeparator()); } this.lastRationale.append(this.stateMachine.getLastToken()); }
private void appendComment() { if (this.lastComment.length() > 0) { this.lastComment.append(System.lineSeparator()); } this.lastComment.append(this.stateMachine.getLastToken()); }
private void addNeeds() { final String artifactTypes = this.stateMachine.getLastToken(); for (final String artifactType : artifactTypes.split(",\\s*")) { this.listener.addNeededArtifactType(artifactType); } }
private void addNeeds() { final String artifactTypes = this.stateMachine.getLastToken(); for (final String artifactType : artifactTypes.split(",\\s*")) { this.listener.addNeededArtifactType(artifactType); } }
private void addTag() { final String tags = this.stateMachine.getLastToken(); for (final String tag : tags.split(",\\s*")) { this.listener.addTag(tag); } }
private void addTag() { final String tags = this.stateMachine.getLastToken(); for (final String tag : tags.split(",\\s*")) { this.listener.addTag(tag); } }