コード例 #1
0
 public SemanticVersionRange(SemanticVersion lower, bool lowerIsInclusive, SemanticVersion upper, bool upperIsInclusive)
 {
     Lower = lower;
     LowerIsInclusive = lowerIsInclusive;
     Upper = upper;
     UpperIsInclusive = upperIsInclusive;
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        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;
                }
            }
        }
コード例 #4
0
 public PVNode(SemanticVersion version)
 {
     Version = version;
     _children = new List<PNode>();
 }
コード例 #5
0
 public Package(string id, SemanticVersion version)
 {
     Id = id;
     Version = version;
     DependencyGroups = new Dictionary<string, Group>();
 }
コード例 #6
0
 public PVNode(SemanticVersion version, Package package)
 {
     Version = version;
     Package = package;
     _children = new List<PNode>();
 }
コード例 #7
0
 //TODO: remove this
 public SemanticVersionRange(SemanticVersion lower, bool lowerIsInclusive)
     : this(lower, lowerIsInclusive, null, false)
 {
 }
コード例 #8
0
 public SemanticVersionRange(SemanticVersion lower, SemanticVersion upper)
     : this(lower, true, upper, true)
 {
 }
コード例 #9
0
        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); };
        }