public class StepFinder
extends java.lang.Object
StepFinder is reponsible for finding and prioritising step candidates or
finding steps instances from CandidateSteps
, which are created using
an InjectableStepsFactory
.
The StepCandidate
s are responsible for the matching of a particular
textual step and are sometimes represented as Stepdoc
s, each of which
is simply a facade documenting a candidate. The candidates can be prioritised
via an injectable StepFinder.PrioritisingStrategy
, defaulting to
StepFinder.ByPriorityField
. A more sophisticated strategy that can be used is
the StepFinder.ByLevenshteinDistance
.
Modifier and Type | Class and Description |
---|---|
static class |
StepFinder.ByLevenshteinDistance
Strategy to priorise candidate steps by Levenshtein Distance
|
static class |
StepFinder.ByPriorityField
Strategy to priorise step candidates by the
StepCandidate.getPriority() field which is settable in the
Given , When , Then annotations. |
static interface |
StepFinder.PrioritisingStrategy
Defines the priorising strategy of step candidates
|
Constructor and Description |
---|
StepFinder()
Creates a StepFinder with a
StepFinder.ByPriorityField strategy |
StepFinder(StepFinder.PrioritisingStrategy prioritisingStrategy)
Creates a StepFinder with a custom strategy
|
Modifier and Type | Method and Description |
---|---|
java.util.List<StepCandidate> |
collectCandidates(java.util.List<CandidateSteps> candidateSteps)
Collects a list of step candidates from
CandidateSteps instances. |
java.util.List<Stepdoc> |
findMatching(java.lang.String stepAsText,
java.util.List<CandidateSteps> candidateSteps)
Finds matching steps, represented as
Stepdoc s, for a given
textual step and a list of CandidateSteps . |
java.util.List<StepCandidate> |
prioritise(java.lang.String stepAsText,
java.util.List<StepCandidate> candidates)
Prioritises the list of step candidates that match a given step.
|
java.util.List<Stepdoc> |
stepdocs(java.util.List<CandidateSteps> candidateSteps)
Returns the stepdocs for the candidates collected from the given
CandidateSteps . |
java.util.List<java.lang.Object> |
stepsInstances(java.util.List<CandidateSteps> candidateSteps)
Returns the steps instances associated to CandidateSteps
|
public StepFinder()
StepFinder.ByPriorityField
strategypublic StepFinder(StepFinder.PrioritisingStrategy prioritisingStrategy)
prioritisingStrategy
- the PrioritisingStrategypublic java.util.List<Stepdoc> stepdocs(java.util.List<CandidateSteps> candidateSteps)
CandidateSteps
.candidateSteps
- the List of CandidateStepsStepCandidate
.public java.util.List<Stepdoc> findMatching(java.lang.String stepAsText, java.util.List<CandidateSteps> candidateSteps)
Stepdoc
s, for a given
textual step and a list of CandidateSteps
.stepAsText
- the textual stepcandidateSteps
- the List of CandidateStepsStepCandidate
.public java.util.List<java.lang.Object> stepsInstances(java.util.List<CandidateSteps> candidateSteps)
candidateSteps
- the List of CandidateStepspublic java.util.List<StepCandidate> collectCandidates(java.util.List<CandidateSteps> candidateSteps)
CandidateSteps
instances.candidateSteps
- the list CandidateSteps
instancesStepCandidate
public java.util.List<StepCandidate> prioritise(java.lang.String stepAsText, java.util.List<StepCandidate> candidates)
stepAsText
- the textual step to matchcandidates
- the List of StepCandidateStepFinder.PrioritisingStrategy
.Copyright © 2003-2014. All Rights Reserved.