Пример #1
0
        /// <summary>
        /// Method that clones each type variable of a constraint.
        /// Equivalence classes are not cloned (but included in the equivalenceClasses parameter.
        /// </summary>
        /// <param name="typeVariableMappings">Each new type varaiable represent a copy of another existing one.
        /// This parameter is a mapping between them, wher tmpName=old and value=new</param>
        /// <param name="equivalenceClasses">Each equivalence class of all the type variables.</param>
        /// <returns>The new type expression (itself by default)</returns>
        public override Constraint CloneTypeVariables(IDictionary <TypeVariable, TypeVariable> typeVariableMappings, IList <EquivalenceClass> equivalenceClasses)
        {
            FieldType      newAlpha = (FieldType)this.alpha.CloneTypeVariables(typeVariableMappings, equivalenceClasses, new List <ClassType>());
            TypeExpression newBeta  = this.beta.CloneTypeVariables(typeVariableMappings, equivalenceClasses, new List <ClassType>());
            FieldTypeAssignmentConstraint newConstraint = new FieldTypeAssignmentConstraint(newAlpha, newBeta, this.sortOfUnification);

            return(newConstraint);
        }
Пример #2
0
        public override bool Equals(object obj)
        {
            FieldTypeAssignmentConstraint ac = obj as FieldTypeAssignmentConstraint;

            if (ac == null)
            {
                return(false);
            }
            return(this.alpha.Equals(ac.alpha) && this.beta.Equals(ac.beta));
        }