Class SolverUtils
- Namespace
- ZeroInstall.Services.Solvers
- Assembly
- ZeroInstall.Services.dll
Helper functions for ISolver implementations.
public static class SolverUtils
- Inheritance
-
SolverUtils
- Inherited Members
Methods
AddCommand(ImplementationSelection, Requirements, Implementation)
Adds a Command specified in an Implementation to a ImplementationSelection.
public static Command? AddCommand(this ImplementationSelection selection, Requirements requirements, Implementation from)
Parameters
selection
ImplementationSelectionThe ImplementationSelection to add the Command to.
requirements
RequirementsThe requirements specifying which Command to extract.
from
ImplementationThe Implementation to get the Command from.
Returns
AddDependencies(IDependencyContainer, Requirements, IDependencyContainer)
Transfers Dependencys from one IDependencyContainer to another.
public static void AddDependencies(this IDependencyContainer target, Requirements requirements, IDependencyContainer from)
Parameters
target
IDependencyContainerThe IDependencyContainer to add the Dependencys to.
requirements
RequirementsThe requirements which restrict which Dependencys are applicable.
from
IDependencyContainerThe IDependencyContainer to get the Dependencys to.
AddRestriction(Requirements, Restriction)
Adds the version restriction from source
to the requirements
.
public static void AddRestriction(this Requirements requirements, Restriction source)
Parameters
requirements
Requirementssource
Restriction
AddRestrictions(Requirements, Requirements)
Adds the version restrictions from source
to the requirements
.
public static void AddRestrictions(this Requirements requirements, Requirements source)
Parameters
requirements
Requirementssource
Requirements
BucketizeImportance(IEnumerable<SolverDemand>)
Separates solver demands into buckets by importance.
public static (List<SolverDemand> essential, List<SolverDemand> recommended) BucketizeImportance(this IEnumerable<SolverDemand> demands)
Parameters
demands
IEnumerable<SolverDemand>
Returns
PurgeRestrictions(Selections)
Removes all Restrictions from Selections.
public static void PurgeRestrictions(this Selections selections)
Parameters
selections
Selections
ToSelection(SelectionCandidate, Requirements, IReadOnlyList<SelectionCandidate>)
Turns a SelectionCandidate into a ImplementationSelection.
public static ImplementationSelection ToSelection(this SelectionCandidate candidate, Requirements requirements, IReadOnlyList<SelectionCandidate> allCandidates)
Parameters
candidate
SelectionCandidateThe selection candidate.
requirements
RequirementsThe requirements the candidate was chosen for.
allCandidates
IReadOnlyList<SelectionCandidate>All candidates that were considered for selection (including
candidate
). These are used to present the user with possible alternatives.
Returns
ToSelections(IEnumerable<SelectionCandidate>, SolverDemand)
Turns SelectionCandidates into ImplementationSelections.
[LinqTunnel]
public static IEnumerable<ImplementationSelection> ToSelections(this IEnumerable<SelectionCandidate> candidates, SolverDemand demand)
Parameters
candidates
IEnumerable<SelectionCandidate>The selection candidates.
demand
SolverDemandThe solver demand the candidates were chosen for.