public SemanticVersionRange(SemanticVersion lower, bool lowerIsInclusive, SemanticVersion upper, bool upperIsInclusive) { Lower = lower; LowerIsInclusive = lowerIsInclusive; Upper = upper; UpperIsInclusive = upperIsInclusive; }
public bool Includes(SemanticVersion version, IComparer comparer = null) { if (comparer == null) { comparer = DefaultComparer; } int lowerComparison = comparer.Compare(Lower, version); int upperComparison = comparer.Compare(Upper, version); bool lowerCheck = (lowerComparison < 0) || (lowerComparison == 0 && LowerIsInclusive); bool upperCheck = (upperComparison > 0) || (upperComparison == 0 && UpperIsInclusive); return (lowerCheck && upperCheck); }
public SemanticVersionRange(SemanticVersion current, SemanticVersionSpan span) { //TODO: just handle MaxMinor for the moment if (span.Span == SemanticVersionSpan.SpanType.MaxMinorSpan) { SemanticVersion other = new SemanticVersion(current.Major + 1); Lower = current; LowerIsInclusive = true; Upper = other; UpperIsInclusive = false; } else { SemanticVersion other = new SemanticVersion( current.Major + span.Major, current.Minor + span.Minor, current.Patch + span.Patch); if (DefaultComparer.Compare(current, other) == 0) { Lower = current; LowerIsInclusive = true; Upper = current; UpperIsInclusive = true; } else if (DefaultComparer.Compare(current, other) > 0) { Lower = other; LowerIsInclusive = true; Upper = current; UpperIsInclusive = true; } else { Lower = current; LowerIsInclusive = true; Upper = other; UpperIsInclusive = true; } } }
public PVNode(SemanticVersion version) { Version = version; _children = new List<PNode>(); }
public Package(string id, SemanticVersion version) { Id = id; Version = version; DependencyGroups = new Dictionary<string, Group>(); }
public PVNode(SemanticVersion version, Package package) { Version = version; Package = package; _children = new List<PNode>(); }
//TODO: remove this public SemanticVersionRange(SemanticVersion lower, bool lowerIsInclusive) : this(lower, lowerIsInclusive, null, false) { }
public SemanticVersionRange(SemanticVersion lower, SemanticVersion upper) : this(lower, true, upper, true) { }
static Func<SemanticVersion, bool> Includes(SemanticVersion begin, SemanticVersionSpan span) { SemanticVersionRange range = new SemanticVersionRange(begin, span); Console.WriteLine("Adding range: {0}", range); return (version) => { return range.Includes(version); }; }