Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jbehave.core.steps
Class StepFinder

    java.lang.Object
      org.jbehave.core.steps.StepFinder

    public class StepFinder

extends 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`.

Nested Class Summary
`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 Summary
`StepFinder()` Creates a StepFinder with a `StepFinder.ByPriorityField` strategy
`StepFinder(StepFinder.PrioritisingStrategy prioritisingStrategy)` Creates a StepFinder with a custom strategy

Method Summary
`List<StepCandidate>` | `collectCandidates(List<CandidateSteps> candidateSteps)` Collects a list of step candidates from `CandidateSteps` instances.
`List<Stepdoc>` | `findMatching(String stepAsText, List<CandidateSteps> candidateSteps)` Finds matching steps, represented as `Stepdoc`s, for a given textual step and a list of `CandidateSteps`.
`List<StepCandidate>` | `prioritise(String stepAsText, List<StepCandidate> candidates)` Prioritises the list of step candidates that match a given step.
`List<Stepdoc>` | `stepdocs(List<CandidateSteps> candidateSteps)` Returns the stepdocs for the candidates collected from the given `CandidateSteps`.
`List<Object>` | `stepsInstances(List<CandidateSteps> candidateSteps)` Returns the steps instances associated to CandidateSteps

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### StepFinder

    public StepFinder()

  Creates a StepFinder with a `StepFinder.ByPriorityField` strategy

### StepFinder

    public StepFinder(StepFinder.PrioritisingStrategy prioritisingStrategy)

  Creates a StepFinder with a custom strategy

  Parameters:
    `prioritisingStrategy` - the PrioritisingStrategy

Method Detail

### stepdocs

    public List<Stepdoc> stepdocs(List<CandidateSteps> candidateSteps)

  Returns the stepdocs for the candidates collected from the given `CandidateSteps`.

  Parameters:
    `candidateSteps` - the List of CandidateSteps
  Returns:
    The List of Stepdocs, one for each `StepCandidate`.

### findMatching

    public List<Stepdoc> findMatching(String stepAsText,
                                      List<CandidateSteps> candidateSteps)

  Finds matching steps, represented as `Stepdoc`s, for a given textual step and a list of `CandidateSteps`.

  Parameters:
    `stepAsText` - the textual step
    `candidateSteps` - the List of CandidateSteps
  Returns:
    The list of Stepdocs, one for each matched `StepCandidate`.

### stepsInstances

    public List<Object> stepsInstances(List<CandidateSteps> candidateSteps)

  Returns the steps instances associated to CandidateSteps

  Parameters:
    `candidateSteps` - the List of CandidateSteps
  Returns:
    The List of steps instances

### collectCandidates

    public List<StepCandidate> collectCandidates(List<CandidateSteps> candidateSteps)

  Collects a list of step candidates from `CandidateSteps` instances.

  Parameters:
    `candidateSteps` - the list `CandidateSteps` instances
  Returns:
    A List of `StepCandidate`

### prioritise

    public List<StepCandidate> prioritise(String stepAsText,
                                          List<StepCandidate> candidates)

  Prioritises the list of step candidates that match a given step.

  Parameters:
    `stepAsText` - the textual step to match
    `candidates` - the List of StepCandidate
  Returns:
    The prioritised list according to the `StepFinder.PrioritisingStrategy`.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2013. All Rights Reserved.