当前位置: 首页>>代码示例>>C#>>正文


C# Set.Select方法代码示例

本文整理汇总了C#中Set.Select方法的典型用法代码示例。如果您正苦于以下问题:C# Set.Select方法的具体用法?C# Set.Select怎么用?C# Set.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Set的用法示例。


在下文中一共展示了Set.Select方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EdgeIsLegal

 /// <summary>
 /// edge doesn't cross obstacles
 /// NOTE: use method in CdtIntersection insetad!
 /// </summary>
 bool EdgeIsLegal(Station stationA, Station stationB, Point a, Point b) {
     var crossings = InteractiveEdgeRouter.IntersectionsOfLineAndRectangleNodeOverPolyline(new LineSegment(a, b), obstacleTree);
     Set<Polyline> obstaclesToIgnoreForBundle = ObstaclesToIgnoreForBundle(stationA, stationB);
     if (crossings.Count < 0) {
         var l = new List<DebugCurve>();
         var crossingSet = new Set<ICurve>(crossings.Select(ii => ii.Segment1));
         l.AddRange(crossingSet.Select(p=>new DebugCurve(100,1,"red",p)));
         l.AddRange(obstaclesToIgnoreForBundle.Select(p=>new DebugCurve(100,0.5,"green",p)));
         LayoutAlgorithmSettings.ShowDebugCurvesEnumeration(l);
     }
     return crossings.All(intersectionInfo => obstaclesToIgnoreForBundle.Contains((Polyline)intersectionInfo.Segment1));
 }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:16,代码来源:Intersections.cs

示例2: GenerateTest

			private LNode GenerateTest(Set<AndPred> andPreds, int lookaheadAmt, LNode laVar)
			{
				var andPredCode = andPreds.Select(andp => {
					var code = GetAndPredCode(andp, lookaheadAmt, laVar);
					return CGH.GenerateAndPredCheck(andp, code, lookaheadAmt);
				})
				.WhereNotNull()
				.OrderBy(node => node.ToString()); // sort the set so that unit tests are deterministic
				return Join(andPredCode, S.And, [email protected]);
			}
开发者ID:qwertie,项目名称:ecsharp,代码行数:10,代码来源:GenerateCodeVisitor.cs

示例3: ShowPathWithTakenEdgesAndGraph

        internal void ShowPathWithTakenEdgesAndGraph(IEnumerable<VisibilityVertex> path, Set<VisibilityEdge> takenEdges){
            var list = new List<VisibilityVertex>(path);
            var lines = new List<LineSegment>();
            for (int i = 0; i < list.Count - 1; i++)
                lines.Add(new LineSegment(list[i].Point, list[i + 1].Point));

// ReSharper disable InconsistentNaming
            double w0 = 4;
            const double w1 = 8;
            double delta = (w1 - w0)/(list.Count - 1);

            var dc = new List<DebugCurve>();
            foreach (LineSegment line in lines) {
                dc.Add(new DebugCurve(50, w0, "red", line));
                w0 += delta;
            }
            dc.AddRange(takenEdges.Select(edge => new DebugCurve(50, 2, "black", new LineSegment(edge.SourcePoint, edge.TargetPoint))));
            IEnumerable<DebugCurve> k = GetGraphDebugCurves();
            dc.AddRange(k);
            LayoutAlgorithmSettings.ShowDebugCurvesEnumeration(dc);
// ReSharper restore InconsistentNaming
        }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:22,代码来源:RectilinearEdgeRouter.cs

示例4: GraphNodes

 static IEnumerable<DebugCurve> GraphNodes(MetroGraphData metroGraphData) {
     var nodes =
         new Set<ICurve>(
             metroGraphData.Edges.Select(e => e.SourcePort.Curve).Concat(
                 metroGraphData.Edges.Select(e => e.TargetPort.Curve)));
     return nodes.Select(n => new DebugCurve(40, 1, "black", n));
 }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:7,代码来源:EdgeNudger.cs

示例5: GetLooseHierarchy

 RectangleNode<Polyline> GetLooseHierarchy() {
     var loosePolylines = new Set<Polyline>(shapesToTightLooseCouples.Values.Select(tl => (Polyline)(tl.LooseShape.BoundaryCurve)));
     return RectangleNode<Polyline>.CreateRectangleNodeOnEnumeration(loosePolylines.Select(p => new RectangleNode<Polyline>(p, p.BoundingBox)));
 }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:4,代码来源:SplineRouter.cs

示例6: EdgeSeparationIsOk

        bool EdgeSeparationIsOk(CdtEdge edge, Set<EdgeGeometry> paths, double separation) {
            double requiredWidth = paths.Select(v => v.LineWidth).Sum() + (paths.Count - 1) * separation;
            double availableWidth = edge.Capacity;

            return (requiredWidth <= availableWidth);
        }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:6,代码来源:BundleRouter.cs

示例7: CreateInteractiveEdgeRouter

        InteractiveEdgeRouter CreateInteractiveEdgeRouter(IEnumerable<Shape> obstacleShapes) {
            //we need to create a set here because one loose polyline can hold several original shapes
            var loosePolys = new Set<Polyline>(obstacleShapes.Select(sh => shapesToTightLooseCouples[sh].LooseShape.BoundaryCurve as Polyline));
            var router = new InteractiveEdgeRouter {
                VisibilityGraph = visGraph,
                TightHierarchy =
                    CreateTightObstacleHierarachy(obstacleShapes),
                LooseHierarchy =
                    CreateLooseObstacleHierarachy(loosePolys),
                UseSpanner = true,
                LookForRoundedVertices = true,
                TightPadding = tightPadding,
                LoosePadding = LoosePadding,
                UseEdgeLengthMultiplier = UseEdgeLengthMultiplier,
                UsePolylineEndShortcutting = UsePolylineEndShortcutting,
                UseInnerPolylingShortcutting = UseInnerPolylingShortcutting,
                AllowedShootingStraightLines = AllowedShootingStraightLines,
                CacheCorners = CacheCornersForSmoothing,
            };

            router.AddActivePolygons(loosePolys.Select(polyline => new Polygon(polyline)));
            return router;
        }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:23,代码来源:SplineRouter.cs

示例8: MethodImpl

        private JST.FunctionExpression MethodImpl(CST.CSTWriter trace)
        {
            if (trace != null)
                trace.Trace
                    ("Original IL method",
                     w =>
                     {
                         methEnv.Method.AppendDefinition(w);
                         w.EndLine();
                     });

            var func = ImportedMethod(trace) ?? NormalMethod(trace);

            // Simplify
            var simpCtxt = new JST.SimplifierContext(false, env.DebugMode, simpNameSupply, IsValue);
            func = (JST.FunctionExpression)func.Simplify(simpCtxt, EvalTimes.Bottom);
            if (trace != null)
                trace.Trace
                    ("After JavaScript simplification",
                     w =>
                     {
                         func.Append(w);
                         w.EndLine();
                     });

            if (env.DebugMode)
            {
                // Add debugging assistance
                var l = 0;
                Func<int> nextLine = () => { return l++; };
                var lineCountIds = new Set<JST.Identifier>();
                var debugStmnts = WithLineCounts(func.Body, nextLine, 0, lineCountIds);
                lineCountIds.Add(Constants.DebugCurrentLine);
                var debugBody = new Seq<JST.Statement>();
                debugBody.Add
                    (new JST.VariableStatement(lineCountIds.Select(id => new JST.VariableDeclaration(id)).ToSeq()));
                foreach (var s in debugStmnts.Body)
                    debugBody.Add(s);
                var exId = simpNameSupply.GenSym();
                var funcBody = new Seq<JST.Statement>();
#if !JSCRIPT_IS_CORRECT
                funcBody.Add(JST.Statement.Var(exId));
#endif
                funcBody.Add
                    (new JST.TryStatement
                         (new JST.Statements(debugBody),
                          new JST.CatchClause
                              (exId,
                               new JST.Statements
                                   (JST.Statement.DotCall(rootId.ToE(), Constants.RootDebugger, exId.ToE()),
                                    new JST.ThrowStatement(exId.ToE())))));
                func = new JST.FunctionExpression(func.Name, func.Parameters, new JST.Statements(funcBody));
            }

            if (trace != null)
                trace.Trace
                    ("Final JavaScript method",
                     w =>
                     {
                         func.Append(w);
                         w.EndLine();
                     });

            return func;
        }
开发者ID:modulexcite,项目名称:IL2JS,代码行数:65,代码来源:MethodCompiler.cs

示例9: GraphNodes

 IEnumerable<DebugCurve> GraphNodes() {
     var nodes = new Set<ICurve>(mgd.Edges.Select(e => e.SourcePort.Curve).Concat(mgd.Edges.Select(e => e.TargetPort.Curve)));
     return nodes.Select(n => new DebugCurve(100, 1, "black", n));
 }
开发者ID:danielskowronski,项目名称:network-max-flow-demo,代码行数:4,代码来源:HubDebugger.cs

示例10: GenerateCodeBehindCode

        /// <summary>
        ///   Generates the design code for an Interface Builder file.
        /// </summary>
        /// <param name = "resolver">The type resolver.</param>
        /// <param name = "writer">The writer.</param>
        /// <param name = "className">Name of the class.</param>
        /// <param name = "enumerable">The class descriptions.</param>
        /// <returns>The path to the designer file.</returns>
        public FilePath GenerateCodeBehindCode(ProjectTypeCache cache, CodeBehindWriter writer, String className, IEnumerable<IIBClassDescriptor> descriptors)
        {
            FilePath designerFile = null;
            String defaultNamespace;
            MonobjcProject project = cache.Project;

            IDELogger.Log ("BaseCodeBehindGenerator::GenerateCodeBehindCode -- Generate designer code for '{0}'", className);

            IType type = cache.ResolvePartialType (className);
            FilePath mainFile = cache.GetMainFile (type);
            if (mainFile != FilePath.Null) {
                if (mainFile.Extension == ".dll") {
                    IDELogger.Log ("BaseCodeBehindGenerator::GenerateCodeBehindCode -- Skipping '{0}' as it comes from a DLL", className);
                    return FilePath.Null;
                }

                if (!cache.IsInProject (type)) {
                    IDELogger.Log ("BaseCodeBehindGenerator::GenerateCodeBehindCode -- Skipping '{0}' as it comes from another project", className);
                    return FilePath.Null;
                }

                // The filname is based on the compilation unit parent folder and the type name
                FilePath parentDirectory = mainFile.ParentDirectory;
                FilePath filename = project.LanguageBinding.GetFileName (type.Name + Constants.DOT_DESIGNER);
                designerFile = parentDirectory.Combine (filename);
                defaultNamespace = type.Namespace;
            } else {
                // Combine the filename in the default directory
                FilePath parentDirectory = project.BaseDirectory;
                FilePath filename = project.LanguageBinding.GetFileName (className + Constants.DOT_DESIGNER);
                designerFile = parentDirectory.Combine (filename);
                defaultNamespace = project.GetDefaultNamespace (designerFile);
            }

            IDELogger.Log ("BaseCodeBehindGenerator::GenerateCodeBehindCode -- Put designer code in '{0}'", designerFile);

            // Create the compilation unit
            CodeCompileUnit ccu = new CodeCompileUnit ();
            CodeNamespace ns = new CodeNamespace (defaultNamespace);
            ccu.Namespaces.Add (ns);

            // Create the partial class
            CodeTypeDeclaration typeDeclaration = new CodeTypeDeclaration (className);
            typeDeclaration.IsClass = true;
            typeDeclaration.IsPartial = true;

            // List for import collection
            Set<String> imports = new Set<string> ();
            imports.Add ("Monobjc");

            // Create fields for outlets);
            foreach (IBOutletDescriptor outlet in descriptors.SelectMany(d => d.Outlets)) {
                IType outletType = cache.ResolvePartialType (outlet.ClassName);
                outletType = outletType ?? cache.ResolvePartialType ("id");
                outletType = outletType ?? cache.ResolveType (typeof(IntPtr));

                IDELogger.Log ("BaseCodeBehindGenerator::GenerateCodeBehindCode -- Resolving outlet '{0}' of type '{1}' => '{2}'", outlet.Name, outlet.ClassName, outletType.FullName);

                imports.Add (outletType.Namespace);

                CodeTypeMember property = this.GenerateOutletProperty (outletType, outlet.Name);
                typeDeclaration.Members.Add (property);
            }

            // Create methods for exposed actions
            foreach (IBActionDescriptor action in descriptors.SelectMany(d => d.Actions)) {
                IType argumentType = cache.ResolvePartialType (action.Argument);
                argumentType = argumentType ?? cache.ResolvePartialType ("id");
                argumentType = argumentType ?? cache.ResolveType (typeof(IntPtr));

                IDELogger.Log ("BaseCodeBehindGenerator::GenerateCodeBehindCode -- Resolving action '{0}' of type '{1}' => '{2}'", action.Message, action.Argument, argumentType.FullName);

                imports.Add (argumentType.Namespace);

                CodeTypeMember exposedMethod = this.GenerateActionExposedMethod (action.Message, argumentType);
                typeDeclaration.Members.Add (exposedMethod);

                CodeTypeMember partialMethod = this.GenerateActionPartialMethod (action.Message, argumentType);
                typeDeclaration.Members.Add (partialMethod);
            }

            // Add namespaces
            CodeNamespaceImport[] namespaceImports = imports.Select (import => new CodeNamespaceImport (import)).ToArray ();
            ns.Imports.AddRange (namespaceImports);

            // Add the type
            ns.Types.Add (typeDeclaration);

            // Write the result
            writer.WriteFile (designerFile, ccu);

            return designerFile;
//.........这里部分代码省略.........
开发者ID:Monobjc,项目名称:monobjc-monodevelop,代码行数:101,代码来源:BaseCodeBehindGenerator.cs

示例11: GenerateCodeCompileUnit

        protected virtual CodeCompileUnit GenerateCodeCompileUnit(ProjectTypeCache cache, String defaultNamespace, String className, IEnumerable<IBPartialClassDescription> enumerable)
        {
            // Create the compilation unit
            CodeCompileUnit ccu = new CodeCompileUnit ();
            CodeNamespace ns = new CodeNamespace (defaultNamespace);
            ccu.Namespaces.Add (ns);

            // Create the partial class
            CodeTypeDeclaration typeDeclaration = new CodeTypeDeclaration (className);
            typeDeclaration.IsClass = true;
            typeDeclaration.IsPartial = true;

            // List for import collection
            Set<String> imports = new Set<string> ();
            imports.Add ("Monobjc");

            // Create fields for outlets);
            foreach (IBOutletDescriptor outlet in enumerable.SelectMany(d => d.Outlets)) {
                IType outletType = cache.ResolvePartialType (outlet.ClassName);
                outletType = outletType ?? cache.ResolvePartialType ("id");
                outletType = outletType ?? cache.ResolveType (typeof(IntPtr));

                IDELogger.Log ("BaseCodeBehindGenerator::GenerateCodeBehindCode -- Resolving outlet '{0}' of type '{1}' => '{2}'", outlet.Name, outlet.ClassName, outletType.FullName);

                imports.Add (outletType.Namespace);

                CodeTypeMember property = this.GenerateOutletProperty (outletType, outlet.Name);
                typeDeclaration.Members.Add (property);
            }

            // Create methods for exposed actions
            foreach (IBActionDescriptor action in enumerable.SelectMany(d => d.Actions)) {
                IType argumentType = cache.ResolvePartialType (action.Argument);
                argumentType = argumentType ?? cache.ResolvePartialType ("id");
                argumentType = argumentType ?? cache.ResolveType (typeof(IntPtr));

                IDELogger.Log ("BaseCodeBehindGenerator::GenerateCodeBehindCode -- Resolving action '{0}' of type '{1}' => '{2}'", action.Message, action.Argument, argumentType.FullName);

                imports.Add (argumentType.Namespace);

                CodeTypeMember exposedMethod = this.GenerateActionExposedMethod (action.Message, argumentType);
                typeDeclaration.Members.Add (exposedMethod);

                CodeTypeMember partialMethod = this.GenerateActionPartialMethod (action.Message, argumentType);
                typeDeclaration.Members.Add (partialMethod);
            }

            // Add namespaces
            CodeNamespaceImport[] namespaceImports = imports.Select (import => new CodeNamespaceImport (import)).ToArray ();
            ns.Imports.AddRange (namespaceImports);

            // Add the type
            ns.Types.Add (typeDeclaration);

            return ccu;
        }
开发者ID:Monobjc,项目名称:monobjc-monodevelop,代码行数:56,代码来源:BaseCodeBehindGenerator.cs


注:本文中的Set.Select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。