Show / Hide Table of Contents

Class SolverRunBase

Common base class for representing a single run of a solver.

Inheritance
Object
SolverRunBase
Namespace: ZeroInstall.Services.Solvers
Assembly: ZeroInstall.Services.dll
Syntax
public abstract class SolverRunBase : Object
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)

Creates a new solver run.

Declaration
protected SolverRunBase(Requirements requirements, ISelectionCandidateProvider candidateProvider)
Parameters
Type Name Description
Requirements requirements

The requirements to satisfy.

ISelectionCandidateProvider candidateProvider

Generates SelectionCandidates for the solver to choose from.

Fields

CandidateProvider

Generates SelectionCandidates for the solver to choose from.

Declaration
protected readonly ISelectionCandidateProvider CandidateProvider
Field Value
Type Description
ISelectionCandidateProvider

Selections

Used to iteratively construct the selections to be returned.

Declaration
protected Selections Selections
Field Value
Type Description
Selections

Methods

Bucketize(IEnumerable<SolverDemand>)

Declaration
protected static (List<SolverDemand>, List<SolverDemand>) Bucketize(IEnumerable<SolverDemand> demands)
Parameters
Type Name Description
IEnumerable<SolverDemand> demands
Returns
Type Description
(, )<List<SolverDemand>, List<SolverDemand>>

DemandsFor(ImplementationSelection, Requirements)

Generates SolverDemands for the dependencies specified by an ImplementationSelection.

Declaration
protected IEnumerable<SolverDemand> DemandsFor(ImplementationSelection selection, Requirements requirements)
Parameters
Type Name Description
ImplementationSelection selection

The selection to scan for dependencies.

Requirements requirements

Requirements to inherit into the demands.

Returns
Type Description
IEnumerable<SolverDemand>

Solve()

Provides Selections that satisfy the specified Requirements.

Declaration
public Selections Solve()
Returns
Type Description
Selections

The selected ImplementationSelections.

Exceptions
Type Condition
SolverException

The solver was unable to provide Selections that fulfill the Requirements.

TryFulfill(IEnumerable<SolverDemand>)

Tries to fulfill the specified demands. Adds the results to Selections if successful.

Declaration
protected abstract bool TryFulfill(IEnumerable<SolverDemand> demands)
Parameters
Type Name Description
IEnumerable<SolverDemand> demands
Returns
Type Description
Boolean

true if all Essential demands could be met, false if not.

TryFulfill(SolverDemand)

Tries to fulfill the specified demand. Adds the result to Selections if successful.

Declaration
protected bool TryFulfill(SolverDemand demand)
Parameters
Type Name Description
SolverDemand demand
Returns
Type Description
Boolean

true if the demand could be met, false if not.

TryFulfill(SolverDemand, IEnumerable<SelectionCandidate>)

Tries to fulfill the specified solver demand. Adds the result to Selections if successful.

Declaration
protected abstract bool TryFulfill(SolverDemand demand, IEnumerable<SelectionCandidate> candidates)
Parameters
Type Name Description
SolverDemand demand

The demand to fulfill.

IEnumerable<SelectionCandidate> candidates

The candidates to consider for fulfilling the demand.

Returns
Type Description
Boolean

true if the demand could be met, false if not.

In This Article
Back to top Copyright Bastian Eicher et al