Class SolverUtils
Helper functions for ISolver implementations.
Namespace: ZeroInstall.Services.Solvers
Assembly: ZeroInstall.Services.dll
Syntax
public static class SolverUtils : Object
Methods
AddCommand(ImplementationSelection, Requirements, Implementation)
Adds a Command specified in an Implementation to a ImplementationSelection.
Declaration
public static Command AddCommand(this ImplementationSelection selection, Requirements requirements, Implementation from)
Parameters
Type | Name | Description |
---|---|---|
ImplementationSelection | selection | The ImplementationSelection to add the Command to. |
Requirements | requirements | The requirements specifying which Command to extract. |
Implementation | from | The Implementation to get the Command from. |
Returns
Type | Description |
---|---|
Command | The Command that was added to |
AddDependencies(IDependencyContainer, Requirements, IDependencyContainer)
Transfers Dependencys from one IDependencyContainer to another.
Declaration
public static void AddDependencies(this IDependencyContainer target, Requirements requirements, IDependencyContainer from)
Parameters
Type | Name | Description |
---|---|---|
IDependencyContainer | target | The IDependencyContainer to add the Dependencys to. |
Requirements | requirements | The requirements which restrict which Dependencys are applicable. |
IDependencyContainer | from | The IDependencyContainer to get the Dependencys to. |
AddRestriction(Requirements, Restriction)
Adds the version restriction from source
to the requirements
.
Declaration
public static void AddRestriction(this Requirements requirements, Restriction source)
Parameters
Type | Name | Description |
---|---|---|
Requirements | requirements | |
Restriction | source |
AddRestrictions(Requirements, Requirements)
Adds the version restrictions from source
to the requirements
.
Declaration
public static void AddRestrictions(this Requirements requirements, Requirements source)
Parameters
Type | Name | Description |
---|---|---|
Requirements | requirements | |
Requirements | source |
BucketizeImportance(IEnumerable<SolverDemand>)
Separates solver demands into buckets by importance.
Declaration
public static (List<SolverDemand>, List<SolverDemand>) BucketizeImportance(this IEnumerable<SolverDemand> demands)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<SolverDemand> | demands |
Returns
Type | Description |
---|---|
(, )<List<SolverDemand>, List<SolverDemand>> |
PurgeRestrictions(Selections)
Removes all Restrictions from Selections.
Declaration
public static void PurgeRestrictions(this Selections selections)
Parameters
Type | Name | Description |
---|---|---|
Selections | selections |
ToSelection(SelectionCandidate, Requirements, IReadOnlyList<SelectionCandidate>)
Turns a SelectionCandidate into a ImplementationSelection.
Declaration
public static ImplementationSelection ToSelection(this SelectionCandidate candidate, Requirements requirements, IReadOnlyList<SelectionCandidate> allCandidates)
Parameters
Type | Name | Description |
---|---|---|
SelectionCandidate | candidate | The selection candidate. |
Requirements | requirements | The requirements the candidate was chosen for. |
IReadOnlyList<SelectionCandidate> | allCandidates | All candidates that were considered for selection (including |
Returns
Type | Description |
---|---|
ImplementationSelection |
ToSelections(IEnumerable<SelectionCandidate>, SolverDemand)
Turns SelectionCandidates into ImplementationSelections.
Declaration
public static IEnumerable<ImplementationSelection> ToSelections(this IEnumerable<SelectionCandidate> candidates, SolverDemand demand)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<SelectionCandidate> | candidates | The selection candidates. |
SolverDemand | demand | The solver demand the candidates were chosen for. |
Returns
Type | Description |
---|---|
IEnumerable<ImplementationSelection> |