Exemplo n.º 1
0
        public void Cointeiners_Creating()
        {
            Point <int> point3D = new Point <int>(3, 3, 3);
            Point <int> point2D = new Point <int>(2, 2);

            Position <int> position3D = new Position <int>();
            Position <int> position2D = new Position <int>();

            Matrix <int> matrix_1 = new Matrix <int>();
            Matrix <int> matrix_2 = new Matrix <int>();

            Container <int> container_1 = new Container <int>();
            Container <int> container_2 = new Container <int>();

            Containers <int> containers = new Containers <int>();

            position3D.Add(point3D);
            position3D.Add(point3D);
            position3D.Add(point3D);

            matrix_1.Add(position3D);
            matrix_1.Add(position3D);

            container_1.Add(matrix_1);
            container_1.Add(matrix_1);
            container_2.Add(matrix_1);

            containers.Add(container_1);
            containers.Add(container_1);

            Assert.IsNotEmpty(containers);
            Assert.True(containers.ContainerSize == containers.Count);
            Assert.Throws <ContainerRulesException>(() => containers.Add(container_2));
        }
Exemplo n.º 2
0
        public void CollectionRule2() //The number of data points at each XYZ position will be the same for all positions on a matrix and across equivalent matrix indexes across containers.
        {
            Point <int> point3D = new Point <int>(3, 3, 3);
            Point <int> point2D = new Point <int>(2, 2);

            Position <int> position3D_1 = new Position <int>();
            Position <int> position3D_2 = new Position <int>();

            Position <int> position2D_1 = new Position <int>();
            Position <int> position2D_2 = new Position <int>();


            Matrix <int> matrix_1 = new Matrix <int>();
            Matrix <int> matrix_2 = new Matrix <int>();

            Container <int> container_1 = new Container <int>();
            Container <int> container_2 = new Container <int>();

            Containers <int> containers = new Containers <int>();

            position3D_1.Add(point3D);

            position3D_2.Add(point3D);
            position3D_2.Add(point3D);

            position2D_1.Add(point2D);
            position2D_1.Add(point2D);

            position2D_2.Add(point2D);

            matrix_1.Add(position3D_1);
            matrix_1.Add(position3D_2);

            matrix_2.Add(position2D_1);
            matrix_2.Add(position2D_2);

            container_1.Add(matrix_1);
            container_1.Add(matrix_2);
            container_1.Add(matrix_1);

            container_2.Add(matrix_1);
            container_2.Add(matrix_2);
            container_2.Add(matrix_1);


            containers.Add(container_1);
            containers.Add(container_2);
            containers.Add(container_1);
        }
Exemplo n.º 3
0
        /// <remarks></remarks>
        public Maybe <T> UpsertBlobOrSkip <T>(
            string containerName, string blobName, Func <Maybe <T> > insert, Func <T, Maybe <T> > update, IDataSerializer serializer = null)
        {
            lock (_syncRoot)
            {
                Maybe <T> input;
                if (Containers.ContainsKey(containerName))
                {
                    if (Containers[containerName].BlobNames.Contains(blobName))
                    {
                        var blobData = Containers[containerName].GetBlob(blobName);
                        input = blobData == null ? Maybe <T> .Empty : (T)blobData;
                    }
                    else
                    {
                        input = Maybe <T> .Empty;
                    }
                }
                else
                {
                    Containers.Add(containerName, new MockContainer());
                    input = Maybe <T> .Empty;
                }

                var output = input.HasValue ? update(input.Value) : insert();

                if (output.HasValue)
                {
                    Containers[containerName].SetBlob(blobName, output.Value);
                }

                return(output);
            }
        }
Exemplo n.º 4
0
        public override void Init()
        {
            Containers.Add(new PlayNavigationContainer(GameManager));
            Containers.Add(new CalendarContainer(GameManager));

            SelectContainer(Containers[0]);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Creates a re-occurring job scheduler.
        /// </summary>
        /// <param name="queueConnection">Queue and connection information.</param>
        /// <returns></returns>
        public IJobSchedulerLastKnownEvent CreateJobSchedulerLastKnownEvent(QueueConnection queueConnection)
        {
            var container = _createContainerInternal().Create(QueueContexts.ProducerMethodQueue, _registerService, queueConnection, _transportInit, ConnectionTypes.Send, x => { }, _setOptions);

            Containers.Add(container);
            return(container.GetInstance <IJobSchedulerLastKnownEvent>());
        }
Exemplo n.º 6
0
 /* ---------------------------------------------------- */
 //     メソッド
 /* ---------------------------------------------------- */
 public void Initialize()
 {
     for (int i = -numofBackwardContainer; i <= numofForwardContainer; i++)
     {
         Containers.Add(new ImgContainer(i));
     }
 }
Exemplo n.º 7
0
        public static void AddContainer(int _id, int idNode)
        {
            Container cont = new Container(_id, Graph.FindNodeById(idNode));

            Containers.Add(cont);
            OnCreateContainer?.Invoke(cont);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Constructs an instance from the dynamic network information returned by
        /// the Docker engine.
        /// </summary>
        /// <param name="source">The dynamic source value.</param>
        internal DockerNetwork(dynamic source)
            : this()
        {
            this.Inner      = source;
            this.Name       = source.Name;
            this.Id         = source.Id;
            this.Scope      = source.Scope;
            this.Driver     = source.Driver;
            this.EnableIPv6 = source.EnableIPv6;
            this.Internal   = source.Internal;
            this.Ipam       = new DockerNetworkIpam(source.IPAM);

            foreach (var item in source.Containers)
            {
                Containers.Add(new DockerNetworkContainer(item));
            }

            foreach (var item in source.Options)
            {
                Options.Add(item.Name, item.Value.ToString());
            }

            foreach (var item in source.Labels)
            {
                Labels.Add(item.Name, item.Value.ToString());
            }
        }
        /// <summary>
        /// Creates the task factory.
        /// </summary>
        /// <returns></returns>
        public ITaskFactory CreateTaskFactory()
        {
            var container = _createContainerInternal().Create(QueueContexts.TaskFactory, _registerService, _transportInit, x => { }, _setOptions);

            Containers.Add(container);
            return(CreateTaskFactoryInternal(container.GetInstance <ATaskScheduler>(), true));
        }
Exemplo n.º 10
0
        public void Add_DiffNumberOfPositionIn3DIndexedMatrices_ExceptionThrown()
        {
            var container = new Container <int>();
            var list      = new List <Matrix <int> >();

            for (int i = 0; i < _matrices.Count; i++)
            {
                if (i == 1)
                {
                    list.Add(Matrix <int> .CreateMatrix(Point <int> .PointType.Point3d, 10));
                }
                else
                {
                    list.Add(Matrix <int> .CreateMatrix(Point <int> .PointType.Point3d, 9));
                }
            }

            foreach (var item in list)
            {
                container.Add(item);
            }

            var containers = new Containers <int>();

            containers.Add(container);
        }
Exemplo n.º 11
0
        public void AddContainer(StorageContainer container)
        {
            Containers.Add(container);

            TotalStorageSpace = Containers.Sum(p => p.Size);
            Available        += container.Size;
        }
Exemplo n.º 12
0
        protected override IStatement ConvertFor(IForStatement ifs)
        {
            var loopSize = Recognizer.LoopSizeExpression(ifs);

            if (!((loopSize is IVariableReferenceExpression) || (loopSize is IArrayIndexerExpression) ||
                  (loopSize is IArgumentReferenceExpression) || (loopSize is ILiteralExpression) ||
                  (loopSize is IPropertyReferenceExpression)))
            {
                Error("Invalid expression type for the size of a loop (" + loopSize.GetType().Name + "): " + loopSize);
                return(ifs);
            }
            if (loopSize is ILiteralExpression)
            {
                // remove loops that execute for 0 iterations
                int loopSizeAsInt = (int)((ILiteralExpression)loopSize).Value;
                if (loopSizeAsInt == 0)
                {
                    return(null);
                }
            }
            Containers c = Containers.GetContainersNeededForExpression(context, loopSize);

            c.Add(ifs);
            IVariableDeclaration loopVar = Recognizer.LoopVariable(ifs);

            context.InputAttributes.Remove <Containers>(loopVar);
            context.InputAttributes.Set(loopVar, c);
            return(base.ConvertFor(ifs));
        }
Exemplo n.º 13
0
        public override void Init()
        {
            Containers.Add(new NavigationContainer(this.GameManager));
            Containers.Add(new MainMenuHelpContainer(GameManager));

            SelectContainer(Containers[0]);
        }
Exemplo n.º 14
0
 private static void Register(RootDependencyContainer container)
 {
     if (!Containers.Contains(container))
     {
         Containers.Add(container);
     }
 }
Exemplo n.º 15
0
        public void InjectModule(ModuleInfo objModule)
        {
            bool bSuccess = true;

            try
            {
                if (!Common.Globals.IsAdminControl())
                {
                    PaneControl.Controls.Add(new LiteralControl("<a name=\"" + objModule.ModuleID.ToString() + "\"></a>"));
                }
                Containers.Container ctlContainer = LoadModuleContainer(objModule);
                Containers.Add(ctlContainer.ID, ctlContainer);
                if (Common.Globals.IsLayoutMode() && Common.Globals.IsAdminControl() == false)
                {
                    Panel ctlDragDropContainer     = new Panel();
                    System.Web.UI.Control ctlTitle = ctlContainer.FindControl("dnnTitle");
                    ctlDragDropContainer.ID = ctlContainer.ID + "_DD";
                    PaneControl.Controls.Add(ctlDragDropContainer);
                    ctlDragDropContainer.Controls.Add(ctlContainer);
                    if (ctlTitle != null)
                    {
                        if (ctlTitle.Controls.Count > 0)
                        {
                            ctlTitle = ctlTitle.Controls[0];
                        }
                    }
                    //if (ctlDragDropContainer != null && ctlTitle != null)
                    //{
                    //    ClientAPI.EnableContainerDragAndDrop(ctlTitle, ctlDragDropContainer, objModule.ModuleID);
                    //    ClientAPI.RegisterPostBackEventHandler(PaneControl, "MoveToPane", ModuleMoveToPanePostBack, false);
                    //}
                }
                else
                {
                    PaneControl.Controls.Add(ctlContainer);
                }
                ctlContainer.SetModuleConfiguration(objModule);
                if (PaneControl.Visible == false)
                {
                    PaneControl.Visible = true;
                }
            }
            catch (Exception exc)
            {
                ModuleLoadException lex;
                lex = new ModuleLoadException(string.Format(Skin.MODULEADD_ERROR, PaneControl.ID.ToString()), exc);
                if (TabPermissionController.CanAdminPage())
                {
                    PaneControl.Controls.Add(new ErrorContainer(PortalSettings, Skin.MODULELOAD_ERROR, lex).Container);
                }
                Exceptions.LogException(exc);
                bSuccess = false;
                throw lex;
            }
            if (!bSuccess)
            {
                throw new ModuleLoadException();
            }
        }
        public MyCosmosDbDescriptor()
        {
            DatabaseId = "MyDB";

            ClientOptions.ApplicationName = "MyAppName";

            Containers.Add(new MyCosmosDbContainerDescriptor());
        }
Exemplo n.º 17
0
        /// <summary>
        /// Creates the consumer method queue scheduler.
        /// </summary>
        /// <param name="queue">The queue.</param>
        /// <param name="connection">The connection.</param>
        /// <param name="factory">The factory.</param>
        /// <param name="workGroup">The work group.</param>
        /// <param name="internalFactory">if set to <c>true</c> [internal factory].</param>
        /// <returns></returns>
        private IConsumerMethodQueueScheduler CreateConsumerMethodQueueSchedulerInternal(string queue,
                                                                                         string connection, ITaskFactory factory, IWorkGroup workGroup, bool internalFactory)
        {
            Guard.NotNullOrEmpty(() => queue, queue);
            Guard.NotNullOrEmpty(() => connection, connection);

            IContainer container;

            if (internalFactory) //we own factory
            {
                if (workGroup == null)
                {
                    container = _createContainerInternal()
                                .Create(QueueContexts.ConsumerMethodQueueScheduler, _registerService, queue, connection,
                                        _transportInit, ConnectionTypes.Receive,
                                        serviceRegister =>
                                        serviceRegister.Register(() => factory, LifeStyles.Singleton)
                                        .Register <IWorkGroup>(() => new WorkGroupNoOp(), LifeStyles.Singleton)
                                        .Register(() => factory.Scheduler, LifeStyles.Singleton), _setOptions);
                }
                else
                {
                    container = _createContainerInternal()
                                .Create(QueueContexts.ConsumerMethodQueueScheduler, _registerService, queue, connection,
                                        _transportInit, ConnectionTypes.Receive,
                                        serviceRegister =>
                                        serviceRegister.Register(() => factory, LifeStyles.Singleton)
                                        .Register(() => workGroup, LifeStyles.Singleton)
                                        .Register(() => factory.Scheduler, LifeStyles.Singleton), _setOptions);
                }
            }
            else  //someone else owns factory
            {
                if (workGroup == null)
                {
                    container = _createContainerInternal()
                                .Create(QueueContexts.ConsumerMethodQueueScheduler, _registerService, queue, connection,
                                        _transportInit, ConnectionTypes.Receive,
                                        serviceRegister =>
                                        serviceRegister.RegisterNonScopedSingleton(factory)
                                        .Register <IWorkGroup>(() => new WorkGroupNoOp(), LifeStyles.Singleton)
                                        .RegisterNonScopedSingleton(factory.Scheduler), _setOptions);
                }
                else
                {
                    container = _createContainerInternal()
                                .Create(QueueContexts.ConsumerMethodQueueScheduler, _registerService, queue, connection,
                                        _transportInit, ConnectionTypes.Receive,
                                        serviceRegister =>
                                        serviceRegister.RegisterNonScopedSingleton(factory)
                                        .Register(() => workGroup, LifeStyles.Singleton)
                                        .RegisterNonScopedSingleton(factory.Scheduler), _setOptions);
                }
            }
            Containers.Add(container);
            return(container.GetInstance <IConsumerMethodQueueScheduler>());
        }
Exemplo n.º 18
0
        /// <summary>Creates the method consumer queue.</summary>
        /// <param name="queueConnection">Queue and connection information.</param>
        /// <param name="registerServiceInternal">overrides for the internal container</param>
        /// <returns></returns>
        public IConsumerMethodQueue CreateMethodConsumer(QueueConnection queueConnection, Action <IContainer> registerServiceInternal)
        {
            Guard.NotNull(() => queueConnection, queueConnection);

            var container = _createContainerInternal().Create(QueueContexts.ConsumerMethodQueue, _registerService, queueConnection, _transportInit, ConnectionTypes.Receive, registerServiceInternal, _setOptions);

            Containers.Add(container);
            return(container.GetInstance <IConsumerMethodQueue>());
        }
Exemplo n.º 19
0
        /// <summary>
        /// Creates a new instance of <see cref="IQueueStatus" />
        /// </summary>
        /// <returns></returns>
        public IQueueStatus CreateStatus()
        {
            //when creating a status module outside of the queue itself, use a no-op system information module
            var container = _createContainerInternal().Create(QueueContexts.QueueStatus, _registerService, _transportInit,
                                                              x => { }, _setOptions);

            Containers.Add(container);
            return(container.GetInstance <IQueueStatus>());
        }
Exemplo n.º 20
0
        /// <summary>
        /// Creates a new status provider.
        /// </summary>
        /// <returns></returns>
        public IQueueStatusProvider CreateStatusProvider <TTransportInit>(Action <IContainer> registerService,
                                                                          string queue, string connection)
            where TTransportInit : ITransportInit, new()
        {
            var creator = new QueueContainer <TTransportInit>(registerService);

            Containers.Add(creator);
            return(creator.CreateStatusProvider(queue, connection));
        }
Exemplo n.º 21
0
        /// <summary>
        /// Creates an async consumer queue
        /// </summary>
        /// <param name="queueConnection">Queue and connection information.</param>
        /// <returns></returns>
        public IConsumerQueueAsync CreateConsumerAsync(QueueConnection queueConnection)
        {
            Guard.NotNull(() => queueConnection, queueConnection);

            var container = _createContainerInternal().Create(QueueContexts.ConsumerQueueAsync, _registerService, queueConnection, _transportInit, ConnectionTypes.Receive, x => { }, _setOptions);

            Containers.Add(container);
            return(container.GetInstance <IConsumerQueueAsync>());
        }
Exemplo n.º 22
0
        /// <summary> Adds a new container information object to this descriptive information </summary>
        /// <param name="Container_Type"> General type of this container ( usually 'box', 'folder', etc.. )</param>
        /// <param name="Container_Title"> Title or label for this container</param>
        public void Add_Container(string Container_Type, string Container_Title)
        {
            if (Containers == null)
            {
                Containers = new List <Parent_Container_Info>();
            }

            Containers.Add(new Parent_Container_Info(Container_Type, Container_Title));
        }
Exemplo n.º 23
0
 // Puts valuable containers, if any on top.
 private void MoveValuableToTop()
 {
     if (HaValuable)
     {
         var valContainer = (ValuableContainer)Containers.Find(v => v.TopStackAllowed == false);
         Containers.Remove(valContainer);
         Containers.Add(valContainer);
     }
 }
        private CloudBlobContainer GetContainer(string containerName)
        {
            if (!Containers.ContainsKey(containerName))
            {
                Containers.Add(containerName, GetClient().GetContainerReference(containerName));
                Containers[containerName].CreateIfNotExistsAsync().Wait();
            }

            return(Containers[containerName]);
        }
Exemplo n.º 25
0
 /// <summary>
 /// SetPosition make's sure that valuable containers get placed on top.
 /// </summary>
 public void SetPosition()
 {
     if (Containers.Find(x => (x.Valuable)) != null)
     {
         var valuable = Containers[0];
         Containers.RemoveAt(0);
         Containers.Add(valuable);
     }
     ;
 }
Exemplo n.º 26
0
        private Containers GetContainers()
        {
            var containers = new Containers();

            foreach (var container in openContainers.Reverse())
            {
                containers.Add(Containers.CreateContainer(container));
            }
            return(containers);
        }
Exemplo n.º 27
0
        /// <summary>
        /// Creates a producer queue for executing linq expressions.
        /// </summary>
        /// <param name="queueConnection">Queue and connection information.</param>
        /// <returns></returns>
        public IProducerMethodJobQueue CreateMethodJobProducer(
            QueueConnection queueConnection)
        {
            Guard.NotNull(() => queueConnection, queueConnection);

            var container = _createContainerInternal().Create(QueueContexts.ProducerMethodQueue, _registerService, queueConnection, _transportInit, ConnectionTypes.Send, x => { }, _setOptions);

            Containers.Add(container);
            return(container.GetInstance <IProducerMethodJobQueue>());
        }
Exemplo n.º 28
0
        /// <summary>
        /// Creates the method consumer queue.
        /// </summary>
        /// <param name="queue">The queue.</param>
        /// <param name="connection">The connection.</param>
        /// <returns></returns>
        public IConsumerMethodQueue CreateMethodConsumer(string queue, string connection)
        {
            Guard.NotNullOrEmpty(() => queue, queue);
            Guard.NotNullOrEmpty(() => connection, connection);

            var container = _createContainerInternal().Create(QueueContexts.ConsumerMethodQueue, _registerService, queue,
                                                              connection, _transportInit, ConnectionTypes.Receive, x => { }, _setOptions);

            Containers.Add(container);
            return(container.GetInstance <IConsumerMethodQueue>());
        }
Exemplo n.º 29
0
        /// <summary>
        /// Creates an async consumer queue that uses a task scheduler. The default task factory will be used.
        /// </summary>
        /// <param name="queueConnection">Queue and connection information.</param>
        /// <returns></returns>
        public IConsumerMethodQueueScheduler CreateConsumerMethodQueueScheduler(QueueConnection queueConnection)
        {
            Guard.NotNull(() => queueConnection, queueConnection);

            var schedulerCreator = new SchedulerContainer(_registerService);
            var factory          = schedulerCreator.CreateTaskFactory();

            factory.Scheduler.Start();
            Containers.Add(schedulerCreator);
            return(CreateConsumerMethodQueueSchedulerInternal(queueConnection, factory, null, true));
        }
Exemplo n.º 30
0
        /// <summary>
        /// Creates a producer queue.
        /// </summary>
        /// <typeparam name="TMessage">The type of the message.</typeparam>
        /// <param name="queueConnection">Queue and connection information.</param>
        /// <returns></returns>
        public IProducerQueue <TMessage> CreateProducer <TMessage>(
            QueueConnection queueConnection)
            where TMessage : class
        {
            Guard.NotNull(() => queueConnection, queueConnection);

            var container = _createContainerInternal().Create(QueueContexts.ProducerQueue, _registerService, queueConnection, _transportInit, ConnectionTypes.Send, x => { }, _setOptions);

            Containers.Add(container);
            return(container.GetInstance <IProducerQueue <TMessage> >());
        }