Ejemplo n.º 1
0
 public MainWindow()
 {
     DataContext = this;
     InitializeComponent();
     model = ModelConfigurations.InitNormalModel();
     CostCalculationService.InitializeASD();
     LoadDataFromModel();
     simulation.Model         = model;
     simulation.ModelChanged += ModelChangeHandler;
     Paint();
 }
        IEnumerable <IModelConfiguration> GetMergedConfigurations()
        {
            Contract.Ensures(Contract.Result <IEnumerable <IModelConfiguration> >() != null);

            var configurations       = ModelConfigurations.ToList();
            var defaultConfiguration = DefaultModelConfiguration;

            if (defaultConfiguration != null)
            {
                configurations.Insert(0, new DelegatingModelConfiguration(defaultConfiguration));
            }

            return(configurations);
        }
Ejemplo n.º 3
0
 public void SwitchEveryRoomInSimple()
 {
     m = ModelConfigurations.InitSimpleModel();
     for (int i = 0; i < m.rooms.Count; i++)
     {
         var mModelRoom = m.rooms[i];
         for (int j = i + 1; j < m.rooms.Count; j++)
         {
             var modelRoom = m.rooms[j];
             m.SwitchRooms(ref mModelRoom, ref modelRoom);
             m.SwitchRooms(ref modelRoom, ref mModelRoom);
         }
     }
 }
Ejemplo n.º 4
0
        public void MoveEveryLineInNormal()
        {
            m = ModelConfigurations.InitNormalModel();
            _Line        l     = null;
            List <_Line> lines = m.AllLinesFlat();

            for (var i = 0; i < lines.Count; i++)
            {
                l = lines[i];
                m.MoveLine(10, l);
                m.MoveLine(-10, l);
                m.MoveLine(-10, l);
                m.MoveLine(10, l);
            }
        }
        IList <IModelConfiguration> GetMergedConfigurations()
        {
            var defaultConfiguration = DefaultModelConfiguration;

            if (defaultConfiguration == null)
            {
                return(ModelConfigurations);
            }

            var configurations = new IModelConfiguration[ModelConfigurations.Count + 1];

            configurations[0] = new DelegatingModelConfiguration(defaultConfiguration);
            ModelConfigurations.CopyTo(configurations, 1);

            return(configurations);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="VersionedODataModelBuilder"/> class.
        /// </summary>
        /// <param name="actionDescriptorCollectionProvider">The <see cref="IActionDescriptorCollectionProvider "/> used to discover OData routes.</param>
        /// <param name="options">The <see cref="ApiVersioningOptions">options</see> associated with the action selector.</param>
        /// <param name="modelConfigurations">The <see cref="IEnumerable{T}">sequence</see> of
        /// <see cref="IModelConfiguration">model configurations</see> associated with the model builder.</param>
        public VersionedODataModelBuilder(
            IActionDescriptorCollectionProvider actionDescriptorCollectionProvider,
            IOptions <ApiVersioningOptions> options,
            IEnumerable <IModelConfiguration> modelConfigurations)
        {
            Arg.NotNull(actionDescriptorCollectionProvider, nameof(actionDescriptorCollectionProvider));
            Arg.NotNull(options, nameof(options));
            Arg.NotNull(modelConfigurations, nameof(modelConfigurations));

            ActionDescriptorCollectionProvider = actionDescriptorCollectionProvider;
            this.options = options;

            foreach (var configuration in modelConfigurations)
            {
                ModelConfigurations.Add(configuration);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="VersionedODataModelBuilder"/> class.
        /// </summary>
        /// <param name="actionDescriptorCollectionProvider">The <see cref="IActionDescriptorCollectionProvider "/> used to discover OData routes.</param>
        /// <param name="options">The <see cref="ApiVersioningOptions">options</see> associated with the action selector.</param>
        /// <param name="modelConfigurations">The <see cref="IEnumerable{T}">sequence</see> of
        /// <see cref="IModelConfiguration">model configurations</see> associated with the model builder.</param>
        public VersionedODataModelBuilder(
            IActionDescriptorCollectionProvider actionDescriptorCollectionProvider,
            IOptions <ApiVersioningOptions> options,
            IEnumerable <IModelConfiguration> modelConfigurations)
        {
            if (modelConfigurations == null)
            {
                throw new ArgumentNullException(nameof(modelConfigurations));
            }

            ActionDescriptorCollectionProvider = actionDescriptorCollectionProvider;
            this.options = options;

            foreach (var configuration in modelConfigurations)
            {
                ModelConfigurations.Add(configuration);
            }
        }
Ejemplo n.º 8
0
        IList <IModelConfiguration> GetMergedConfigurations()
        {
            Contract.Ensures(Contract.Result <IList <IModelConfiguration> >() != null);

            var defaultConfiguration = DefaultModelConfiguration;

            if (defaultConfiguration == null)
            {
                return(ModelConfigurations);
            }

            var configurations = new IModelConfiguration[ModelConfigurations.Count + 1];

            configurations[0] = new DelegatingModelConfiguration(defaultConfiguration);
            ModelConfigurations.CopyTo(configurations, 1);

            return(configurations);
        }
Ejemplo n.º 9
0
        public void AllCasesTestGeneration()
        {
            m = ModelConfigurations.InitTestModel();
            List <_Model> new_Models = new List <_Model>();

            new_Models.Add(m);
            List <_Model> all_Models = new List <_Model>();

            while (new_Models.Any())
            {
                List <_Model> loop = new List <_Model>();
                foreach (_Model _Model in new_Models)
                {
                    List <_Model> current_Models = AllRoomPairs(_Model);

                    foreach (_Model current_Model in current_Models)
                    {
                        if (current_Model.rooms.Count > 1)
                        {
                            loop.Add(current_Model);
                        }
                    }

                    all_Models.AddRange(current_Models);
                }

                new_Models = loop;
                GC.Collect();
            }

            foreach (_Model _Model in all_Models)
            {
                Ommitsteps(_Model);
            }

            foreach (_Model m1 in ms.getHistory())
            {
                SaveHistoryModel(m1, GenerateModelNameFromState(m1));
            }
        }
Ejemplo n.º 10
0
        private void Gentest_OnClick(object sender, RoutedEventArgs e)
        {
            GeneratingBase = ModelConfigurations.InitTestModel();
            List <_Model> new_Models = new List <_Model>();

            new_Models.Add(GeneratingBase);
            List <_Model> all_Models = new List <_Model>();

            while (new_Models.Any())
            {
                List <_Model> loop = new List <_Model>();
                foreach (_Model _Model in new_Models)
                {
                    List <_Model> current_Models = AllRoomPairs(_Model);

                    foreach (_Model current_Model in current_Models)
                    {
                        if (current_Model.rooms.Count > 1)
                        {
                            loop.Add(current_Model);
                        }
                    }

                    all_Models.AddRange(current_Models);
                }

                new_Models = loop;
                GC.Collect();
            }

            foreach (_Model _Model in all_Models)
            {
                Ommitsteps(_Model);
            }

            foreach (_Model m1 in ms.getHistory())
            {
                SaveHistoryModel(m1, GenerateModelNameFromState(m1));
            }
        }
Ejemplo n.º 11
0
 //[Test]
 public void FullSimulation()
 {
     s.Model = ModelConfigurations.InitSimpleModel();
     s.RunSteps();
 }
Ejemplo n.º 12
0
 public void Setup()
 {
     m = ModelConfigurations.InitTestModel();
 }
Ejemplo n.º 13
0
 private void LoadModels()
 {
     //Model = ModelConfigurations.InitSimplestModel();
     model = ModelConfigurations.InitSimpleModel();
     LoadDataFromModel();
 }
Ejemplo n.º 14
0
 internal void Register(ModelConfiguration config)
 {
     ModelConfigurations.Add(config);
 }