Show / Hide Table of Contents

Class Requirements

A set of requirements/restrictions imposed by the user on the Implementation selection process. Used as input for the solver.

Inheritance
Object
Requirements
Implements
ICloneable<Requirements>
IEquatable<Requirements>
Namespace: ZeroInstall.Model
Assembly: ZeroInstall.Model.dll
Syntax
public class Requirements : Object

Constructors

Requirements()

Creates an empty requirements object. Use this to fill in values incrementally, e.g. when parsing command-line arguments.

Declaration
public Requirements()

Requirements(FeedUri, String, Architecture)

Creates a new requirements object.

Declaration
public Requirements(FeedUri interfaceUri, string command = null, Architecture architecture = null)
Parameters
Type Name Description
FeedUri interfaceUri

The URI or local path (must be absolute) to the interface to solve the dependencies for.

String command

The name of the command in the implementation to execute. Will default to NameRun or NameCompile if null. Will not try to find any command if set to Empty.

Architecture architecture

The architecture to find executables for. Find for the current system if left at default value.

Properties

Architecture

The architecture to find executables for. Find for the current system if left at default value.

Declaration
public Architecture Architecture { get; set; }
Property Value
Type Description
Architecture
Remarks

Will default to CurrentSystem if left at default value. Will not try to find any command if set to Empty.

Command

The name of the command in the implementation to execute. Will default to NameRun or NameCompile if null. Will not try to find any command if set to Empty.

Declaration
public string Command { get; set; }
Property Value
Type Description
String

CpuString

Used for XML and JSON serialization.

Declaration
public string CpuString { get; set; }
Property Value
Type Description
String
See Also
Architecture

Distributions

Specifies that the selected implementations must be from one of the given distributions (e.g. Debian, RPM). The special value DistributionZeroInstall may be used to require implementations provided by Zero Install (i.e. one not provided by a PackageImplementation).

Declaration
public List<string> Distributions { get; }
Property Value
Type Description
List<String>
Remarks

Used internally by solvers, copied from Distributions, not set directly by user, not serialized.

ExtraRestrictions

The ranges of versions of specific sub-implementations that can be chosen.

Declaration
public Dictionary<FeedUri, VersionRange> ExtraRestrictions { get; }
Property Value
Type Description
Dictionary<FeedUri, VersionRange>

InterfaceUri

The URI or local path (must be absolute) to the interface to solve the dependencies for.

Declaration
public FeedUri InterfaceUri { get; set; }
Property Value
Type Description
FeedUri

InterfaceUriString

Used for XML serialization.

Declaration
public string InterfaceUriString { get; set; }
Property Value
Type Description
String
See Also
InterfaceUri

Languages

The preferred languages for the implementation.

Declaration
public LanguageSet Languages { get; }
Property Value
Type Description
LanguageSet

LanguagesString

Used for XML and JSON serialization.

Declaration
public string LanguagesString { get; set; }
Property Value
Type Description
String
See Also
Languages

Message

Message to display when interacting with user.

Declaration
public string Message { get; set; }
Property Value
Type Description
String

OSString

Used for XML and JSON serialization.

Declaration
public string OSString { get; set; }
Property Value
Type Description
String
See Also
Architecture

Source

Used for XML and JSON serialization.

Declaration
public bool Source { get; set; }
Property Value
Type Description
Boolean
See Also
Architecture

Methods

AddRestriction(FeedUri, VersionRange)

Adds version restriction for a specific feeds. Merges with any existing restrictions for that feed.

Declaration
public void AddRestriction(FeedUri feedUri, VersionRange versions)
Parameters
Type Name Description
FeedUri feedUri

The feed URI to apply the restriction for.

VersionRange versions

The version range set to restrict to.

Clone()

Creates a deep copy of this Requirements instance.

Declaration
public Requirements Clone()
Returns
Type Description
Requirements

The new copy of the Requirements.

Equals(Object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
Object obj
Returns
Type Description
Boolean

Equals(Requirements)

Declaration
public bool Equals(Requirements other)
Parameters
Type Name Description
Requirements other
Returns
Type Description
Boolean

ForCurrentSystem()

Substitutes blank values with default values appropriate for the current system.

Declaration
public Requirements ForCurrentSystem()
Returns
Type Description
Requirements

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
Int32

ToCommandLineArgs()

Transforms the requirements into a command-line arguments.

Declaration
public string[] ToCommandLineArgs()
Returns
Type Description
String[]

ToString()

Returns the requirements in the form "InterfaceUri (Command)". Not safe for parsing!

Declaration
public override string ToString()
Returns
Type Description
String

Operators

Equality(Requirements, Requirements)

Indicates whether the object on the left is equal to the object on the right.

Declaration
public static bool operator ==(Requirements left, Requirements right)
Parameters
Type Name Description
Requirements left

The left object

Requirements right

The right object

Returns
Type Description
Boolean

true if the objects are equal; otherwise, false.

Implicit(FeedUri to Requirements)

Convenience cast for creating simple Requirements from a FeedUri.

Declaration
public static implicit operator Requirements(FeedUri uri)
Parameters
Type Name Description
FeedUri uri
Returns
Type Description
Requirements

Inequality(Requirements, Requirements)

Indicates whether the object on the left is not equal to the object on the right.

Declaration
public static bool operator !=(Requirements left, Requirements right)
Parameters
Type Name Description
Requirements left

The left object

Requirements right

The right object

Returns
Type Description
Boolean

true if the objects are not equal; otherwise, false.

Implements

ICloneable<T>
System.IEquatable<T>

Extension Methods

SolverUtils.AddRestriction(Requirements, Restriction)
SolverUtils.AddRestrictions(Requirements, Requirements)
In This Article
Back to top Copyright Bastian Eicher et al