Exemplo n.º 1
0
        private static bool TryGetCollidingDeclaration(INamedTypeSymbol declaredType,
                                                       INamedTypeSymbol interfaceType,
                                                       MultiValueDictionary <INamedTypeSymbol, INamedTypeSymbol> interfaceMappings,
                                                       out INamedTypeSymbol collidingDeclaration)
        {
            var collisionMapping = interfaceMappings
                                   .Where(i => i.Key.IsInterface())
                                   .FirstOrDefault(v => v.Value.Contains(interfaceType));

            if (collisionMapping.Key != null)
            {
                collidingDeclaration = collisionMapping.Key;
                return(true);
            }

            var baseClassMapping = interfaceMappings.FirstOrDefault(i => i.Key.IsClass());

            if (baseClassMapping.Key == null)
            {
                collidingDeclaration = null;
                return(false);
            }

            collidingDeclaration = baseClassMapping.Key;
            return(CanInterfaceBeRemovedBasedOnMembers(declaredType, interfaceType));
        }
Exemplo n.º 2
0
        public List <List <IntPoint> > Reduce()
        {
            KeyValuePair <IntPoint, HashSet <InternalPolyline> > keyValuePair = tablePolyline.FirstOrDefault((KeyValuePair <IntPoint, HashSet <InternalPolyline> > kvp) => kvp.Value.Count > 1);

            while (keyValuePair.Value != null)
            {
                List <InternalPolyline> list              = keyValuePair.Value.ToList();
                InternalPolyline        internalPolyline  = list[0];
                InternalPolyline        internalPolyline2 = list[1];
                RemovePolyline(internalPolyline);
                RemovePolyline(internalPolyline2);
                CombinePolyline(internalPolyline, internalPolyline2);
                keyValuePair = tablePolyline.FirstOrDefault((KeyValuePair <IntPoint, HashSet <InternalPolyline> > kvp) => kvp.Value.Count > 1);
            }
            return((from pairs in tablePolyline
                    from line in pairs.Value
                    select line into ln
                    group ln by ln.Id into grp
                    select grp.First() into l
                    select l.Points).ToList());
        }
        private static bool TryGetCollidingDeclaration(INamedTypeSymbol declaredType, INamedTypeSymbol interfaceType,
            MultiValueDictionary<INamedTypeSymbol, INamedTypeSymbol> interfaceMappings, out INamedTypeSymbol collidingDeclaration)
        {
            var collisionMapping = interfaceMappings
                .Where(i => i.Key.IsInterface())
                .FirstOrDefault(v => v.Value.Contains(interfaceType));

            if (collisionMapping.Key != null)
            {
                collidingDeclaration = collisionMapping.Key;
                return true;
            }

            var baseClassMapping = interfaceMappings.FirstOrDefault(i => i.Key.IsClass());
            if (baseClassMapping.Key == null)
            {
                collidingDeclaration = null;
                return false;
            }

            collidingDeclaration = baseClassMapping.Key;
            return CanInterfacebeRemovedbasedOnMembers(declaredType, interfaceType);
        }