Class SolverRunBase
- Namespace
- ZeroInstall.Services.Solvers
- Assembly
- ZeroInstall.Services.dll
Common base class for representing a single run of a solver.
public abstract class SolverRunBase
- Inheritance
-
SolverRunBase
- Inherited Members
Remarks
This is intended to be used by private classes within ISolver implementations to hold state during a run of Solve(Requirements).
Constructors
SolverRunBase(Requirements, ISelectionCandidateProvider)
Common base class for representing a single run of a solver.
protected SolverRunBase(Requirements requirements, ISelectionCandidateProvider candidateProvider)
Parameters
requirements
RequirementsThe requirements to satisfy.
candidateProvider
ISelectionCandidateProviderGenerates SelectionCandidates for the solver to choose from.
Remarks
This is intended to be used by private classes within ISolver implementations to hold state during a run of Solve(Requirements).
Fields
CandidateProvider
Generates SelectionCandidates for the solver to choose from.
protected readonly ISelectionCandidateProvider CandidateProvider
Field Value
Selections
Used to iteratively construct the selections to be returned.
protected Selections Selections
Field Value
Methods
DemandsFor(Command, FeedUri)
Generates SolverDemands for the dependencies specified by a Command.
protected IEnumerable<SolverDemand> DemandsFor(Command command, FeedUri interfaceUri)
Parameters
command
CommandThe command to scan for dependencies.
interfaceUri
FeedUriThe interface URI of the feed providing the command.
Returns
DemandsFor(ImplementationSelection, Requirements)
Generates SolverDemands for the dependencies specified by an ImplementationSelection.
protected IEnumerable<SolverDemand> DemandsFor(ImplementationSelection selection, Requirements requirements)
Parameters
selection
ImplementationSelectionThe selection to scan for dependencies.
requirements
RequirementsRequirements to inherit into the demands.
Returns
Solve()
Provides Selections that satisfy the specified Requirements.
public Selections Solve()
Returns
- Selections
The selected ImplementationSelections.
Exceptions
- SolverException
The solver was unable to provide Selections that fulfill the Requirements.
TryFulfill(SolverDemand)
Tries to fulfill the specified solver demand. Adds the result to Selections if successful.
protected abstract bool TryFulfill(SolverDemand demand)
Parameters
demand
SolverDemandThe demand to fulfill.
Returns
- bool
true
if the demand could be met,false
if not.