private void beginItem() { cleanUpLastItem(); this.inSpecificationItem = true; informListenerAboutNewItem(); }
MarkdownImporter(final InputFile fileName, final ImportEventListener listener) { this.file = fileName; this.listener = listener; this.stateMachine = new MarkdownImporterStateMachine(this.transitions); }
private static final Transition transition(final State from, final State to, final MdPattern pattern, final TransitionAction action) { return new Transition(from, to, pattern, action); }
private void forward() { final MarkdownForwardingSpecificationItem forward = new MarkdownForwardingSpecificationItem( this.stateMachine.getLastToken()); this.listener.beginSpecificationItem(); this.listener.setId(forward.getSkippedId()); this.listener.addCoveredId(forward.getOriginalId()); for (final String targetArtifactType : forward.getTargetArtifactTypes()) { this.listener.addNeededArtifactType(targetArtifactType.trim()); } this.listener.setForwards(true); this.listener.endSpecificationItem(); } }
/** * 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; } } }
private boolean matchToken(final String line, final Transition entry) { boolean matches = false; final Matcher matcher = entry.getMarkdownPattern().getPattern().matcher(line); if (matcher.matches()) { this.lastToken = (matcher.groupCount() == 0) ? "" : matcher.group(1); matches = true; } return matches; }
private void cleanUpLastItem() { if (this.inSpecificationItem) { endItem(); } }
@Override public Importer createImporter(final InputFile fileName, final ImportEventListener listener) { return new MarkdownImporter(fileName, listener); } }
private void rememberTitle() { this.lastTitle = this.stateMachine.getLastToken(); }
private void endItem() { this.inSpecificationItem = false; resetTitle(); this.listener.endSpecificationItem(); }
private void forward() { final MarkdownForwardingSpecificationItem forward = new MarkdownForwardingSpecificationItem( this.stateMachine.getLastToken()); this.listener.beginSpecificationItem(); this.listener.setId(forward.getSkippedId()); this.listener.addCoveredId(forward.getOriginalId()); for (final String targetArtifactType : forward.getTargetArtifactTypes()) { this.listener.addNeededArtifactType(targetArtifactType.trim()); } this.listener.setForwards(true); this.listener.endSpecificationItem(); } }
/** * 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; } } }
private void beginItem() { cleanUpLastItem(); this.inSpecificationItem = true; informListenerAboutNewItem(); }
private boolean matchToken(final String line, final Transition entry) { boolean matches = false; final Matcher matcher = entry.getMarkdownPattern().getPattern().matcher(line); if (matcher.matches()) { this.lastToken = (matcher.groupCount() == 0) ? "" : matcher.group(1); matches = true; } return matches; }
MarkdownImporter(final InputFile fileName, final ImportEventListener listener) { this.file = fileName; this.listener = listener; this.stateMachine = new MarkdownImporterStateMachine(this.transitions); }
private static final Transition transition(final State from, final State to, final MdPattern pattern, final TransitionAction action) { return new Transition(from, to, pattern, action); }
private void cleanUpLastItem() { if (this.inSpecificationItem) { endItem(); } }
@Override public Importer createImporter(final InputFile fileName, final ImportEventListener listener) { return new MarkdownImporter(fileName, listener); } }
private void rememberTitle() { this.lastTitle = this.stateMachine.getLastToken(); }
private void endItem() { this.inSpecificationItem = false; resetTitle(); this.listener.endSpecificationItem(); }