示例#1
0
        public virtual HostService CreateHostService(
            DocumentBuildParameters parameters,
            TemplateProcessor templateProcessor,
            IMarkdownService markdownService,
            IEnumerable <IInputMetadataValidator> metadataValidator,
            IDocumentProcessor processor,
            IEnumerable <FileAndType> files)
        {
            var(models, invalidFiles) = LoadModels(files, parameters, processor);
            var hostService = new HostService(
                parameters.Files.DefaultBaseDir,
                models,
                parameters.VersionName,
                parameters.VersionDir,
                parameters.LruSize,
                parameters.GroupInfo,
                new BuildParameters(parameters.TagParameters))
            {
                MarkdownService            = markdownService,
                Processor                  = processor,
                Template                   = templateProcessor,
                Validators                 = metadataValidator?.ToImmutableList(),
                ShouldTraceIncrementalInfo = ShouldProcessorTraceInfo(processor),
                CanIncrementalBuild        = CanProcessorIncremental(processor),
                InvalidSourceFiles         = invalidFiles.ToImmutableList(),
            };

            return(hostService);
        }
示例#2
0
        internal Transaction(
            long nonce,
            Address signer,
            PublicKey publicKey,
            IImmutableSet <Address> updatedAddresses,
            DateTimeOffset timestamp,
            IEnumerable <T> actions,
            byte[] signature,
            bool validate)
        {
            Nonce            = nonce;
            Signer           = signer;
            UpdatedAddresses = updatedAddresses ??
                               throw new ArgumentNullException(nameof(updatedAddresses));
            Signature = signature ??
                        throw new ArgumentNullException(nameof(signature));
            Timestamp = timestamp;
            Actions   = actions?.ToImmutableList() ??
                        throw new ArgumentNullException(nameof(actions));
            PublicKey = publicKey ??
                        throw new ArgumentNullException(nameof(publicKey));

            using (var hasher = SHA256.Create())
            {
                byte[] payload = Serialize(true);
                Id = new TxId(hasher.ComputeHash(payload));
            }

            if (validate)
            {
                Validate();
            }
        }
示例#3
0
        public virtual HostService CreateHostService(
            DocumentBuildParameters parameters,
            TemplateProcessor templateProcessor,
            IMarkdownService markdownService,
            IEnumerable <IInputMetadataValidator> metadataValidator,
            IDocumentProcessor processor,
            IEnumerable <FileAndType> files)
        {
            var hostService = new HostService(
                parameters.Files.DefaultBaseDir,
                files == null
                    ? Enumerable.Empty <FileModel>()
                    : from file in files
                select Load(processor, parameters.Metadata, parameters.FileMetadata, file) into model
                where model != null
                select model,
                parameters.VersionName,
                parameters.VersionDir,
                parameters.LruSize,
                parameters.GroupInfo)
            {
                MarkdownService            = markdownService,
                Processor                  = processor,
                Template                   = templateProcessor,
                Validators                 = metadataValidator?.ToImmutableList(),
                ShouldTraceIncrementalInfo = ShouldProcessorTraceInfo(processor),
                CanIncrementalBuild        = CanProcessorIncremental(processor),
            };

            return(hostService);
        }
示例#4
0
        public Exercise(ILoggerService loggerService, ISpeechService speechService, string name, int setCount, int repetitionCount, IEnumerable <MatcherWithAction> matchersWithActions)
        {
            loggerService.AssertNotNull(nameof(loggerService));
            speechService.AssertNotNull(nameof(speechService));
            name.AssertNotNull(nameof(name));
            matchersWithActions.AssertNotNull(nameof(matchersWithActions));

            if (setCount < 0)
            {
                throw new ArgumentException("setCount cannot be less than zero.", "setCount");
            }

            if (repetitionCount < 0)
            {
                throw new ArgumentException("repetitionCount cannot be less than zero.", "repetitionCount");
            }

            this.logger              = loggerService.GetLogger(this.GetType());
            this.speechService       = speechService;
            this.name                = name;
            this.setCount            = setCount;
            this.repetitionCount     = repetitionCount;
            this.matchersWithActions = matchersWithActions.ToImmutableList();

            using (var dummyExecutionContext = new ExecutionContext())
            {
                this.duration = this
                                .GetEventsWithActions(dummyExecutionContext)
                                .SelectMany(x => x.Actions)
                                .Select(x => x.Duration)
                                .DefaultIfEmpty()
                                .Aggregate((running, next) => running + next);
            }
        }
示例#5
0
 public WorkerState(
     IEnumerable <HostState> hosts,
     string fileStorePath)
 {
     Hosts         = hosts?.ToImmutableList();
     FileStorePath = fileStorePath;
 }
 public ASTCILTypeNode(CoolType type, IEnumerable <CoolMethod> virtualTable,
                       IEnumerable <ASTCILFuncNode> methods) : base()
 {
     Type         = type;
     Methods      = methods.ToImmutableList();
     VirtualTable = virtualTable.ToImmutableList();
 }
示例#7
0
        public Executor(
            IEnumerable <Handler <TDataImplements> > handlers = null,
            ExecutorOptions options = null)
        {
            _allHandlers = handlers?.ToImmutableList()
                           ?? ImmutableList <Handler <TDataImplements> > .Empty;

            _handlers = _allHandlers.Aggregate(
                ImmutableDictionary <Type, ImmutableList <Func <TDataImplements, Task> > > .Empty,
                (result, handler) =>
            {
                if (!result.ContainsKey(handler.DataType))
                {
                    return(result.Add(
                               handler.DataType,
                               ImmutableList <Func <TDataImplements, Task> > .Empty.Add(handler.HandleAsync)
                               ));
                }


                return(result.SetItem(
                           handler.DataType,
                           result[handler.DataType].Add(handler.HandleAsync)
                           ));
            });

            DataTypes = _handlers.Keys.ToImmutableList();

            _options = options ?? ExecutorOptions.Default;
        }
示例#8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SelectionResultMessage{TResult}" /> class.
        /// </summary>
        /// <param name="orderedGenomes">
        /// The best genomes found, ordered by fitness.
        /// </param>
        /// <param name="genomeToRank">
        /// Genome with a rank for every tournament it participated in.
        /// </param>
        /// <param name="generationBest">
        /// The incumbent genome.
        /// </param>
        /// <param name="generationBestResult">
        /// The result of the incumbent genome.
        /// </param>
        public SelectionResultMessage(
            ImmutableList <ImmutableGenome> orderedGenomes,
            Dictionary <ImmutableGenome, List <GenomeTournamentResult> > genomeToRank,
            ImmutableGenome generationBest,
            IEnumerable <TResult> generationBestResult)
        {
            // Verify parameter.
            if (orderedGenomes == null)
            {
                throw new ArgumentNullException("orderedGenomes");
            }

            if (ReferenceEquals(generationBest, null))
            {
                throw new ArgumentNullException(nameof(generationBest));
            }

            Debug.Assert(
                new ImmutableGenome.GeneValueComparer().Equals(orderedGenomes.FirstOrDefault(), generationBest),
                "Incumbent should be in first position of ordered genome list.");

            this.CompetitiveParents   = orderedGenomes.ToImmutableList();
            this.GenomeToRank         = genomeToRank.ToImmutableDictionary(new ImmutableGenome.GeneValueComparer());
            this.GenerationBest       = generationBest;
            this.GenerationBestResult = generationBestResult.ToImmutableList();
        }
示例#9
0
 public static IImmutableList <T> ToImmutableListDefaultEmpty <T>(
     this IEnumerable <T> list)
 {
     return(list
            ?.ToImmutableList()
            ?? ImmutableList <T> .Empty);
 }
示例#10
0
 /// <summary>
 /// Creates a new call prototype syntax tree
 /// </summary>
 /// <param name="name">The name of the function</param>
 /// <param name="arguments">The arguments</param>
 /// <param name="isOperator">Indicates if the current prototype is a operator</param>
 /// <param name="precedence">The operator precedence</param>
 public PrototypeSyntaxTree(string name, IEnumerable <string> arguments, bool isOperator = false, int precedence = 0)
 {
     this.name       = name;
     this.arguments  = arguments.ToImmutableList();
     this.isOperator = isOperator;
     this.precedence = precedence;
 }
示例#11
0
 public Area(IEnumerable <DraggableCoordinate> coordinates, string note, bool isSelected, bool isDefined)
 {
     Coordinates = coordinates?.ToImmutableList() ?? throw new ArgumentNullException(nameof(coordinates));
     Note        = note ?? throw new ArgumentNullException(nameof(note));
     IsSelected  = isSelected;
     IsDefined   = isDefined;
 }
示例#12
0
        /// <summary>
        /// Saves all the given entities.
        /// </summary>
        /// <param name="entities">
        /// The entities to save.
        /// </param>
        /// <returns>
        /// An observable that ticks the saved entities, which may differ from <paramref name="entities"/> (such as updated IDs).
        /// </returns>
        public IObservable <IImmutableList <TEntity> > SaveAll(IEnumerable <TEntity> entities)
        {
            Ensure.ArgumentNotNull(entities, nameof(entities), assertContentsNotNull: true);
            var entitiesList = entities.ToImmutableList();

            return(Observable
                   .Defer(
                       () =>
                       Observable
                       .Start(
                           () =>
                           this
                           .repository
                           .SaveAll(entitiesList),
                           this.dataStoreScheduler))
                   .Do(
                       savedEntities =>
            {
                for (var i = 0; i < entitiesList.Count; ++i)
                {
                    if (!entitiesList[i].Id.HasValue)
                    {
                        this.addedItemsSynchronized.OnNext(savedEntities[i]);
                    }
                    else
                    {
                        this.updatedItemsSynchronized.OnNext(savedEntities[i]);
                    }
                }
            }));
        }
示例#13
0
 private DiscoveryServerBuilder(IConfigWatcher configWatcher, IEnumerable <IDiscoveryServerCallbacks> callbacks, int port)
 {
     _configWatcher = configWatcher;
     _callbacks     = callbacks.ToImmutableList();
     _port          = port;
     _useHttps      = true;
 }
示例#14
0
        public Exercise(ILoggerService loggerService, ISpeechService speechService, string name, int setCount, int repetitionCount, IEnumerable<MatcherWithAction> matchersWithActions)
        {
            loggerService.AssertNotNull(nameof(loggerService));
            speechService.AssertNotNull(nameof(speechService));
            name.AssertNotNull(nameof(name));
            matchersWithActions.AssertNotNull(nameof(matchersWithActions));

            if (setCount < 0)
            {
                throw new ArgumentException("setCount cannot be less than zero.", "setCount");
            }

            if (repetitionCount < 0)
            {
                throw new ArgumentException("repetitionCount cannot be less than zero.", "repetitionCount");
            }

            this.logger = loggerService.GetLogger(this.GetType());
            this.speechService = speechService;
            this.name = name;
            this.setCount = setCount;
            this.repetitionCount = repetitionCount;
            this.matchersWithActions = matchersWithActions.ToImmutableList();

            using (var dummyExecutionContext = new ExecutionContext())
            {
                this.duration = this
                    .GetEventsWithActions(dummyExecutionContext)
                    .SelectMany(x => x.Actions)
                    .Select(x => x.Duration)
                    .DefaultIfEmpty()
                    .Aggregate((running, next) => running + next);
            }
        }
示例#15
0
        public static Message CreateMessage(
            string messageType,
            IEnumerable <MessageHash> predecessors,
            Guid objectId,
            object body)
        {
            // Convert the anonymous typed object to an ExpandoObject.
            var expandoBody = JsonConvert.DeserializeObject <ExpandoObject>(
                JsonConvert.SerializeObject(body));
            object document = new
            {
                MessageType  = messageType,
                Predecessors = predecessors
                               .Select(p => p.ToString())
                               .ToArray(),
                ObjectId = objectId,
                Body     = expandoBody
            };
            var messageHash = new MessageHash(ComputeHash(document));

            return(new Message(
                       messageType,
                       predecessors.ToImmutableList(),
                       objectId,
                       expandoBody,
                       messageHash));
        }
        public Result <AverageSpeed> Convert(List <ActivityDto> source, Result <AverageSpeed> destination, ResolutionContext context)
        {
            IEnumerable <float> speedsFromDto   = source.Select(p => p.average_speed);
            IEnumerable <Speed> convertedSpeeds = speedsFromDto.Select(Convert);

            return(AverageSpeed.Create(convertedSpeeds.ToImmutableList()));
        }
示例#17
0
        internal Transaction(
            long nonce,
            Address signer,
            PublicKey publicKey,
            HashDigest <SHA256>?genesisHash,
            IImmutableSet <Address> updatedAddresses,
            DateTimeOffset timestamp,
            IEnumerable <T> actions,
            byte[] signature,
            bool validate)
        {
            Nonce            = nonce;
            Signer           = signer;
            GenesisHash      = genesisHash;
            UpdatedAddresses = updatedAddresses ??
                               throw new ArgumentNullException(nameof(updatedAddresses));
            Signature = signature ??
                        throw new ArgumentNullException(nameof(signature));
            Timestamp = timestamp;
            Actions   = actions?.ToImmutableList() ??
                        throw new ArgumentNullException(nameof(actions));
            PublicKey = publicKey ??
                        throw new ArgumentNullException(nameof(publicKey));

            if (validate)
            {
                Validate();
            }
        }
示例#18
0
 private OptionSchemaImpl(IEnumerable <Spec> p)
 {
     all          = p.ToImmutableList();
     nameMap      = p.ToImmutableDictionary(o => o.Name);
     shortNameMap = p.Where(o => o.ShortName.HasValue)
                    .ToImmutableDictionary(o => o.ShortName.GetValueOrDefault());
 }
示例#19
0
 public PhotoSet(string id, PhotoSetType type, string displayName, IEnumerable<Photo> photos)
 {
     this.Id = id;
     this.Type = type;
     this.DisplayName = displayName;
     this.Photos = photos.ToImmutableList();
 }
示例#20
0
        public CodeIndexerService(IEnumerable <SyntaxTree> syntaxTrees, Func <SyntaxTree, SemanticModel> getSemanticModel)
        {
            _getSemanticModel      = getSemanticModel;
            _interfaceDeclarations = new Dictionary <string, List <InterfaceDeclarationSyntax> >();
            _classDeclarations     = new Dictionary <string, List <ClassDeclarationSyntax> >();

            var syntaxTreesList = syntaxTrees.ToImmutableList();

            foreach (var syntaxTree in syntaxTreesList)
            {
                Utilities.TraverseTree(syntaxTree.GetRoot(), node =>
                {
                    if (node is InterfaceDeclarationSyntax interfaceDeclarationSyntax)
                    {
                        if (!_interfaceDeclarations.ContainsKey(interfaceDeclarationSyntax.Identifier.Text))
                        {
                            _interfaceDeclarations[interfaceDeclarationSyntax.Identifier.Text] = new List <InterfaceDeclarationSyntax>();
                        }

                        _interfaceDeclarations[interfaceDeclarationSyntax.Identifier.Text].Add(interfaceDeclarationSyntax);
                    }
                    else if (node is ClassDeclarationSyntax classDeclarationSyntax)
                    {
                        if (!_classDeclarations.ContainsKey(classDeclarationSyntax.Identifier.Text))
                        {
                            _classDeclarations[classDeclarationSyntax.Identifier.Text] = new List <ClassDeclarationSyntax>();
                        }

                        _classDeclarations[classDeclarationSyntax.Identifier.Text].Add(classDeclarationSyntax);
                    }
                });
            }
        }
示例#21
0
 public Function(Token name, IEnumerable <Parameter> parameters, IEnumerable <Stmt> body, TypeReference returnTypeReference)
 {
     Name                = name;
     Parameters          = parameters.ToImmutableList();
     Body                = body.ToImmutableList();
     ReturnTypeReference = returnTypeReference;
 }
示例#22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ParameterConfigurationSpaceSpecification"/> class.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        /// <param name="parameterActivityConditions">
        /// A mapping from parameter identifiers to conditions determining whether it is active.
        /// </param>
        /// <param name="forbiddenParameterCombinations">Forbidden parameter combinations.</param>
        public ParameterConfigurationSpaceSpecification(
            IEnumerable <IParameterNode> parameters,
            Dictionary <string, List <EqualsCondition> > parameterActivityConditions,
            IEnumerable <ForbiddenParameterCombination> forbiddenParameterCombinations)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }

            if (parameterActivityConditions == null)
            {
                throw new ArgumentNullException(nameof(parameterActivityConditions));
            }

            if (forbiddenParameterCombinations == null)
            {
                throw new ArgumentNullException(nameof(forbiddenParameterCombinations));
            }

            this.Parameters = parameters.ToImmutableList();
            if (!this.Parameters.Any())
            {
                throw new ArgumentOutOfRangeException(nameof(parameters), "No parameters have been given.");
            }

            this.ParameterActivityConditions = parameterActivityConditions.ToImmutableDictionary(
                keyAndValue => keyAndValue.Key,
                keyAndValue => keyAndValue.Value.ToImmutableList());
            this.ForbiddenParameterCombinations = forbiddenParameterCombinations.ToImmutableList();
        }
示例#23
0
 public TargetFeedConfig(TargetFeedContentType contentType,
                         string targetURL,
                         FeedType type,
                         string token,
                         List <string> latestLinkShortUrlPrefixes = null,
                         AssetSelection assetSelection            = AssetSelection.All,
                         bool isolated       = false,
                         bool @internal      = false,
                         bool allowOverwrite = false,
                         SymbolTargetType symbolTargetType       = SymbolTargetType.None,
                         IEnumerable <string> filenamesToExclude = null,
                         bool flatten = true)
 {
     ContentType                = contentType;
     TargetURL                  = targetURL;
     Type                       = type;
     Token                      = token;
     AssetSelection             = assetSelection;
     Isolated                   = isolated;
     Internal                   = @internal;
     AllowOverwrite             = allowOverwrite;
     LatestLinkShortUrlPrefixes = latestLinkShortUrlPrefixes ?? new List <string>();
     SymbolTargetType           = symbolTargetType;
     FilenamesToExclude         = filenamesToExclude?.ToImmutableList() ?? ImmutableList <string> .Empty;
     Flatten                    = flatten;
 }
示例#24
0
        public CompositeProvider
        (
            [NotNull] IEnumerable <IResourceProvider> resourceProviders,
            IImmutableSession metadata = default
        )
            : base(new[] { DefaultScheme }, metadata ?? ImmutableSession.Empty)
        {
            if (resourceProviders == null)
            {
                throw new ArgumentNullException(nameof(resourceProviders));
            }

            _cache             = new Dictionary <SoftString, IResourceProvider>();
            _resourceProviders = resourceProviders.ToImmutableList();
            var duplicateProviderNames =
                _resourceProviders
                .Where(p => p.CustomName)
                .GroupBy(p => p.CustomName)
                .Where(g => g.Count() > 1)
                .Select(g => g.First())
                .ToList();

            if (duplicateProviderNames.Any())
            {
                throw new ArgumentException
                      (
                          $"Providers must use unique custom names but there are some duplicates: " +
                          $"[{duplicateProviderNames.Select(p => (string)p.CustomName).Join(", ")}]."
                      );
            }
        }
示例#25
0
 public Converter(
     IEnumerable <string> sourceFilePaths,
     string resultFilePath)
 {
     ResultFilePath = resultFilePath;
     ImagePaths     = sourceFilePaths.ToImmutableList();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="PartialGenomeEvaluationResults{TResult}"/> class.
        /// </summary>
        /// <remarks>
        /// Internal because this should be used in combination with <see cref="GenomeEvaluationFinished"/> only.
        /// </remarks>
        /// <param name="evaluationId">
        /// The evaluation identifier as specified by the <see cref="GenomeEvaluation"/> request.
        /// </param>
        /// <param name="runResults">
        /// Results of target algorithm runs.
        /// </param>
        internal PartialGenomeEvaluationResults(int evaluationId, IEnumerable <TResult> runResults)
        {
            this.EvaluationId = evaluationId;

            // Copy the fields over s.t. the message is immutable.
            this.RunResults = runResults?.ToImmutableList() ?? throw new ArgumentNullException(nameof(runResults));
        }
示例#27
0
        public IEnumerable <HistoryData> CommitRange(long characterId, IEnumerable <HistoryData> data, bool saveChange)
        {
            if (data == null)
            {
                throw new InvalidOperationException();
            }

            var snapshot = data.ToImmutableList();
            var search   = snapshot.Select(x => new { x.World, x.PurchaseTime });
            var source   = _context.HistoryData
                           .Where(x => search.Contains(new { x.World, x.PurchaseTime }))
                           .Select(x => new { x.World, x.PurchaseTime });
            var bucket = Guid.NewGuid();

            var insert = snapshot
                         .Where(x => source.All(y => y != new { x.World, x.PurchaseTime }))
                         .Select(
                x =>
            {
                x.BucketId   = bucket;
                x.ReporterId = characterId;
                return(x);
            });

            _context.HistoryData.AddRange(insert);

            if (saveChange)
            {
                _context.SaveChanges();
            }

            return(insert);
        }
示例#28
0
 public State(string title, double mapZoomLevel, Coordinate center, IEnumerable <Area> areas)
 {
     Title        = title;
     MapZoomLevel = mapZoomLevel;
     Center       = center ?? throw new ArgumentNullException(nameof(center));
     Areas        = areas?.ToImmutableList() ?? throw new ArgumentNullException(nameof(areas));
 }
示例#29
0
 public UpdatePackageInfo(SemVersion version, string?description, IDictionary <string, string>?customFields,
                          IEnumerable <UpdateFileInfo> files, IEnumerable <UpdateChangelogInfo>?changelogs,
                          IEnumerable <UpdatePackageDistributionInfo>?distribution)
     : this(version, description, customFields?.ToImmutableDictionary(), files.ToImmutableList(), changelogs?.ToImmutableList(),
            distribution?.ToImmutableList())
 {
 }
示例#30
0
 internal ExpectedMarbles(string sequence, IEnumerable <ExpectedMarble> expectations)
 {
     Sequence     = sequence;
     Expectations = expectations.ToImmutableList();
     FirstTime    = Expectations.Min(e => e.Time);
     LastTime     = Expectations.Max(e => e.Time);
 }
示例#31
0
 /// <summary>
 /// Constructs a new <see cref="BattleResult"/> with the given list of <see cref="RoundResult"/>s, winner, final attacker, and final
 /// defender.
 /// </summary>
 /// <param name="rounds">The list of round results. Note that it will be converted to an <see cref="ImmutableList"/>.</param>
 /// <param name="winner">The winner of the battle.</param>
 /// <param name="finalAttacker">The final attacking army left over after the battle; may be empty.</param>
 /// <param name="finalDefender">The final defending army left over after the battle; may be empty.</param>
 public BattleResult(IEnumerable <RoundResult> rounds, BattleWinner winner, Army finalAttacker, Army finalDefender)
 {
     Rounds        = rounds.ToImmutableList();
     Winner        = winner;
     FinalAttacker = finalAttacker;
     FinalDefender = finalDefender;
 }
示例#32
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GgaResult{TResult}" /> class.
        /// </summary>
        /// <param name="competitiveParents">
        /// The best genomes found, ordered by fitness.
        /// </param>
        /// <param name="genomeToTournamentRank">
        /// Genome with a rank for every tournament it participated in.
        /// </param>
        /// <param name="generationBest">
        /// The incumbent genome.
        /// </param>
        /// <param name="generationBestResult">
        /// The result of the incumbent genome.
        /// </param>
        public GgaResult(
            List <ImmutableGenome> competitiveParents,
            Dictionary <ImmutableGenome, List <GenomeTournamentRank> > genomeToTournamentRank,
            ImmutableGenome generationBest,
            IEnumerable <TResult> generationBestResult)
        {
            if (competitiveParents == null)
            {
                throw new ArgumentNullException(nameof(competitiveParents));
            }

            if (generationBest == null)
            {
                throw new ArgumentNullException(nameof(generationBest));
            }

            Debug.Assert(
                ImmutableGenome.GenomeComparer.Equals(competitiveParents.First(), generationBest),
                "The incumbent should be in first position of ordered genome list.");

            this.CompetitiveParents     = competitiveParents.ToImmutableList();
            this.GenomeToTournamentRank = genomeToTournamentRank.ToImmutableDictionary(ImmutableGenome.GenomeComparer);
            this.GenerationBest         = generationBest;
            this.GenerationBestResult   = generationBestResult.ToImmutableList();
        }
示例#33
0
 public XRefCollection(IEnumerable<Uri> uris)
 {
     if (uris == null)
     {
         throw new ArgumentNullException(nameof(uris));
     }
     Uris = uris.ToImmutableList();
 }
 public FSharpCompilationFailure(
   string filePath,
   IEnumerable<FSharpCompilationMessage> messages)
 {
   _filePath = filePath;
   _fileContent = File.Exists(filePath) ? File.ReadAllText(filePath) : null;
   _messages = messages.ToImmutableList();
 }
示例#35
0
 public ValuesEntity(string id, DateTimeOffset createdOn, DateTimeOffset lastModifiedOn, DateTimeOffset lastAccessedOn, IEnumerable<string> values = null)
 {
     this.Id = id;
     this.CreatedOn = createdOn;
     this.LastModifiedOn = lastModifiedOn;
     this.LastAccessedOn = lastAccessedOn;
     this.Values = values == null ? ImmutableList<string>.Empty : values.ToImmutableList();
 }
示例#36
0
 public Configuration(
     IEnumerable<Transformation> namespaceTransformations,
     IEnumerable<Transformation> nameTransformations,
     IEnumerable<Filter> interfaceFilters)
 {
     this.namespaceTransformations = namespaceTransformations.ToImmutableList();
     this.nameTransformations = nameTransformations.ToImmutableList();
     this.interfaceFilters = interfaceFilters.ToImmutableList();
 }
        public MetronomeAction(IAudioService audioService, IDelayService delayService, ILoggerService loggerService, IEnumerable<MetronomeTick> ticks)
        {
            audioService.AssertNotNull(nameof(audioService));
            delayService.AssertNotNull(nameof(delayService));
            loggerService.AssertNotNull(nameof(loggerService));
            ticks.AssertNotNull(nameof(ticks));

            this.ticks = ticks.ToImmutableList();
            this.innerAction = new SequenceAction(GetInnerActions(audioService, delayService, loggerService, this.ticks));
        }
示例#38
0
 public SearchMethodInfo(SearchTypeInfo type, string methodName, IEnumerable<string> parameters = null,
     IEnumerable<string> typeParameters = null, bool? isStatic = null, bool? isAbstract = null)
 {
     Type = type;
     MethodName = methodName;
     Parameters = parameters?.ToImmutableList();
     TypeParameters = typeParameters == null ? ImmutableList<string>.Empty : (typeParameters.ToImmutableList());
     IsStatic = isStatic;
     IsAbstract = isAbstract;
 }
示例#39
0
        /// <summary>
        /// Initializes an instance of <see cref="TextChangeEventArgs"/>.
        /// </summary>
        /// <param name="oldText">The text before the change.</param>
        /// <param name="newText">The text after the change.</param>
        /// <param name="changes">A non-empty set of ranges for the change.</param>
        public TextChangeEventArgs(SourceText oldText, SourceText newText, IEnumerable<TextChangeRange> changes)
        {
            if (changes == null || changes.IsEmpty())
            {
                throw new ArgumentException("changes");
            }

            this.OldText = oldText;
            this.NewText = newText;
            this.Changes = changes.ToImmutableList();
        }
示例#40
0
		public ClassificationResult(
				IEnumerable<SuspiciousNode> suspiciousNodes, IEnumerable<BigInteger> wronglyAcceptedFeatures,
				IEnumerable<BigInteger> wronglyRejectedFeatures, int wrongVectorCount, int wrongElementCount,
				EncodingResult encodingResult) {
			SuspiciousNodes = suspiciousNodes != null ? suspiciousNodes.ToImmutableList() : null;
			WronglyAcceptedVectors = wronglyAcceptedFeatures.ToImmutableList();
			WronglyRejectedVectors = wronglyRejectedFeatures.ToImmutableList();
			WrongVectorCount = wrongVectorCount;
			WrongElementCount = wrongElementCount;
			_vector2Node = encodingResult.Vector2Node;
		}
示例#41
0
        public ParallelAction(IEnumerable<IAction> children)
        {
            Ensure.ArgumentNotNull(children, nameof(children), assertContentsNotNull: true);

            this.children = children.ToImmutableList();
            this.duration = this
                .children
                .Select(x => x.Duration)
                .DefaultIfEmpty()
                .Max();
        }
        public SequenceAction(IEnumerable<IAction> children)
        {
            children.AssertNotNull(nameof(children), assertContentsNotNull: true);

            this.children = children.ToImmutableList();
            this.duration = this
                .children
                .Select(x => x.Duration)
                .DefaultIfEmpty()
                .Aggregate((running, next) => running + next);
        }
示例#43
0
        public ExerciseProgram(ILoggerService loggerService, string name, IEnumerable<Exercise> exercises)
        {
            Ensure.ArgumentNotNull(loggerService, nameof(loggerService));
            Ensure.ArgumentNotNull(name, nameof(name));
            Ensure.ArgumentNotNull(exercises, nameof(exercises), assertContentsNotNull: true);

            this.logger = loggerService.GetLogger(this.GetType());
            this.name = name;
            this.exercises = exercises.ToImmutableList();
            this.duration = this
                .exercises
                .Select(x => x.Duration)
                .DefaultIfEmpty()
                .Aggregate((running, next) => running + next);
        }
示例#44
0
        public RuleReference(Implication originalRule, IEnumerable<PropNetFlattener.Condition> conditions, IList<Term> productionTemplate = null)
        {
            OriginalRule = originalRule;
            ProductionTemplate = productionTemplate==null ? ImmutableList<Term>.Empty :  productionTemplate.ToImmutableList();

            Conditions = conditions.ToImmutableList();

            int producttionTemplateHashCode = 1;

            if (productionTemplate != null)
                foreach (Term term in productionTemplate)
                    producttionTemplateHashCode = 31 * producttionTemplateHashCode + (term == null ? 0 : term.GetHashCode());

            int conditionsHashcode = Conditions.Aggregate(1, (current, cond) => 31 * current + (cond == null ? 0 : cond.GetHashCode()));
            _hashCode = producttionTemplateHashCode + conditionsHashcode;
        }
示例#45
0
 private void LoadCore(IEnumerable<FileModel> models)
 {
     EventHandler fileOrBaseDirChangedHandler = HandleFileOrBaseDirChanged;
     EventHandler<PropertyChangedEventArgs<ImmutableArray<UidDefinition>>> uidsChangedHandler = HandleUidsChanged;
     EventHandler contentAccessedHandler = null;
     if (!Environment.Is64BitProcess)
     {
         contentAccessedHandler = ContentAccessedHandler;
     }
     if (Models != null)
     {
         foreach (var m in Models)
         {
             m.FileOrBaseDirChanged -= fileOrBaseDirChangedHandler;
             m.UidsChanged -= uidsChangedHandler;
             m.ContentAccessed -= contentAccessedHandler;
         }
     }
     Models = models.ToImmutableList();
     _uidIndex.Clear();
     FileMap.Clear();
     foreach (var m in Models)
     {
         m.FileOrBaseDirChanged += fileOrBaseDirChangedHandler;
         m.UidsChanged += uidsChangedHandler;
         m.ContentAccessed += contentAccessedHandler;
         foreach (var uid in m.Uids)
         {
             List<FileModel> list;
             if (!_uidIndex.TryGetValue(uid.Name, out list))
             {
                 list = new List<FileModel>();
                 _uidIndex.Add(uid.Name, list);
             }
             list.Add(m);
         }
         if (m.Type != DocumentType.Overwrite)
         {
             FileMap[m.FileAndType] = m.FileAndType;
         }
     }
 }
示例#46
0
		/// <summary>
		/// Creates a new call prototype syntax tree
		/// </summary>
		/// <param name="name">The name of the function</param>
		/// <param name="arguments">The arguments</param>
		/// <param name="isOperator">Indicates if the current prototype is a operator</param>
		/// <param name="precedence">The operator precedence</param>
		public PrototypeSyntaxTree(string name, IEnumerable<string> arguments, bool isOperator = false, int precedence = 0)
		{
			this.name = name;
			this.arguments = arguments.ToImmutableList();
			this.isOperator = isOperator;
			this.precedence = precedence;
		}
 public SequentialWordFilter(IEnumerable<IWordFilter> filters)
 {
     this.filters = filters.ToImmutableList();
 }
示例#48
0
 public Settings(int opacity, bool isFilteringEnabled, IEnumerable<string> blacklist)
 {
     Opacity = opacity;
     IsFilteringEnabled = isFilteringEnabled;
     Blacklist = blacklist.ToImmutableList();
 }
 public ImageMonikerImageList(IEnumerable<ImageMoniker> imageMonikers) {
     _imageMonikers = imageMonikers.ToImmutableList();
 }
示例#50
0
 public VotingResult(string id, IEnumerable<bool> votes, int nrOfExpectedVotes)
 {
     this.ID = id;
       this.NrOfExpectedVotes = nrOfExpectedVotes;
       this.Votes = votes.ToImmutableList();
 }
 public FSharpDiagnosticResult(bool success, IEnumerable<FSharpCompilationMessage> messages)
 {
   _messages = messages.ToImmutableList();
   _success = success;
 }
示例#52
0
 public Order(IEnumerable<OrderLine> lines)
 {
     Lines = lines.ToImmutableList();
 }
 public ExercisePrograms(IEnumerable<ExerciseProgram> programs)
 {
     Ensure.ArgumentNotNull(programs, nameof(programs), assertContentsNotNull: true);
     this.programs = programs.ToImmutableList();
 }
 public GetAllResponse(IEnumerable<Person> persons)
 {
     this.Persons = persons.ToImmutableList();
 }
示例#55
0
 public Photo(string id, string displayName, IEnumerable<Tag> tags)
 {
     this.Id = id;
     this.Tags = tags.ToImmutableList();
     this.DisplayName = displayName;
 }
示例#56
0
		/// <summary>
		/// Creates a new call expression syntax tree
		/// </summary>
		/// <param name="funcName">The function to call</param>
		/// <param name="arguments">The arguments to call with</param>
		public CallExpressionSyntaxTree(string funcName, IEnumerable<ExpressionSyntaxTree> arguments)
		{
			this.funcName = funcName;
			this.arguments = arguments.ToImmutableList();
		}
示例#57
0
 public Container(string id, string displayName, IEnumerable<PhotoSet> photoSets)
 {
     Id = id;
     DisplayName = displayName;
     PhotoSets = photoSets.ToImmutableList();
 }
示例#58
0
        private Step(Step step, IEnumerable<Cell> cells, IEnumerable<Cell> rotateCells, Cell newCenter)
        {
            height = step.height;
            width = step.width;
            pieceIndex = step.pieceIndex;
            commandIndex = step.commandIndex + 1;
            points = step.points;

            Center = newCenter;
            Pieces = step.Pieces;
            CurrentPieceCells = rotateCells.ToImmutableList();
            UsedCells = step.UsedCells;
            RunningCells = cells.ToImmutableHashSet();
        }
示例#59
0
 public EventWithActions(IEvent @event, IEnumerable<IAction> actions)
 {
     this.@event = @event;
     this.actions = actions.ToImmutableList();
 }