Example #1
0
        /// <summary>
        /// Compares fact by priority and base attribute (<see cref="SingleEntityOperationsFacade.CompareFacts(IFact, IFact)"/>).
        /// </summary>
        /// <param name="x">First fact.</param>
        /// <param name="y">Second fact.</param>
        /// <returns>
        /// 1 - <paramref name="x"/> fact is greater than the <paramref name="y"/>,
        /// 0 - <paramref name="x"/> fact is equal than the <paramref name="y"/>,
        /// -1 - <paramref name="x"/> fact is less than the <paramref name="y"/>.
        /// </returns>
        public override int CompareFacts(IFact x, IFact y)
        {
            int defaultCompare = x.CompareTo(y);

            return(defaultCompare != 0
                ? defaultCompare
                : x.CompareByPriorityParameter(y));
        }
        /// <inheritdoc/>
        /// <remarks>Additionally checks version compatibility.</remarks>
        public override int CompareFacts(IFact x, IFact y)
        {
            int result = x.CompareTo(y);

            if (result != 0)
            {
                return(result);
            }

            result = x.CompareByPriorityParameter(y);
            if (result != 0)
            {
                return(result);
            }

            return(x.CompareByVersionParameter(y));
        }
Example #3
0
 /// <summary>
 /// Comparison of facts.
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <returns></returns>
 public virtual int CompareFacts(IFact x, IFact y)
 {
     return(x.CompareTo(y));
 }