Пример #1
0
        public void AddDependency(FunctionalDependency item)
        {
            bool closureGrowing = true;

            if (!_dependencies.Contains(item)) _dependencies.Add(item);
            _closures[item.X].Add(item.Y);

            _EvaluateTransitiveClosure(item.X);

            while (closureGrowing)
            {
                closureGrowing = false;
                foreach (KeyValuePair<AttributeSet, AttributeSet> pair in _closures)
                {
                    closureGrowing = closureGrowing || _EvaluateTransitiveClosure(pair.Key);
                }
            }

            _CreateKeys();
        }
Пример #2
0
        private Paragraph _CreateDependencyEntry(FunctionalDependency fd)
        {
            Paragraph block;
            InlineUIContainer container;
            LinearGradientBrush removeBrush;
            Button remove;
            Path arrow;
            GeometryGroup arrowLines;

            removeBrush = new LinearGradientBrush(Colors.White, Colors.DarkGray, new Point(0.5, 0.0), new Point(0.5, 1.0));
            removeBrush.GradientStops[0].Offset = 0.0;
            removeBrush.GradientStops[1].Offset = 0.2;

            remove = new Button();
            remove.Content = "X";
            remove.Tag = fd.GetHashCode();
            remove.FontSize = 8;
            remove.FontWeight = FontWeights.Bold;
            remove.Foreground = Brushes.White;
            remove.Margin = new Thickness(0.0, 0.0, 7.0, 0.0);
            remove.Height = 15;
            remove.Width = 15;
            remove.VerticalContentAlignment = System.Windows.VerticalAlignment.Stretch;
            remove.Background = removeBrush;
            remove.ToolTip = "Remove this FD.";
            remove.Click += new RoutedEventHandler(removeFdButton_Click);

            container = new InlineUIContainer(remove);
            container.BaselineAlignment = BaselineAlignment.Center;

            block = new Paragraph();
            block.Tag = fd.GetHashCode();
            block.Inlines.Add(container);
            block.Inlines.Add(fd.X.ToString());

            arrow = new Path();
            arrow.Margin = new Thickness(3.0, 0.0, 3.0, 0.0);
            arrow.SnapsToDevicePixels = true;
            arrow.Stroke = Brushes.Black;
            arrow.StrokeThickness = 1.0;
            arrow.FlowDirection = System.Windows.FlowDirection.LeftToRight;
            arrow.HorizontalAlignment = HorizontalAlignment.Center;
            arrow.VerticalAlignment = VerticalAlignment.Center;
            arrowLines = new GeometryGroup();
            arrowLines.Children.Add(new LineGeometry(new Point(10.0, 2.0), new Point(15.0, 6.0)));
            arrowLines.Children.Add(new LineGeometry(new Point(0.0, 6.0), new Point(15.0, 6.0)));
            arrowLines.Children.Add(new LineGeometry(new Point(10.0, 10.0), new Point(15.0, 6.0)));
            arrow.Data = arrowLines;
            block.Inlines.Add(arrow);

            block.Inlines.Add(fd.Y.ToString());

            return block;
        }