/// <summary>
        /// Adds a series of <see cref="INamedInclusionScopeCoercion"/> elements
        /// to the <see cref="ScopeCoercionCollection"/> with the <paramref name="names"/>
        /// provided.
        /// </summary>
        /// <param name="names">The series of <see cref="String"/> values which
        /// represent the names to include within the scope to aid in identity
        /// resolution.</param>
        /// <returns>A <see cref="INamedInclusionScopeCoercion"/>.</returns>
        public INamedInclusionScopeCoercion[] AddNames(params string[] names)
        {
            if (names == null)
            {
                throw new ArgumentNullException("names");
            }
            names = (from name in names
                     orderby name
                     orderby name.Length < 6 ? 2 : name.Substring(0, 6) == "System" ? 0 : name.Length < 9 ? 2 : name.Substring(0, 9) == "Microsoft" ? 1 : 2
                     select name).ToArray();
            INamedInclusionScopeCoercion[] result = new INamedInclusionScopeCoercion[names.Length];
            for (int i = 0; i < names.Length; i++)
            {
                if (names[i] == null)
                {
                    throw new ArgumentNullException("names");
                }
                var currentElement = new NamedInclusionScopeCoercion()
                {
                    IncludedName = names[i]
                };
                result[i] = currentElement;
                lock (this.baseList)
                    this.baseList.Add(currentElement);
            }

            return(result);
        }
        /// <summary>
        /// Removes a <see cref="String"/> based <see cref="INamedInclusionScopeCoercion"/>
        /// based off of the <paramref name="name"/> provided.
        /// </summary>
        /// <param name="name">The <see cref="String"/> value associated to the
        /// <see cref="INamedInclusionScopeCoercion"/>.</param>
        /// <returns>returns true if a named inclusion was found and removed; false, otherwise.</returns>
        public bool RemoveName(string name)
        {
            INamedInclusionScopeCoercion foundItem = null;

            foreach (var element in this)
            {
                if ((element is INamedInclusionScopeCoercion) &&
                    (foundItem = (INamedInclusionScopeCoercion)element).IncludedName == name)
                {
                    break;
                }
                else
                {
                    foundItem = null;
                }
            }
            if (foundItem == null)
            {
                return(false);
            }
            lock (this.baseList)
                this.baseList.Remove(foundItem);
            return(true);
        }
Ejemplo n.º 3
0
 public abstract IScopeCoercion Transform(INamedInclusionScopeCoercion inclusion);
Ejemplo n.º 4
0
 void IScopeCoercionVisitor.Visit(INamedInclusionScopeCoercion scopeCoercion)
 {
     this.Translate(scopeCoercion);
 }
Ejemplo n.º 5
0
 TransformationImpact IInclusionVisitor <TransformationImpact> .Visit(INamedInclusionScopeCoercion inclusion)
 {
     return(CalculateRefactorImpact(inclusion));
 }
Ejemplo n.º 6
0
 public TestLinkerResult Visit(INamedInclusionScopeCoercion namedInclusion, ICompilationContext context)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 7
0
 public abstract TransformationImpact CalculateRefactorImpact(INamedInclusionScopeCoercion inclusion);
Ejemplo n.º 8
0
 public abstract void Translate(INamedInclusionScopeCoercion inclusion);
Ejemplo n.º 9
0
 public TransformationKind Visit(INamedInclusionScopeCoercion namedInclusion, ITransformationContext context)
 {
     throw new NotImplementedException();
 }