示例#1
0
        /// <summary>
        /// Returns if the other version satisfies this RelationshipDescriptor.
        /// If the RelationshipDescriptor has version set it compares against that.
        /// Else it uses the {min,max}_version fields treating nulls as unbounded.
        /// Note: Uses inclusive inequalities.
        /// </summary>
        /// <param name="other"></param>
        /// <returns>True if other_version is within the bounds</returns>
        public bool WithinBounds(ModuleVersion other)
        {
            // UnmanagedModuleVersions with unknown versions always satisfy the bound
            if (other is UnmanagedModuleVersion unmanagedModuleVersion && unmanagedModuleVersion.IsUnknownVersion)
            {
                return(true);
            }

            if (version == null)
            {
                if (max_version == null && min_version == null)
                {
                    return(true);
                }

                var minSat = min_version == null || min_version <= other;
                var maxSat = max_version == null || max_version >= other;

                if (minSat && maxSat)
                {
                    return(true);
                }
            }
            else
            {
                if (version.Equals(other))
                {
                    return(true);
                }
            }

            return(false);
        }
示例#2
0
 protected bool Equals(CkanModule other)
 {
     return(string.Equals(identifier, other.identifier) && version.Equals(other.version));
 }