Example #1
0
        /// <summary>
        /// Searches all packages providing the given package name and match the constraint.
        /// </summary>
        /// <param name="name">The package name to be searched for.</param>
        /// <param name="constraint">A constraint that all returned packages must match.</param>
        /// <param name="mustMatchName">Whether the name of returned packages must match the given name.</param>
        /// <param name="bypassFilters">If enabled, filterRequires and stability matching is ignored.</param>
        /// <returns>An array of match packages.</returns>
        public virtual IPackage[] WhatProvides(string name, IConstraint constraint = null, bool mustMatchName = false, bool bypassFilters = false)
        {
            if (bypassFilters)
            {
                return(ComputeWhatProvides(name, constraint, mustMatchName, bypassFilters));
            }

            var key = name + mustMatchName + constraint?.ToString();

            if (providerCache.TryGetValue(key, out IPackage[] cache))
Example #2
0
 /// <summary>
 /// Returns a <see cref="System.String"/> that represents this instance.
 /// </summary>
 /// <returns>
 /// A <see cref="System.String"/> that represents this instance.
 /// </returns>
 public override string ToString()
 {
     return(constraint.ToString());
 }
Example #3
0
        private static void PrintItemHtml(SizeableType pThis, PEREffectiveConstraint cns, StreamWriterLevel o, long itemNo, IConstraint innerTypeConstraint)
        {
            int inc = ((pThis.minItems(cns) == pThis.maxItems(cns) ? 0 : 1));
            string cssClass = "EvenRow";
            o.WriteLine("<tr class=\"" + cssClass + "\">");
            o.WriteLine("<td class=\"no\">{0}</td>", (itemNo) == -1 ? "&#8734" : (itemNo + inc).ToString());
            o.WriteLine("<td class=\"field\">Item #{0}</td>", (itemNo) == -1 ? "&#8734" : itemNo.ToString());
            o.WriteLine("<td class=\"comment\">{0}</td>", "");
            o.WriteLine("<td class=\"type\">{0}</td>", InternalTypeName(pThis));

            string withComponentPart = string.Empty;
            if (innerTypeConstraint!=null)
            {
                withComponentPart = "<span style=\"color: yellow\">";
                withComponentPart += " (" + innerTypeConstraint.ToString() + ")";
                withComponentPart += "</span>" + ICDBType.WithComponentWhy;
                ICDBackend.m_WithComponentMustBeExplained = true;
            }

            o.WriteLine("<td class=\"constraint\">{0}</td>", o.Constraint(pThis.ItemConstraint(cns) + withComponentPart));

            ArrayType ppthis = pThis as ArrayType;
            if (ppthis != null && ppthis.m_type.GetFinalType() is IntegerType && ppthis.m_type.MinBitsInPER == 0 && ppthis.m_type.MaxBitsInPER == 0)
            {
                o.WriteLine("<td class=\"min\">0{0}</td>", ICDBType.ZeroBitsWhy);
                o.WriteLine("<td class=\"max\">0{0}</td>", ICDBType.ZeroBitsWhy);
                ICDBackend.m_ZeroBitsMustBeExplained = true;
            }
            else
            {
                o.WriteLine("<td class=\"min\">{0}</td>", (pThis.minItemBitsInPER(cns) == -1 ? "&#8734" : pThis.minItemBitsInPER(cns).ToString()));
                o.WriteLine("<td class=\"max\">{0}</td>", (pThis.maxItemBitsInPER(cns) == -1 ? "&#8734" : pThis.maxItemBitsInPER(cns).ToString()));
            }
            o.WriteLine("</tr>");
        }