示例#1
0
        public override IFigure HitTest(Point point)
        {
            if (Dependencies != null && Dependencies.All(p => p is ImmovablePoint))
            {
                return(null);
            }

            PointPair boundingRect = Coordinates.GetBoundingRect().Inflate(CursorTolerance);

            switch (LineType)
            {
            case LineType.BeeLine:
                return(boundingRect.Contains(point) ? base.HitTest(point) : null);

            case LineType.CurvyLine:
            case LineType.JaggedLine:
                boundingRect = Coordinates.GetBoundingRect().Inflate(CursorTolerance);

                IFigure retFigure = null;
                var     basement  = Math.GetProjectionPoint(point, Coordinates);
                var     distance  = point.Distance(basement);
                if (distance < 0.2 + CursorTolerance)
                {
                    retFigure = this;
                }

                return(boundingRect.Contains(point) ? retFigure : null);
            }
            return(null);
        }
示例#2
0
文件: SubJob.cs 项目: PiSim/SAPSync
 public void CheckStatus()
 {
     if (Status == JobStatus.OnQueue && Dependencies.All(dep => dep.Status == JobStatus.Completed))
     {
         ChangeStatus(JobStatus.Ready);
     }
 }
示例#3
0
        private string BuildSql(CohortAggregateContainer container, ParameterManager parameterManager)
        {
            Dictionary <CohortQueryBuilderDependency, string> sqlDictionary;

            //if we are fully cached on everything
            if (Dependencies.All(d => d.SqlFullyCached != null))
            {
                SetTargetServer(GetCacheServer(), "all dependencies are fully cached"); //run on the cache server

                //all are cached
                CountOfCachedSubQueries = CountOfSubQueries;

                sqlDictionary = Dependencies.ToDictionary(k => k, v => v.SqlFullyCached.Use(parameterManager)); //run the fully cached sql
            }
            else
            {
                string uncached = "CacheUsageDecision is " + CacheUsageDecision +
                                  " and the following were not cached:" + string.Join(Environment.NewLine,
                                                                                      Dependencies.Where(d => d.SqlFullyCached == null));

                switch (CacheUsageDecision)
                {
                case CacheUsage.MustUse:
                    throw new QueryBuildingException(
                              "Could not build final SQL because some queries are not fully cached and " + uncached);

                case CacheUsage.Opportunistic:

                    //The cache and dataset are on the same server so run it
                    SetTargetServer(DependenciesSingleServer.GetDistinctServer(), "not all dependencies are cached while " + uncached);

                    CountOfCachedSubQueries = Dependencies.Count(d => d.SqlFullyCached != null);

                    sqlDictionary =
                        Dependencies.ToDictionary(k => k,
                                                  v => v.SqlFullyCached?.Use(parameterManager) ??
                                                  v.SqlPartiallyCached?.Use(parameterManager) ??
                                                  v.SqlCacheless.Use(parameterManager)); //run the fully cached sql
                    break;

                case CacheUsage.AllOrNothing:

                    //It's not fully cached so we have to run it entirely uncached
                    SetTargetServer(DependenciesSingleServer.GetDistinctServer(), "not all dependencies are cached while " + uncached);

                    //cannot use any of the caches because it's all or nothing
                    CountOfCachedSubQueries = 0;
                    sqlDictionary           =
                        Dependencies.ToDictionary(k => k, v => v.SqlCacheless.Use(parameterManager));     //run the fully uncached sql
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }

            return(WriteContainers(container, TargetServer.GetQuerySyntaxHelper(), sqlDictionary, 0));
        }
        public void CheckDependency(AstNode node)
        {
            var rr = Emitter.Resolver.ResolveNode(node);

            if (!rr.IsError)
            {
                var typeInfo = Emitter.H5Types.Get(rr.Type, true);

                if (typeInfo != null && typeInfo.TypeInfo != null && typeInfo.Type.FullName != Type.Type.FullName && Dependencies.All(d => d.Type.FullName != typeInfo.TypeInfo.Type.FullName))
                {
                    Dependencies.Add(typeInfo.TypeInfo);
                }
            }
        }
示例#5
0
 public bool SelfAndDependenciesInstalled()
 {
     return(IsInstalled() && Dependencies.All(x => x.SelfAndDependenciesInstalled()));
 }
示例#6
0
        public XDocument Create()
        {
            var doc      = new XDocument(new XDeclaration("1.0", "utf-8", "no"));
            var package  = new XElement(XName.Get("package"));
            var metadata = new XElement(XName.Get("metadata"));

            package.Add(metadata);
            doc.Add(package);

            metadata.Add(new XElement(XName.Get("id"), Id));
            metadata.Add(new XElement(XName.Get("version"), Version));

            if (!string.IsNullOrEmpty(MinClientVersion))
            {
                metadata.Add(new XAttribute(XName.Get("minClientVersion"), MinClientVersion));
            }

            AddIfExists(metadata, "title", Title);
            AddIfExists(metadata, "authors", Authors);
            AddIfExists(metadata, "owners", Owners);
            AddIfExists(metadata, "description", Description);
            AddIfExists(metadata, "releaseNotes", ReleaseNotes);
            AddIfExists(metadata, "summary", Summary);
            AddIfExists(metadata, "language", Language);
            AddIfExists(metadata, "projectUrl", ProjectUrl);
            AddIfExists(metadata, "iconUrl", IconUrl);
            AddIfExists(metadata, "licenseUrl", LicenseUrl);
            AddIfExists(metadata, "copyright", Copyright);
            AddIfExists(metadata, "requireLicenseAcceptance", RequireLicenseAcceptance);
            AddIfExists(metadata, "tags", Tags);
            AddIfExists(metadata, "developmentDependency", DevelopmentDependency);

            if (Dependencies.Any())
            {
                var dependencies = new XElement(XName.Get("dependencies"));
                metadata.Add(dependencies);

                if (Dependencies.All(d => d.TargetFramework.IsAny))
                {
                    foreach (var d in Dependencies.Single().Packages)
                    {
                        var dependency = new XElement(XName.Get("dependency"));

                        dependency.Add(new XAttribute(XName.Get("id"), d.Id));
                        dependency.Add(new XAttribute(XName.Get("version"), d.VersionRange.ToLegacyShortString()));

                        dependencies.Add(dependency);
                    }
                }
                else
                {
                    foreach (var group in Dependencies)
                    {
                        var groupNode = new XElement(XName.Get("group"));
                        dependencies.Add(groupNode);

                        if (!group.TargetFramework.IsAny)
                        {
                            groupNode.Add(new XAttribute(XName.Get("targetFramework"), group.TargetFramework.GetShortFolderName()));
                        }

                        foreach (var d in group.Packages)
                        {
                            var dependency = new XElement(XName.Get("dependency"));

                            dependency.Add(new XAttribute(XName.Get("id"), d.Id));
                            dependency.Add(new XAttribute(XName.Get("version"), d.VersionRange.ToLegacyShortString()));

                            groupNode.Add(dependency);
                        }
                    }
                }
            }

            if (FrameworkAssemblies.Any())
            {
                var frameworkAssemblies = new XElement(XName.Get("frameworkAssemblies"));
                metadata.Add(frameworkAssemblies);

                foreach (var fwa in FrameworkAssemblies)
                {
                    var fwaNode = new XElement(XName.Get("frameworkAssembly"));
                    frameworkAssemblies.Add(fwaNode);
                    fwaNode.Add(new XAttribute("assemblyName", fwa.Key));
                    fwaNode.Add(new XAttribute("targetFramework", string.Join(",", fwa.Value.Select(f => f.GetShortFolderName()))));
                }
            }

            return(doc);
        }