Ejemplo n.º 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)
        {
            TypeVariable   newAlpha = (TypeVariable)this.alpha.CloneTypeVariables(typeVariableMappings, equivalenceClasses, new List <ClassType>());
            TypeExpression newBeta  = this.beta.CloneTypeVariables(typeVariableMappings, equivalenceClasses, new List <ClassType>());
            FieldTypeVariableAssignmentConstraint newConstraint = new FieldTypeVariableAssignmentConstraint(newAlpha, this.memberName, newBeta, this.sortOfUnification);

            return(newConstraint);
        }
Ejemplo n.º 2
0
        public override bool Equals(object obj)
        {
            FieldTypeVariableAssignmentConstraint ac = obj as FieldTypeVariableAssignmentConstraint;

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