示例#1
0
 private IEnumerable <Variable> SortVariables(Summand summand)
 {
     return(summand.Variables
            .OrderBy(var => var.Name)
            .ThenBy(var => var.Degree)
            .ToList());
 }
示例#2
0
        public bool IsSimilarTo(Summand summand)
        {
            if (summand == null)
            {
                return(false);
            }

            if (Variables == null || summand.Variables == null)
            {
                return(false);
            }

            if (Variables.Length != summand.Variables.Length)
            {
                return(false);
            }

            var sortedFirstVariables  = SortVariables(this);
            var sortedSecondVariables = SortVariables(summand);

            return(sortedFirstVariables.SequenceEqual(sortedSecondVariables));
        }