public IVersionRequirement RestrictTo(IVersionRequirement other) { if (other is NoRequirement || other is MinimalVersionRequirement || other is LoseVersionRequirement) { return(other.RestrictTo(this)); } else if (other is BoundedVersionRequirement) { if (IsMetBy((other as BoundedVersionRequirement).lowerBound)) { return(other); } if ((other as BoundedVersionRequirement).IsMetBy(lowerBound)) { return(this); } } else if (other is ExactVersionRequirement) { if (IsMetBy((other as ExactVersionRequirement).expected)) { return(other); } } throw new IncompatibleRequirementException(this, other); }
public IVersionRequirement RestrictTo(IVersionRequirement other) { if (other is NoRequirement) { return(other.RestrictTo(this)); } else if (other is MinimalVersionRequirement) { return(minimal >= (other as MinimalVersionRequirement).minimal ? this : other); } else if (other is LoseVersionRequirement) { if (minimal <= (other as LoseVersionRequirement).stub) { return(other); } } else if (other is BoundedVersionRequirement) { if (minimal <= (other as BoundedVersionRequirement).lowerBound) { return(other); } } else if (other is ExactVersionRequirement) { if (minimal <= (other as ExactVersionRequirement).expected) { return(other); } } throw new IncompatibleRequirementException(this, other); }
public IVersionRequirement RestrictTo(IVersionRequirement other) { if (other is NoRequirement) { return(other.RestrictTo(this)); } else if (other is MinimalVersionRequirement) { return(minimal >= (other as MinimalVersionRequirement).minimal ? this : other); } else if (other is RangeVersionRequirement) { if (minimal <= (other as RangeVersionRequirement).lower) { return(other); } if (other.IsMetBy(minimal)) { return(new RangeVersionRequirement( minimal, (other as RangeVersionRequirement).upper)); } } else if (other is ExactVersionRequirement) { if (minimal <= (other as ExactVersionRequirement).expected) { return(other); } } throw new IncompatibleRequirementException(this, other); }
public override IVersionRequirement RestrictTo(IVersionRequirement other) { if (other is LoseVersionRequirement) { return((other as LoseVersionRequirement).RestrictTo(this as BoundedVersionRequirement)); } return(base.RestrictTo(other)); }
public void ParseLoseRequirement() { IVersionRequirement parsed = VersionParser.ParseRequirement("1.2"); Assert.IsTrue(parsed is LoseVersionRequirement); Assert.AreEqual((parsed as LoseVersionRequirement).stub, new Version { Major = 1, Minor = 2 }); }
public void ParseMinimalRequirement() { IVersionRequirement parsed = VersionParser.ParseRequirement("1.2+"); Assert.IsTrue(parsed is MinimalVersionRequirement); Assert.AreEqual((parsed as MinimalVersionRequirement).minimal, new Version { Major = 1, Minor = 2 }); }
public void ParseBoundedRequirement() { IVersionRequirement parsed = VersionParser.ParseRequirement("1.2.*"); Assert.IsTrue(parsed is BoundedVersionRequirement); Assert.AreEqual((parsed as BoundedVersionRequirement).lower, new Version { Major = 1, Minor = 2 }); }
public void ParseExactRequirement() { IVersionRequirement parsed = VersionParser.ParseRequirement("1.2.3!"); Assert.IsTrue(parsed is ExactVersionRequirement); Assert.AreEqual((parsed as ExactVersionRequirement).expected, new Version { Major = 1, Minor = 2, Patch = 3 }); }
public override IVersionRequirement RestrictTo(IVersionRequirement other) { if (other is BoundedVersionRequirement) { if (IsMetBy((other as BoundedVersionRequirement).lower)) { return(other); } } return(base.RestrictTo(other)); }
public void ParseRangeRequirement() { IVersionRequirement parsed = VersionParser.ParseRequirement("1.2,3.4"); Assert.IsTrue(parsed is RangeVersionRequirement); Assert.AreEqual((parsed as RangeVersionRequirement).lower, new Version { Major = 1, Minor = 2 }); Assert.AreEqual((parsed as RangeVersionRequirement).upper, new Version { Major = 3, Minor = 4 }); }
public DependencyNode(string name, string version, string repository, SkipInstallSpec[] skips, OverrideDestinationSpec[] overrides, List <DependencyNode> dependencies) { this.name = name; this.requirement = VersionParser.ParseRequirement(version); this.repository = repository; this.dependencies = dependencies; this.skips = skips; this.overrides = overrides; index = -1; lowlink = -1; }
public virtual IVersionRequirement RestrictTo(IVersionRequirement other) { if (other is NoRequirement || other is MinimalVersionRequirement) { return(other.RestrictTo(this)); } else if (other is RangeVersionRequirement) { var otherRange = other as RangeVersionRequirement; if (lower == otherRange.lower && upper == otherRange.upper) { return(this); } // self include other? if (IsMetBy(otherRange.lower) && IsMetBy(otherRange.upper)) { return(other); } // other include self? if (other.IsMetBy(lower) && other.IsMetBy(upper)) { return(this); } // They are overlapping or not intersecting // overlap top? if (IsMetBy(otherRange.lower) && other.IsMetBy(upper)) { return(new RangeVersionRequirement( otherRange.lower, this.upper )); } // overlap bottom? if (IsMetBy(otherRange.upper) && other.IsMetBy(lower)) { return(new RangeVersionRequirement( this.lower, otherRange.upper )); } } else if (other is ExactVersionRequirement) { if (IsMetBy((other as ExactVersionRequirement).expected)) { return(other); } } throw new IncompatibleRequirementException(this, other); }
public IVersionRequirement RestrictTo(IVersionRequirement other) { if (other is ExactVersionRequirement) { if (IsMetBy((other as ExactVersionRequirement).expected)) { return(this); } } else { return(other.RestrictTo(this)); } throw new IncompatibleRequirementException(this, other); }
public static bool IsMetBy(this IVersionRequirement requirement, string version) { return(requirement.IsMetBy(VersionParser.ParseIncompleteVersion(version))); }
protected void Given() { requirement = new NoRequirement(); }
protected void Given() { // 1.0+ requirement = new MinimalVersionRequirement("1.0"); }
protected void Given() { // 1.0 requirement = new LoseVersionRequirement("1.0"); }
public IncompatibleRequirementException(IVersionRequirement a, IVersionRequirement b) : this(string.Format("Requirements {0} and {1} are not compatible", a.ToString(), b.ToString())) { }
public IVersionRequirement RestrictTo(IVersionRequirement other) { return(other); }
protected void Given() { // 1.5,3.5 requirement = new RangeVersionRequirement("1.5", "3.5"); }
protected void Given() { // 1.0! requirement = new ExactVersionRequirement("1.0"); }
protected void Given() { // 1.0.* requirement = new BoundedVersionRequirement("1.0"); }