protected override void OnContentChanged() {
      base.OnContentChanged();
      if (Content != null) {
        var data = Content.Data;
        var filterLogic = new FilterLogic(data);
        var searchLogic = new SearchLogic(data, filterLogic);
        var statisticsLogic = new StatisticsLogic(data, searchLogic);
        var manipulationLogic = new ManipulationLogic(data, searchLogic, statisticsLogic);

        var viewShortcuts = new ItemList<IViewShortcut> {
          new DataGridContent(data, manipulationLogic, filterLogic),
          new StatisticsContent(statisticsLogic),

          new LineChartContent(data),
          new HistogramContent(data),
          new ScatterPlotContent(data),
          new CorrelationMatrixContent(Content),
          new DataCompletenessChartContent(searchLogic),
          
          new FilterContent(filterLogic),
          new ManipulationContent(manipulationLogic, searchLogic, filterLogic),
          new TransformationContent(data, filterLogic)
        };

        viewShortcutListView.Content = viewShortcuts.AsReadOnly();

        viewShortcutListView.ItemsListView.Items[0].Selected = true;
        viewShortcutListView.Select();

      } else {
        viewShortcutListView.Content = null;
      }
    }
        protected override void OnContentChanged()
        {
            base.OnContentChanged();
            if (Content != null)
            {
                var data              = Content.Data;
                var filterLogic       = new FilterLogic(data);
                var searchLogic       = new SearchLogic(data, filterLogic);
                var statisticsLogic   = new StatisticsLogic(data, searchLogic);
                var manipulationLogic = new ManipulationLogic(data, searchLogic, statisticsLogic);

                var viewShortcuts = new ItemList <IViewShortcut> {
                    new DataGridContent(data, manipulationLogic, filterLogic),
                    new StatisticsContent(statisticsLogic),

                    new LineChartContent(data),
                    new HistogramContent(data),
                    new ScatterPlotContent(data),
                    new CorrelationMatrixContent(Content),
                    new DataCompletenessChartContent(searchLogic),

                    new FilterContent(filterLogic),
                    new ManipulationContent(manipulationLogic, searchLogic, filterLogic),
                    new TransformationContent(data, filterLogic)
                };

                viewShortcutListView.Content = viewShortcuts.AsReadOnly();
                viewShortcutListView.ItemsListView.Items[0].Selected = true;
                viewShortcutListView.Select();

                applyTypeContextMenuStrip.Items.Clear();
                exportTypeContextMenuStrip.Items.Clear();
                foreach (var exportOption in Content.GetSourceExportOptions())
                {
                    var applyMenuItem = new ToolStripMenuItem(exportOption.Key)
                    {
                        Tag = exportOption.Value
                    };
                    applyMenuItem.Click += applyToolStripMenuItem_Click;
                    applyTypeContextMenuStrip.Items.Add(applyMenuItem);

                    var exportMenuItem = new ToolStripMenuItem(exportOption.Key)
                    {
                        Tag = exportOption.Value
                    };
                    exportMenuItem.Click += exportToolStripMenuItem_Click;
                    exportTypeContextMenuStrip.Items.Add(exportMenuItem);
                }
                var exportCsvMenuItem = new ToolStripMenuItem(".csv");
                exportCsvMenuItem.Click += exportCsvMenuItem_Click;
                exportTypeContextMenuStrip.Items.Add(exportCsvMenuItem);
            }
            else
            {
                viewShortcutListView.Content = null;
            }
        }
예제 #3
0
        private static void PerformReadOnlyTest(Action <IList <string> > listOperation, IEnumerable <string> createFrom)
        {
            ItemList <string> testListReadOnly = new ItemList <string>(false, false, new List <string>(createFrom));

            TestUtility.ExpectException <NotSupportedException>(
                () => listOperation(testListReadOnly.AsReadOnly()));

            ItemList <string> testListWritable = new ItemList <string>(false, false, new List <string>(createFrom));

            listOperation(testListWritable);
        }
예제 #4
0
        public void Load(BPPData data)
        {
            BestKnownSolutionParameter.Value = null;
            BestKnownQualityParameter.Value  = null;

            if (data.BestKnownQuality.HasValue)
            {
                BestKnownQuality = data.BestKnownQuality.Value;
            }

            BinShape = data.BinShape;
            var items = new ItemList <PackingItem>(data.Items);

            items.Sort((x, y) => y.CompareTo(x));
            Items = items.AsReadOnly();

            ApplyHorizontalOrientation();
            LowerBoundParameter.Value.Value = CalculateLowerBound();
        }
        protected override void OnContentChanged()
        {
            base.OnContentChanged();
            if (Content != null)
            {
                var data              = Content.Data;
                var filterLogic       = new FilterLogic(data);
                var searchLogic       = new SearchLogic(data, filterLogic);
                var statisticsLogic   = new StatisticsLogic(data, searchLogic);
                var manipulationLogic = new ManipulationLogic(data, searchLogic, statisticsLogic);

                var viewShortcuts = new ItemList <IViewShortcut> {
                    new DataGridContent(data, manipulationLogic, filterLogic),
                    new StatisticsContent(statisticsLogic),

                    new LineChartContent(data),
                    new HistogramContent(data),
                    new ScatterPlotContent(data),
                    new CorrelationMatrixContent(Content),
                    new DataCompletenessChartContent(searchLogic),

                    new FilterContent(filterLogic),
                    new ManipulationContent(manipulationLogic, searchLogic, filterLogic),
                    new TransformationContent(data, filterLogic)
                };

                viewShortcutListView.Content = viewShortcuts.AsReadOnly();

                viewShortcutListView.ItemsListView.Items[0].Selected = true;
                viewShortcutListView.Select();
            }
            else
            {
                viewShortcutListView.Content = null;
            }
        }
        protected DataAnalysisProblemData(IDataset dataset, IEnumerable <string> allowedInputVariables, IEnumerable <ITransformation> transformations = null)
        {
            if (dataset == null)
            {
                throw new ArgumentNullException("The dataset must not be null.");
            }
            if (allowedInputVariables == null)
            {
                throw new ArgumentNullException("The allowedInputVariables must not be null.");
            }

            if (allowedInputVariables.Except(dataset.DoubleVariables).Any())
            {
                throw new ArgumentException("All allowed input variables must be present in the dataset and of type double.");
            }

            var inputVariables = new CheckedItemList <StringValue>(dataset.DoubleVariables.Select(x => new StringValue(x)));

            foreach (StringValue x in inputVariables)
            {
                inputVariables.SetItemCheckedState(x, allowedInputVariables.Contains(x.Value));
            }

            int trainingPartitionStart = 0;
            int trainingPartitionEnd   = dataset.Rows / 2;
            int testPartitionStart     = dataset.Rows / 2;
            int testPartitionEnd       = dataset.Rows;

            var transformationsList = new ItemList <ITransformation>(transformations ?? Enumerable.Empty <ITransformation>());

            Parameters.Add(new FixedValueParameter <Dataset>(DatasetParameterName, "", (Dataset)dataset));
            Parameters.Add(new FixedValueParameter <ReadOnlyCheckedItemList <StringValue> >(InputVariablesParameterName, "", inputVariables.AsReadOnly()));
            Parameters.Add(new FixedValueParameter <IntRange>(TrainingPartitionParameterName, "", new IntRange(trainingPartitionStart, trainingPartitionEnd)));
            Parameters.Add(new FixedValueParameter <IntRange>(TestPartitionParameterName, "", new IntRange(testPartitionStart, testPartitionEnd)));
            Parameters.Add(new FixedValueParameter <ReadOnlyItemList <ITransformation> >(TransformationsParameterName, "", transformationsList.AsReadOnly()));

            TransformationsParameter.Hidden = true;

            ((ValueParameter <Dataset>)DatasetParameter).ReactOnValueToStringChangedAndValueItemImageChanged = false;
            RegisterEventHandlers();
        }
    protected DataAnalysisProblemData(IDataset dataset, IEnumerable<string> allowedInputVariables, IEnumerable<ITransformation> transformations = null) {
      if (dataset == null) throw new ArgumentNullException("The dataset must not be null.");
      if (allowedInputVariables == null) throw new ArgumentNullException("The allowedInputVariables must not be null.");

      if (allowedInputVariables.Except(dataset.DoubleVariables).Any())
        throw new ArgumentException("All allowed input variables must be present in the dataset and of type double.");

      var inputVariables = new CheckedItemList<StringValue>(dataset.DoubleVariables.Select(x => new StringValue(x)));
      foreach (StringValue x in inputVariables)
        inputVariables.SetItemCheckedState(x, allowedInputVariables.Contains(x.Value));

      int trainingPartitionStart = 0;
      int trainingPartitionEnd = dataset.Rows / 2;
      int testPartitionStart = dataset.Rows / 2;
      int testPartitionEnd = dataset.Rows;

      var transformationsList = new ItemList<ITransformation>(transformations ?? Enumerable.Empty<ITransformation>());

      Parameters.Add(new FixedValueParameter<Dataset>(DatasetParameterName, "", (Dataset)dataset));
      Parameters.Add(new FixedValueParameter<ReadOnlyCheckedItemList<StringValue>>(InputVariablesParameterName, "", inputVariables.AsReadOnly()));
      Parameters.Add(new FixedValueParameter<IntRange>(TrainingPartitionParameterName, "", new IntRange(trainingPartitionStart, trainingPartitionEnd)));
      Parameters.Add(new FixedValueParameter<IntRange>(TestPartitionParameterName, "", new IntRange(testPartitionStart, testPartitionEnd)));
      Parameters.Add(new FixedValueParameter<ReadOnlyItemList<ITransformation>>(TransformationsParameterName, "", transformationsList.AsReadOnly()));

      TransformationsParameter.Hidden = true;

      ((ValueParameter<Dataset>)DatasetParameter).ReactOnValueToStringChangedAndValueItemImageChanged = false;
      RegisterEventHandlers();
    }