コード例 #1
0
ファイル: Atom.cs プロジェクト: wiselynx/ComputerAlgebra
        public override int CompareTo(Expression R)
        {
            NamedAtom RA = R as NamedAtom;

            if (!ReferenceEquals(RA, null))
            {
                int c = TypeRank.CompareTo(RA.TypeRank);
                if (c != 0)
                {
                    return(c);
                }

                // Try comparing the first 4 chars of the name.
                c = cmp.CompareTo(RA.cmp);
                if (c != 0)
                {
                    return(c);
                }

                // First 4 chars match, need to use the full compare.
                return(String.Compare(name, RA.name, StringComparison.Ordinal));
            }

            return(base.CompareTo(R));
        }
コード例 #2
0
        public override bool Equals(Expression E)
        {
            NamedAtom A = E as NamedAtom;

            if (E is null || A is null)
            {
                return(base.Equals(E));
            }
            return(Equals(name, A.name));
        }