Пример #1
0
        void Button_Click(object sender, RoutedEventArgs e)
        {
            if (buttonStateIsNew) // new
            {
                IVertex baseVertex = Vertex.Get(@"BaseEdge:\From:");
                IVertex meta       = Vertex.Get(@"BaseEdge:\Meta:");

                IVertex newVertex = VertexOperations.AddInstanceByEdgeVertex(baseVertex, meta);

                GraphUtil.CreateOrReplaceEdge(Vertex.Get(@"BaseEdge:"), MinusZero.Instance.Root.Get(@"System\Meta\ZeroTypes\Edge\To"), newVertex);

                if (newVertex != null)
                {
                    ButtonSetOpen();
                }
            }
            else // open
            {
                FormVisualiser v = (FormVisualiser)UIWpf.getParentFormVisualiser(this);

                if (v != null)
                {
                    Edge.CopyAndReplaceEdge(v.Vertex, "BaseEdge", Vertex.Get("BaseEdge:"));
                }
                else
                {
                    //BaseCommands.Open(Vertex.Get("BaseEdge:"), null); // want Form visualiser
                    BaseCommands.OpenFormVisualiser(Vertex.Get("BaseEdge:"));
                }
            }
        }
Пример #2
0
        public static string GetIdentyfyingQuerySubString_ImportMeta(IEdge e)
        {
            if (VertexOperations.IsToVertexEnoughToIdentifyEdge(e.From, e.To))
            {
                return(ZeroCodeCommon.stringToPossiblyEscapedString(e.To.ToString() + "")); // there was no ToString. might cause problems
            }
            else
            if (VertexOperations.IsMetaAndToVertexEnoughToIdentifyEdge(e.From, e.Meta, e.To))
            {
                return(ZeroCodeCommon.stringToPossiblyEscapedString(e.Meta.ToString()) + ":" + ZeroCodeCommon.stringToPossiblyEscapedString(e.To.ToString()));
            }
            else
            {
                int     pos = 0;
                IVertex q   = e.From.GetAll(ZeroCodeCommon.stringToPossiblyEscapedString(e.Meta.ToString()) + ":" + ZeroCodeCommon.stringToPossiblyEscapedString(e.To.ToString()));

                IVertex tv;
                do
                {
                    tv = q.ElementAt(pos).To;
                    pos++;
                } while (tv != e.To);

                return(ZeroCodeCommon.stringToPossiblyEscapedString(e.Meta.ToString()) + ":" + ZeroCodeCommon.stringToPossiblyEscapedString(e.To.ToString()) + "|" + pos);
            }
        }
Пример #3
0
        private void FillNewVertexAndEdgeBySchemaMenu()
        {
            IVertex baseVertex = Edge.Get(@"To:");

            IVertex r = baseVertex.GetAll(@"$Is:");

            if (r.Count() == 0)
            {
                r = Edge.GetAll(@"Meta:");
            }
            ;

            if (r.Count() == 0 || r.FirstOrDefault().To.Value == null || GeneralUtil.CompareStrings(r.FirstOrDefault().To.Value, "$Empty"))
            {
                NewVertexBySchema.IsEnabled = false;
                NewEdgeBySchema.IsEnabled   = false;
                return;
            }

            NewVertexBySchema.Items.Clear();
            NewEdgeBySchema.Items.Clear();

            foreach (IEdge e in r)
            {
                NewVertexAndEdgeBySchema_FillForMeta(baseVertex, e.To, VertexOperations.GetChildEdges(e.To));
            }

            NewVertexAndEdgeBySchema_FillForMeta(baseVertex, MinusZero.Instance.Root.Get(@"System\Meta\Base\Vertex"), MinusZero.Instance.Root.GetAll(@"System\Meta\Base\Vertex\"));

            NewVertexBySchema.IsEnabled = true;
            NewEdgeBySchema.IsEnabled   = true;
        }
Пример #4
0
        protected virtual void UpdateBaseEdge()
        {
            IVertex bas = Vertex.Get(@"BaseEdge:\To:");

            if (bas != null)
            {
                ResetView();

                if (Vertex.Get(@"FilterQuery:") != null && Vertex.Get(@"FilterQuery:").Value != null)
                {
                    IVertex data = VertexOperations.DoFilter(bas, Vertex.Get(@"FilterQuery:"));

                    if (data != null)
                    {
                        ThisDataGrid.ItemsSource = data.ToList();
                    }
                    else
                    {
                        ThisDataGrid.ItemsSource = null;
                    }
                }
                else
                {
                    ThisDataGrid.ItemsSource = bas.ToList(); // if there is no .ToList DataGrid can not edit
                }
            }
        }
Пример #5
0
        public static IVertex Delete(IVertex baseVertex, IVertex inputVertex)
        {
            IVertex info = m0.MinusZero.Instance.CreateTempVertex();

            info.Value = "DELETE vertex";

            IVertex options = m0.MinusZero.Instance.CreateTempVertex();

            options.AddVertex(null, "Edge delete");
            options.AddVertex(null, "Remove from repository");
            options.AddVertex(null, "Cancel");



            IVertex option = MinusZero.Instance.DefaultShow.SelectDialogButton(info, options, null);

            bool allEdgesDelete = false;


            if (option == null || GeneralUtil.CompareStrings(option.Value, "Cancel"))
            {
                return(null);
            }

            if (GeneralUtil.CompareStrings(option.Value, "Remove from repository"))
            {
                allEdgesDelete = true;
            }

            if (inputVertex.Get("SelectedEdges:").Count() == 0)
            {
                if (allEdgesDelete)
                {
                    VertexOperations.DeleteAllEdges(baseVertex.Get("To:"));
                }
                else
                {
                    VertexOperations.DeleteOneEdge(baseVertex.Get("From:"), baseVertex.Get("Meta:"), baseVertex.Get("To:"));
                }
            }
            else
            {
                IList <IEdge> selected = GeneralUtil.CreateAndCopyList(inputVertex.Get("SelectedEdges:"));
                foreach (IEdge v in selected)
                {
                    if (allEdgesDelete)
                    {
                        VertexOperations.DeleteAllEdges(v.To.Get("To:"));
                    }
                    else
                    {
                        VertexOperations.DeleteOneEdge(v.To.Get("From:"), v.To.Get("Meta:"), v.To.Get("To:"));
                    }
                }
            }

            return(null);
        }
Пример #6
0
        public static IVertex NewDiagram(IVertex baseVertex, IVertex inputVertex)
        {
            IVertex dv = VertexOperations.AddInstance(baseVertex.Get("To:"), MinusZero.Instance.Root.Get(@"System\Meta\Visualiser\Class:Diagram"));

            GraphUtil.CreateOrReplaceEdge(dv, MinusZero.Instance.Root.Get(@"System\Meta\Visualiser\Class:Diagram\CreationPool"), baseVertex.Get("To:"));

            MinusZero.Instance.DefaultShow.EditDialog(dv, null);

            return(null);
        }
Пример #7
0
        protected override void CreateView()
        {
            if (GraphUtil.GetValueAndCompareStrings(Vertex.Get("AlternatingRows:"), "True"))
            {
                this.ThisDataGrid.AlternatingRowBackground = (Brush)FindResource("0AlternatingBackgroundBrush");
            }
            else
            {
                this.ThisDataGrid.AlternatingRowBackground = (Brush)FindResource("0BackgroundBrush");
            }

            ThisDataGrid.Columns.Clear();


            AddInfoTemplateButton();
            AddDeleteTemplateButton();

            AddColumn("", ""); // Vertex level column

            IVertex childs = null;

            if (ToShowEdgesMeta != null)
            {
                childs = VertexOperations.GetChildEdges(ToShowEdgesMeta);
                foreach (IEdge e in childs)
                {
                    if (e.To.Get("$Hide:") == null)
                    {
                        AddColumn((string)e.To.Value, "To[" + (string)e.To.Value + "]");
                    }
                }

                if (ExpertMode)
                {
                    foreach (IEdge e in MinusZero.Instance.Root.Get(@"System\Meta\Base\Vertex"))
                    {
                        bool contains = false;

                        foreach (IEdge ee in childs)
                        {
                            if (GeneralUtil.CompareStrings(ee.To, e.To))
                            {
                                contains = true;
                            }
                        }

                        if (contains == false && e.To.Get("$Hide:") == null)
                        {
                            AddColumn((string)e.To.Value, "To[" + (string)e.To.Value + "]");
                        }
                    }
                }
            }
        }
Пример #8
0
        protected override void OnClick()
        {
            ListVisualiser v = (ListVisualiser)getParentListVisualiser(this);

            if (v != null)
            {
                IVertex baseVertex      = v.Vertex.Get(@"BaseEdge:\To:");
                IVertex toShowEdgesMeta = v.Vertex.Get(@"ToShowEdgesMeta:\Meta:");

                //VertexOperations.AddInstance(baseVertex, toShowEdgesMeta);
                VertexOperations.AddInstanceByEdgeVertex(baseVertex, toShowEdgesMeta);
            }
        }
Пример #9
0
        public static IVertex Paste(IVertex baseVertex, IVertex inputVertex)
        {
            foreach (IVertex v in CutPasteStore)
            {
                if (DoCut)
                {
                    VertexOperations.DeleteOneEdge(v.Get("From:"), v.Get("Meta:"), v.Get("To:"));
                }

                baseVertex.Get("To:").AddEdge(v.Get("Meta:"), v.Get("To:"));
            }

            return(null);
        }
Пример #10
0
        public void AddDiagramLineVertex(IEdge edge, IVertex diagramLineDefinition, DiagramItemBase toItem)
        {
            IVertex r = MinusZero.Instance.Root;

            ((EasyVertex)Vertex).CanFireChangeEvent = false;

            IVertex l = VertexOperations.AddInstance(Vertex, diagramLineDefinition.Get("DiagramLineClass:"), r.Get(@"System\Meta\Visualiser\DiagramInternal\DiagramItemBase\DiagramLine"));

            GraphUtil.CreateOrReplaceEdge(l, r.Get(@"System\Meta\Visualiser\DiagramInternal\DiagramLineBase\ToDiagramItem"), toItem.Vertex);

            GraphUtil.CreateOrReplaceEdge(l, r.Get(@"System\Meta\Visualiser\DiagramInternal\DiagramLineBase\Definition"), diagramLineDefinition);

            Edge.CreateEdgeAndCreateOrReplaceEdgeByMeta(l, r.Get(@"System\Meta\ZeroTypes\HasBaseEdge\BaseEdge"), edge);

            AddDiagramLineObject(toItem, l);

            ((EasyVertex)Vertex).CanFireChangeEvent = true;
        }
Пример #11
0
        public static IVertex NewVertexBySchema(IVertex baseVertex, IVertex inputVertex)
        {
            IVertex Vertex     = baseVertex.Get("To:");
            IVertex MetaVertex = inputVertex;

            IVertex v = VertexOperations.AddInstance(Vertex, MetaVertex);

            if (VertexOperations.GetChildEdges(MetaVertex).Count() > 0)
            {
                MinusZero.Instance.DefaultShow.EditDialog(v, null);
            }
            else
            {
                NewVertexBySchema d = new NewVertexBySchema(v, MetaVertex);

                MinusZero.Instance.DefaultShow.ShowContentFloating(d);
            }

            return(null);
        }
Пример #12
0
        private void NewVertexAndEdgeBySchema_FillForMeta(IVertex baseVertex, IVertex meta, IVertex metaEdges)
        {
            //if (meta.Value != null && !GeneralUtil.CompareStrings(meta.Value, "$Empty"))
            //{
            MenuItem i = createMenuItem(meta.Value.ToString());

            NewVertexBySchema.Items.Add(i);

            MenuItem ie = createMenuItem(meta.Value.ToString());

            NewEdgeBySchema.Items.Add(ie);

            foreach (IEdge ee in metaEdges)
            {
                if (ee.To.Value != null && !GeneralUtil.CompareStrings(ee.To.Value, "$Empty"))
                {
                    MenuItem ii = createMenuItem(ee.To.Value.ToString());
                    ii.Tag = ee.To;
                    i.Items.Add(ii);

                    MenuItem iie = createMenuItem(ee.To.Value.ToString());
                    iie.Tag = ee.To;
                    ie.Items.Add(iie);

                    if (VertexOperations.TestIfNewEdgeValid(baseVertex, ee.To, null) != null)
                    {
                        ii.IsEnabled  = false;
                        iie.IsEnabled = false;
                    }

                    ii.Click  += OnNewVertexBySchema;
                    iie.Click += OnNewEdgeBySchema;
                }
            }
            //}
        }
Пример #13
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            MinusZero.Instance.DefaultShow.CloseWindowByContent(this);

            if (GeneralUtil.CompareStrings(this.Schema.Vertex.Get(@"BaseEdge:\To:\To:").Value, "$Empty"))
            {
                Vertex.AddVertex(null, this.Content.Text);
            }
            else
            {
                //Vertex.AddVertex(this.Schema.Vertex.Get(@"BaseEdge:\To:\To:"), this.Content.Text);

                IVertex meta = this.Schema.Vertex.Get(@"BaseEdge:\To:\To:");

                IVertex v = VertexOperations.AddInstance(Vertex, meta);

                v.Value = this.Content.Text;

                if (VertexOperations.GetChildEdges(meta).Count() > 0)
                {
                    MinusZero.Instance.DefaultShow.EditDialog(v, null);
                }
            }
        }
Пример #14
0
        private void PreFillForm()
        {
            TabList = new Dictionary <string, TabInfo>();

            IVertex basTo = Vertex.Get(@"BaseEdge:\To:");

            IVertex metaForForm = getMetaForForm();

            List <IEdge> childs = new List <IEdge>();

            if (metaForForm == null || metaForForm.Count() == 0) // if Form is not typed
            {
                IList <IVertex> visited = new List <IVertex>();

                foreach (IEdge e in basTo)
                {
                    childs.Add(e);
                    if (!visited.Contains(e.Meta) && e.Meta.Get("$Hide:") == null)
                    {
                        if (basTo.GetAll(e.Meta + ":").Count() > 1)
                        {
                            PreFillFormAnalyseEdge(e.Meta, true);
                            visited.Add(e.Meta);
                        }
                        else
                        {
                            PreFillFormAnalyseEdge(e.Meta, false);
                        }
                    }
                }
            }
            else // Form is typed
            {
                foreach (IEdge e in VertexOperations.GetChildEdges(metaForForm))
                {
                    childs.Add(e);

                    if (e.To.Get("$Hide:") == null)
                    {
                        if (GraphUtil.GetIntegerValue(e.To.Get("$MaxCardinality:")) > 1 || GraphUtil.GetIntegerValue(e.To.Get("$MaxCardinality:")) == -1)
                        {
                            PreFillFormAnalyseEdge(e.To, true);
                        }
                        else
                        {
                            PreFillFormAnalyseEdge(e.To, false);
                        }
                    }
                }
            }

            if (ExpertMode)
            {
                foreach (IEdge e in MinusZero.Instance.Root.Get(@"System\Meta\Base\Vertex"))
                {
                    bool contains = false;

                    foreach (IEdge ee in childs)
                    {
                        if (GeneralUtil.CompareStrings(ee.To, e.To))
                        {
                            contains = true;
                        }
                    }

                    if (contains == false)
                    {
                        PreFillFormAnalyseEdge(e.To, false);
                    }
                }
            }
        }
Пример #15
0
 protected override void OnClick()
 {
     VertexOperations.DeleteOneEdge(BaseEdge.From, BaseEdge.Meta, BaseEdge.To);
 }
Пример #16
0
        protected override void UpdateBaseEdge()
        {
            IVertex bas = Vertex.Get(@"BaseEdge:\To:");

            if (bas != null)
            {
                ToShowEdgesMeta = null;

                if (Vertex.Get(@"ToShowEdgesMeta:\Meta:") != null)
                {
                    ToShowEdgesMeta = Vertex.Get(@"ToShowEdgesMeta:\Meta:");
                }

                if (ToShowEdgesMeta == null) // take first edge from BaseEdge\To, to have Meta as ToShowEdesMeta:\Meta:==null
                {
                    IEdge e = bas.FirstOrDefault();

                    if (e != null)
                    {
                        ToShowEdgesMeta = e.Meta;

                        VertexChangeListenOff();

                        Edge.AddEdgeEdges(Vertex.Get(@"ToShowEdgesMeta:"), e);

                        VertexChangeListenOn();
                    }
                }

                if (ToShowEdgesMeta != null)
                {
                    ((EasyVertex)Vertex.Get(@"FilterQuery:")).CanFireChangeEvent = false;

                    Vertex.Get(@"FilterQuery:").Value = ToShowEdgesMeta.Value + ":";

                    ((EasyVertex)Vertex.Get(@"FilterQuery:")).CanFireChangeEvent = true;
                }


                if (Vertex.Get(@"FilterQuery:") != null && Vertex.Get(@"FilterQuery:").Value != null) // do the filtering
                {
                    IVertex data = VertexOperations.DoFilter(bas, Vertex.Get(@"FilterQuery:"));

                    if (data != null)
                    {
                        ThisDataGrid.ItemsSource = data.ToList();
                    }
                    else
                    {
                        ThisDataGrid.ItemsSource = null;
                    }
                }
                else
                {
                    ThisDataGrid.ItemsSource = bas.ToList(); // if there is no .ToList DataGrid can not edit
                }
                if (GraphUtil.GetValueAndCompareStrings(Vertex.Get("ExpertMode:"), "True"))
                {
                    ExpertMode = true;
                }
                else
                {
                    ExpertMode = false;
                }

                ResetView();
            }
        }
Пример #17
0
        public virtual void DoCreateDiagramLine(DiagramItemBase toItem)
        {
            IVertex toEdge = toItem.Vertex.Get("BaseEdge:");

            IVertex r = m0.MinusZero.Instance.Root;

            IVertex v = m0.MinusZero.Instance.CreateTempVertex();


            foreach (IEdge def in Vertex.GetAll(@"Definition:\DiagramLineDefinition:"))
            {
                bool CreateEdgeOnly = false;

                if (GraphUtil.GetValueAndCompareStrings(def.To.Get("CreateEdgeOnly:"), "True"))
                {
                    CreateEdgeOnly = true;
                }

                foreach (IEdge e in Vertex.GetAll(@"BaseEdge:\To:\" + def.To.Get("EdgeTestQuery:")))
                {
                    bool canAdd = true;

                    if (def.To.Get("ToDiagramItemTestQuery:") != null && toItem.Vertex.Get((string)def.To.Get("ToDiagramItemTestQuery:").Value) == null)
                    {
                        canAdd = false;
                    }

                    if (e.To.Get(@"$EdgeTarget:") != null &&
                        !GeneralUtil.CompareStrings(e.To.Get(@"$EdgeTarget:").Value, "Vertex") && // Vertexes do not have $Is:Vertex
                        toEdge.Get(@"To:\$Is:" + (string)e.To.Get(@"$EdgeTarget:").Value) == null)
                    {
                        canAdd = false;
                    }

                    if (CreateEdgeOnly == false &&
                        e.To.Get(@"$VertexTarget:") != null &&
                        toEdge.Get(@"To:\$Is:" + (string)e.To.Get(@"$VertexTarget:").Value) == null)
                    {
                        canAdd = false;
                    }

                    if (canAdd)
                    {
                        AddNewLineOption(v, def, e);
                    }
                }

                if (GeneralUtil.CompareStrings(def.To.Value, "Edge"))// Vertex\Edge
                {
                    foreach (IEdge e in r.Get(@"System\Meta\Base\Vertex"))
                    {
                        AddNewLineOption(v, def, e);
                    }
                }

                if (GeneralUtil.CompareStrings(def.To.Get("EdgeTestQuery:"), "$EdgeTarget")) // $EdgeTarget is not present as there is no inheritance from Vertex
                {
                    AddNewLineOption(v, def, GraphUtil.FindEdgeByToVertex(r.Get(@"System\Meta\Base\Vertex"), "$EdgeTarget"));
                }
            }

            if (v.Count() == 0)
            {
                MinusZero.Instance.DefaultShow.ShowInfo("There is no diagram line definition matching selected source and target items.");
            }

            IVertex info = m0.MinusZero.Instance.CreateTempVertex();

            info.Value = "choose diagram line:";


            Point mousePosition = UIWpf.GetMousePosition();

            IVertex a = MinusZero.Instance.DefaultShow.SelectDialog(info, v, mousePosition);

            if (a != null)
            {
                IVertex test = VertexOperations.TestIfNewEdgeValid(Vertex.Get(@"BaseEdge:\To:"), a.Get("OptionEdge:"), toEdge.Get("To:"));

                if (test == null)
                {
                    bool?ForceShowEditForm = null;      // ForceShowEditForm

                    if (a.Get(@"OptionDiagramLineDefinition:\ForceShowEditForm:") != null)
                    {
                        if (GeneralUtil.CompareStrings(a.Get(@"OptionDiagramLineDefinition:\ForceShowEditForm:"), "True"))
                        {
                            ForceShowEditForm = true;
                        }

                        if (GeneralUtil.CompareStrings(a.Get(@"OptionDiagramLineDefinition:\ForceShowEditForm:"), "False"))
                        {
                            ForceShowEditForm = false;
                        }
                    }

                    bool CreateEdgeOnly = false;     // CreateEdgeOnly

                    if (GraphUtil.GetValueAndCompareStrings(a.Get(@"OptionDiagramLineDefinition:\CreateEdgeOnly:"), "True"))
                    {
                        CreateEdgeOnly = true;
                    }


                    CanAutomaticallyAddEdges = false;     // for VertexChange
                    IEdge edge = VertexOperations.AddEdgeOrVertexByMeta(Vertex.Get(@"BaseEdge:\To:"), a.Get("OptionEdge:"), toEdge.Get("To:"), mousePosition, CreateEdgeOnly, ForceShowEditForm);
                    CanAutomaticallyAddEdges = true;

                    AddDiagramLineVertex(edge, a.Get(@"OptionDiagramLineDefinition:"), toItem);
                }
                else
                {
                    MinusZero.Instance.DefaultShow.ShowInfo("Adding new diagram line  \"" + a.Value + "\" is not possible.\n\n" + test.Value);
                }
            }
        }
Пример #18
0
        public void UpdateBaseEdge()
        {
            DispachAllSubVisualisers();

            BaseVertexEdgeAdded_PreFill = false;
            BaseVertexEdgeAdded         = false;


            //  if (!isLoaded)
            //    return;

            IVertex basTo = Vertex.Get(@"BaseEdge:\To:");

            if (basTo != null)
            {
                if ((string)Vertex.Get(@"SectionsAsTabs:").Value == "True")
                {
                    SectionsAsTabs = true;
                }
                else
                {
                    SectionsAsTabs = false;
                }

                if ((string)Vertex.Get(@"MetaOnLeft:").Value == "True")
                {
                    MetaOnLeft = true;
                }
                else
                {
                    MetaOnLeft = false;
                }

                if ((string)Vertex.Get(@"ExpertMode:").Value == "True")
                {
                    ExpertMode = true;
                }
                else
                {
                    ExpertMode = false;
                }

                ColumnNumber = GraphUtil.GetIntegerValue(Vertex.Get(@"ColumnNumber:"));

                IVertex metaForForm = getMetaForForm();

                PreFillForm();

                InitializeControlContent();

                List <IEdge> childs = new List <IEdge>();

                if (metaForForm == null || metaForForm.Count() == 0) // if Form is not typed
                {
                    IList <IVertex> visited = new List <IVertex>();

                    foreach (IEdge e in basTo)
                    {
                        childs.Add(e);

                        if (!visited.Contains(e.Meta) && e.Meta.Get("$Hide:") == null)
                        {
                            if (basTo.GetAll(e.Meta + ":").Count() > 1)
                            {
                                AddEdge(e.Meta, true);
                                visited.Add(e.Meta);
                            }
                            else
                            {
                                AddEdge(e.Meta, false);
                            }
                        }
                    }
                }
                else // Form is typed
                {
                    foreach (IEdge e in VertexOperations.GetChildEdges(metaForForm))
                    {
                        childs.Add(e);

                        if (e.To.Get("$Hide:") == null)
                        {
                            if (GraphUtil.GetIntegerValue(e.To.Get("$MaxCardinality:")) > 1 || GraphUtil.GetIntegerValue(e.To.Get("$MaxCardinality:")) == -1)
                            {
                                AddEdge(e.To, true);
                            }
                            else
                            {
                                AddEdge(e.To, false);
                            }
                        }
                    }
                }

                if (ExpertMode)
                {
                    foreach (IEdge e in MinusZero.Instance.Root.Get(@"System\Meta\Base\Vertex"))
                    {
                        bool contains = false;

                        foreach (IEdge ee in childs)
                        {
                            if (GeneralUtil.CompareStrings(ee.To, e.To))
                            {
                                contains = true;
                            }
                        }

                        if (contains == false)
                        {
                            AddEdge(e.To, false);
                        }
                    }
                }

                if (MetaOnLeft)
                {
                    if (!HasTabs)
                    {
                        CorrectWidth(TabList[""]);
                    }
                }
            }
        }
Пример #19
0
        private void CreateTestData()
        {
            IVertex r = MinusZero.Instance.Root;

            GeneralUtil.ParseAndExcute(r, r.Get(@"System\Meta"), @"{TEST3{Class:Customer{},Class:Person{$Description:opis,Attribute:Name,Attribute:Surname,Attribute:DateOfBirth},Class:Company{Attribute:Name,Attribute:RegistrationNumber,},Class:Adress{Attribute:Line 1,Attribute:Line 2,Attribute:Line 3,Attribute:City,Attribute:County,Attribute:Postal code,Attribute:Country},Class:Basket{Attribute:Creation date,Attribute:Status},Class:Item{Attribute:Name,Attribute:Description,Attribute:Price}}}");

            r.Get(@"TEST3\Customer").AddEdge(r.Get(@"System\Meta*$Is"), r.Get(@"System\Meta\UML\Class"));
            r.Get(@"TEST3\Person").AddEdge(r.Get(@"System\Meta*$Is"), r.Get(@"System\Meta\UML\Class"));
            r.Get(@"TEST3\Company").AddEdge(r.Get(@"System\Meta*$Is"), r.Get(@"System\Meta\UML\Class"));
            r.Get(@"TEST3\Adress").AddEdge(r.Get(@"System\Meta*$Is"), r.Get(@"System\Meta\UML\Class"));
            r.Get(@"TEST3\Basket").AddEdge(r.Get(@"System\Meta*$Is"), r.Get(@"System\Meta\UML\Class"));
            r.Get(@"TEST3\Item").AddEdge(r.Get(@"System\Meta*$Is"), r.Get(@"System\Meta\UML\Class"));

            GeneralUtil.ParseAndExcute(r, r.Get(@"System\Meta"), "{TEST2,TEST{Class:Person{Association:Spouse{$MaxCardinality:1,$MaxTargetCardinality:1},Aggregation:Child{$MaxCardinality:3},Attribute:Name,Attribute:Surname,Attribute:Age{MinValue:0,MaxValue:40},Attribute:NoseLength{MinValue:0,MaxValue:40},Attribute:Money{MinValue:0,MaxValue:1000},Attribute:IsGood,Attribute:IsPretty,Attribute:IsPretty2,Attribute:IsPretty3},Enum:Pretty{EnumValue:Yes,EnumValue:No,EnumValue:Maybe}}}");

            r.Get(@"TEST\Pretty").AddEdge(r.Get(@"System\Meta*$Inherits"), r.Get(@"System\Meta\ZeroTypes\EnumBase"));
            r.Get(@"TEST\Person").AddEdge(r.Get(@"System\Meta*$Is"), r.Get(@"System\Meta\UML\Class"));

            IVertex smzt = r.Get(@"System\Meta\ZeroTypes");

            IVertex EdgeTarget = r.Get(@"System\Meta*$EdgeTarget");

            IVertex Person = r.Get(@"TEST\Person");



            IVertex smu = r.Get(@"System\Meta\UML");
            IVertex smb = r.Get(@"System\Meta\Base");


            IVertex function_function = Person.AddVertex(smu.Get(@"Function"), "Sleep");

            function_function.AddEdge(smu.Get(@"Function\Output"), smzt.Get("Integer"));

            IVertex ffi = function_function.AddVertex(smu.Get(@"Function\InputParameter"), "time");

            ffi.AddEdge(smb.Get(@"Vertex\$VertexTarget"), smzt.Get("Integer"));

            //
            ffi.AddVertex(smb.Get(@"Vertex\$Description"), "this is opis time");
            function_function.AddVertex(smb.Get(@"Vertex\$Description"), "this is opis function");
            //

            IVertex ffi2 = function_function.AddVertex(smu.Get(@"Function\InputParameter"), "fastMode");

            ffi2.AddEdge(smb.Get(@"Vertex\$VertexTarget"), smzt.Get("Boolean"));

            IVertex ffi3 = function_function.AddVertex(smu.Get(@"Function\InputParameter"), "interrupt");

            ffi3.AddEdge(smb.Get(@"Vertex\$VertexTarget"), smzt.Get("Integer"));


            function_function.AddVertex(smu.Get(@"[]"), null);

            function_function.AddEdge(smb.Get(@"$NewLine"), smb.Get(@"$Empty"));

            //

            /*IVertex function2_function = Person.AddVertex(smu.Get(@"Function"), "Sleep");
             *
             * function2_function.AddEdge(smu.Get(@"Function\Output"), smzt.Get("Integer"));
             *
             * IVertex f2fi = function2_function.AddVertex(smu.Get(@"Function\InputParameter"), "time");
             *
             * f2fi.AddEdge(smb.Get(@"Vertex\$VertexTarget"), smzt.Get("Integer"));
             *
             *
             * function2_function.AddVertex(smu.Get(@"[]"), null);
             *
             * function2_function.AddVertex(smb.Get(@"$NewLine"), "3");
             *
             */

            Person.Get("Name").AddEdge(EdgeTarget, smzt.Get("String"));

            Person.Get("Spouse").AddEdge(r.Get(@"System\Meta*$EdgeTarget"), Person);
            Person.Get("Child").AddEdge(r.Get(@"System\Meta*$EdgeTarget"), Person);

            Person.Get("Surname").AddEdge(EdgeTarget, smzt.Get("String"));
            Person.Get("Age").AddEdge(EdgeTarget, smzt.Get("Integer"));
            Person.Get("NoseLength").AddEdge(EdgeTarget, smzt.Get("Float"));
            Person.Get("Money").AddEdge(EdgeTarget, smzt.Get("Decimal"));
            Person.Get("IsGood").AddEdge(EdgeTarget, smzt.Get("Boolean"));
            Person.Get("IsPretty").AddEdge(EdgeTarget, r.Get(@"TEST\Pretty"));
            Person.Get("IsPretty2").AddEdge(EdgeTarget, r.Get(@"TEST\Pretty"));
            Person.Get("IsPretty3").AddEdge(EdgeTarget, r.Get(@"TEST\Pretty"));

            //Person.AddEdge(smu.Get(@"Class\Attribute"), Person.Get("Surname"));
            // what is it for?

            GeneralUtil.ParseAndExcute(r.Get("TEST"), r.Get(@"TEST"), "{Person:Person1{Name:Radek,Surname:Tereszczuk,Age:34,NoseLength:\"2,3\",Money:999,IsGood:False,IsPretty:},Person:Person2{Name:Maurycy,Surname:Tereszczuk,Age:1,NoseLength:1.1,Money:9999,IsGood:True,IsPretty:}}");

            GeneralUtil.ParseAndExcute(r.Get("TEST"), r.Get(@"TEST"), "{Person:Person3{Name:Radek,Surname:Tereszczuk,Age:34,NoseLength:\"2,3\",Money:999,IsGood:False,IsPretty:},Person:Person4{Name:Maurycy,Surname:Tereszczuk,Age:1,NoseLength:1.1,Money:9999,IsGood:True,IsPretty:}}");

            r.Get(@"TEST\Person1").AddEdge(r.Get(@"System\Meta*$Is"), r.Get(@"TEST\Person"));
            r.Get(@"TEST\Person2").AddEdge(r.Get(@"System\Meta*$Is"), r.Get(@"TEST\Person"));
            r.Get(@"TEST\Person3").AddEdge(r.Get(@"System\Meta*$Is"), r.Get(@"TEST\Person"));
            r.Get(@"TEST\Person4").AddEdge(r.Get(@"System\Meta*$Is"), r.Get(@"TEST\Person"));

            GraphUtil.ReplaceEdge(r.Get(@"TEST\Person1"), "IsPretty", r.Get(@"TEST\Pretty\No"));
            GraphUtil.ReplaceEdge(r.Get(@"TEST\Person2"), "IsPretty", r.Get(@"TEST\Pretty\Yes"));
            GraphUtil.ReplaceEdge(r.Get(@"TEST\Person3"), "IsPretty", r.Get(@"TEST\Pretty\Yes"));
            GraphUtil.ReplaceEdge(r.Get(@"TEST\Person4"), "IsPretty", r.Get(@"TEST\Pretty\Yes"));


            for (int x = 0; x < 1; x++)
            {
                GeneralUtil.ParseAndExcute(r.Get("TEST2"), r.Get(@"TEST"), "{Person:Person1" + x + "{Name:Radek,Surname:Tereszczuk,Age:34,NoseLength:\"2,3\",Money:999,IsGood:False,IsPretty:},Person:Person2" + x + "{Name:Maurycy,Surname:Tereszczuk,Age:1,NoseLength:1.1,Money:9999,IsGood:True,IsPretty:}}");


                GeneralUtil.ParseAndExcute(r.Get("TEST2"), r.Get(@"TEST"), "{Person:Person3" + x + "{Name:Magda,Surname:Tereszczuk,Age:18,NoseLength:\"2,1\",Money:999,IsGood:True,IsPretty:},Person:Person4" + x + "{Name:Jan,Surname:Kuciak,Age:10,NoseLength:0.6,Money:99999,IsGood:True,IsPretty:}}");

                GraphUtil.ReplaceEdge(r.Get(@"TEST2\Person1" + x), "IsPretty", r.Get(@"TEST\Pretty\No"));
                GraphUtil.ReplaceEdge(r.Get(@"TEST2\Person2" + x), "IsPretty", r.Get(@"TEST\Pretty\Yes"));
                GraphUtil.ReplaceEdge(r.Get(@"TEST2\Person3" + x), "IsPretty", r.Get(@"TEST\Pretty\Yes"));
                GraphUtil.ReplaceEdge(r.Get(@"TEST2\Person4" + x), "IsPretty", r.Get(@"TEST\Pretty\Yes"));

                r.Get(@"TEST2\Person1" + x + @"\Radek").AddEdge(r.Get(@"System\Meta*$Is"), smzt.Get("String"));


                r.Get(@"TEST2\Person1" + x).AddEdge(r.Get(@"System\Meta*$Is"), r.Get(@"TEST\Person"));
                r.Get(@"TEST2\Person2" + x).AddEdge(r.Get(@"System\Meta*$Is"), r.Get(@"TEST\Person"));
                r.Get(@"TEST2\Person3" + x).AddEdge(r.Get(@"System\Meta*$Is"), r.Get(@"TEST\Person"));
                r.Get(@"TEST2\Person4" + x).AddEdge(r.Get(@"System\Meta*$Is"), r.Get(@"TEST\Person"));
            }

            for (int x = 0; x < 1; x++)
            {
                for (int y = 0; y < 1; y++)
                {
                    r.Get(@"TEST2\Person1" + x).AddEdge(r.Get(@"TEST\Person\Child"), r.Get(@"TEST2\Person1" + y));
                    r.Get(@"TEST2\Person2" + x).AddEdge(r.Get(@"TEST\Person\Child"), r.Get(@"TEST2\Person2" + y));
                    r.Get(@"TEST2\Person3" + x).AddEdge(r.Get(@"TEST\Person\Child"), r.Get(@"TEST2\Person3" + y));
                    r.Get(@"TEST2\Person4" + x).AddEdge(r.Get(@"TEST\Person\Child"), r.Get(@"TEST2\Person4" + y));
                }
            }

            for (int i = 1; i <= 1; i++)
            {
                IVertex x = r.Get("TEST2").AddVertex(null, i);

                for (int ii = 1; ii <= 1; ii++)
                {
                    IVertex xx = x.AddVertex(null, i + " " + ii);

                    for (int iii = 1; iii <= 1; iii++)
                    {
                        IVertex xxx = xx.AddVertex(null, i + " " + ii + " " + iii);

                        for (int iiii = 1; iiii <= 3; iiii++)
                        {
                            xxx.AddVertex(null, i + " " + ii + " " + iii + " " + iiii);
                        }
                    }
                }
            }

            //r.Get(@"TEST2\1").AddEdge(null, r.Get(@"TEST2\2\2 2\2 2 1"));

            GeneralUtil.ParseAndExcute(r.Get("TEST"), r.Get(@"System\Meta"), "{Diagram:TestDiagram{ZoomVisualiserContent:100,SelectedEdges:,CreationPool:}}");

            r.Get(@"TEST\TestDiagram").AddVertex(r.Get(@"System\Meta\Visualiser\Diagram\SizeX"), 600.0);

            r.Get(@"TEST\TestDiagram").AddVertex(r.Get(@"System\Meta\Visualiser\Diagram\SizeY"), 600.0);

            r.Get(@"TEST\TestDiagram").AddEdge(r.Get(@"System\Meta*$Is"), r.Get(@"System\Meta*Diagram"));

            IVertex i1 = r.Get(@"TEST\TestDiagram").AddVertex(r.Get(@"System\Meta*Item"), null);

            GeneralUtil.ParseAndExcute(i1, r.Get(@"System\Meta"), "{PositionX:0,PositionY:0,SizeX:100,SizeY:100}");

            IVertex i2 = r.Get(@"TEST\TestDiagram").AddVertex(r.Get(@"System\Meta*Item"), null);

            GeneralUtil.ParseAndExcute(i2, r.Get(@"System\Meta"), "{PositionX:200,PositionY:200,SizeX:100,SizeY:100}");

            i1.AddEdge(r.Get(@"System\Meta*$Is"), r.Get(@"System\Meta\Visualiser\DiagramInternal\DiagramRectangleItem"));

            i1.AddEdge(r.Get(@"System\Meta\Visualiser\DiagramInternal\DiagramItemBase\Definition"), r.Get(@"System\Data\Visualiser\Diagram\Object"));

            Edge.AddEdgeByToVertex(i1, r.Get(@"System\Meta\ZeroTypes\HasBaseEdge\BaseEdge"), r.Get(@"TEST\Person1"));

            i2.AddEdge(r.Get(@"System\Meta*$Is"), r.Get(@"System\Meta\Visualiser\DiagramInternal\DiagramRectangleItem"));

            i2.AddEdge(r.Get(@"System\Meta\Visualiser\DiagramInternal\DiagramItemBase\Definition"), r.Get(@"System\Data\Visualiser\Diagram\Object"));

            Edge.AddEdgeByToVertex(i2, r.Get(@"System\Meta\ZeroTypes\HasBaseEdge\BaseEdge"), r.Get(@"TEST\Person2"));



            i1 = r.Get(@"TEST\TestDiagram").AddVertex(r.Get(@"System\Meta*Item"), null);

            GeneralUtil.ParseAndExcute(i1, r.Get(@"System\Meta"), "{PositionX:350,PositionY:0}");

            i2 = r.Get(@"TEST\TestDiagram").AddVertex(r.Get(@"System\Meta*Item"), null);

            GeneralUtil.ParseAndExcute(i2, r.Get(@"System\Meta"), "{PositionX:0,PositionY:350}");

            i1.AddEdge(r.Get(@"System\Meta\Visualiser\DiagramInternal\DiagramItemBase\Definition"), r.Get(@"System\Data\Visualiser\Diagram\Object"));

            i1.AddEdge(r.Get(@"System\Meta*$Is"), r.Get(@"System\Meta\Visualiser\DiagramInternal\DiagramRectangleItem"));

            Edge.AddEdgeByToVertex(i1, r.Get(@"System\Meta\ZeroTypes\HasBaseEdge\BaseEdge"), r.Get(@"TEST\Person3"));

            i2.AddEdge(r.Get(@"System\Meta*$Is"), r.Get(@"System\Meta\Visualiser\DiagramInternal\DiagramRectangleItem"));

            i2.AddEdge(r.Get(@"System\Meta\Visualiser\DiagramInternal\DiagramItemBase\Definition"), r.Get(@"System\Data\Visualiser\Diagram\Object"));

            Edge.AddEdgeByToVertex(i2, r.Get(@"System\Meta\ZeroTypes\HasBaseEdge\BaseEdge"), r.Get(@"TEST\Person4"));

            /////////////////////

            /* GeneralUtil.ParseAndExcute(r.Get("TEST"), r.Get(@"System\Meta"), "{Class:X1,Class:X2,Class:X3,Class:X4,Class:PersonA,Class:PersonB,Class:PersonB2{Attribute:New}}");
             *
             * r.Get(@"TEST\PersonB2\New").AddEdge(r.Get(@"System\Meta*$EdgeTarget"), r.Get(@"System\Meta*String"));
             *
             * VertexOperations.AddInstance(r.Get("TEST"), r.Get(@"TEST\PersonB2"), r.Get(@"TEST\Person")).Value="XXX";
             *
             * r.Get(@"TEST\X2").AddEdge(r.Get(@"System\Meta*$Inherits"), r.Get(@"TEST\Person"));
             * r.Get(@"TEST\X3").AddEdge(r.Get(@"System\Meta*$Inherits"), r.Get(@"TEST\X2"));
             * r.Get(@"TEST\X4").AddEdge(r.Get(@"System\Meta*$Inherits"), r.Get(@"TEST\X3"));
             *
             * r.Get(@"TEST\PersonA").AddEdge(r.Get(@"System\Meta*$Inherits"), r.Get(@"TEST\Person"));
             * r.Get(@"TEST\PersonB").AddEdge(r.Get(@"System\Meta*$Inherits"), r.Get(@"TEST\Person"));
             * r.Get(@"TEST\PersonB2").AddEdge(r.Get(@"System\Meta*$Inherits"), r.Get(@"TEST\PersonB"));
             *
             * r.Get(@"TEST\XXX").AddEdge(r.Get(@"System\Meta*$Is"), r.Get(@"TEST\PersonA"));
             * r.Get(@"TEST\XXX").AddEdge(r.Get(@"System\Meta*$Is"), r.Get(@"TEST\X4"));*/

            //////////////////////

            IVertex tt = r.Get("TEST").AddVertex(r.Get("System*Class"), "TestClass");

            for (int x = 0; x < 1; x++)
            {
                for (int y = 0; y < 1; y++)
                {
                    IVertex tta = tt.AddVertex(r.Get("System*Attribute"), "a" + x + " " + y + ";" + randomChars());
                    tta.AddVertex(r.Get("System*$Group"), x.ToString());
                    tta.AddVertex(r.Get("System*$Section"), y.ToString());

                    tta.AddEdge(r.Get("System*$EdgeTarget"), r.Get("System*String"));

                    IVertex ttb = tt.AddVertex(r.Get("System*Attribute"), "b" + x + " " + y + ";" + randomChars());
                    ttb.AddVertex(r.Get("System*$Group"), x.ToString());
                    //ttb.AddVertex(r.Get("System*$Section"), y.ToString());
                    ttb.AddEdge(r.Get("System*$EdgeTarget"), r.Get("System*String"));

                    IVertex ttc = tt.AddVertex(r.Get("System*Attribute"), "c" + x + " " + y + ";" + randomChars());
                    ttc.AddVertex(r.Get("System*$Group"), x.ToString());
                    ttc.AddVertex(r.Get("System*$Section"), y.ToString());
                    ttc.AddVertex(r.Get("System*$MaxCardinality"), 6);
                    ttc.AddEdge(r.Get("System*$EdgeTarget"), r.Get("System*String"));
                }
            }

            VertexOperations.AddInstance(r.Get("TEST"), tt);

            //////////////////////


            IVertex start = r.Get(@"TEST3");

            for (int i = 0; i < 1; i++)
            {
                IVertex sm = start.AddVertex(r.Get(@"System\Meta\UML\StateMachine"), "sm " + i);

                for (int ii = 0; ii < 1; ii++)
                {
                    sm.AddVertex(r.Get(@"System\Meta\UML\StateMachine\State"), "state " + ii + " of machine" + i);
                }

                IVertex allstates = sm.GetAll("");

                foreach (IEdge e in allstates)
                {
                    foreach (IEdge ee in allstates)
                    {
                        e.To.AddEdge(r.Get(@"System\Meta\UML\StateMachine\State\Transition"), ee.To);
                    }
                }
            }

            //////////////////////

            IVertex associations = r.GetAll(@"TEST\Person\Association:");
            IVertex ismeta       = r.Get(@"System\Meta*$Is");
            IVertex asmeta       = r.Get(@"System\Meta\UML\Class\Association");

            //foreach (IEdge v in associations)
            //   v.To.AddEdge(ismeta, asmeta);

            IVertex attributes = r.GetAll(@"TEST\Person\Attribute:");
            //IVertex ismeta=r.Get(@"System\Meta*$Is");
            IVertex ameta = r.Get(@"System\Meta\UML\Class\Attribute");

            foreach (IEdge v in attributes)
            {
                v.To.AddEdge(ismeta, ameta);
            }

            attributes = r.GetAll(@"TEST3\\Attribute:");

            foreach (IEdge v in attributes)
            {
                v.To.AddEdge(ismeta, ameta);
            }

            IVertex test = r.Get("TEST");

            test.AddVertex(test.AddVertex(null, "Counter"), (int)0);


            IVertex vvv = VertexOperations.AddInstance(test, r.Get(@"System\Meta\Base\$Import"));

            vvv.AddEdge(r.Get(@"System\Meta\Base\Vertex\$$IsLink"), MinusZero.Instance.Empty);

            vvv.Value = "tst";

            test.AddEdge(r.Get(@"TEST\tst"), r.Get(@"System\Meta\Visualiser"));

            /////

            IVertex aattributes = r.GetAll(@"TEST\\Attribute:");

            IVertex isAggregation = r.Get(@"System\Meta\Base\Vertex\$IsAggregation");
            IVertex empty         = r.Get(@"System\Meta\Base\$Empty");

            foreach (IEdge v in aattributes)
            {
                v.To.AddEdge(isAggregation, empty);
            }

            IVertex aggregations = r.GetAll(@"TEST\\Aggregation:");

            foreach (IEdge v in aggregations)
            {
                v.To.AddEdge(isAggregation, empty);
            }

            ///

            IVertex vx = r.AddVertex(null, "X");

            IVertex my = vx.AddVertex(null, "j e s ");

            IVertex vxx = vx.AddVertex(null, "VXX");

            IVertex c = VertexOperations.AddInstance(vxx, smu.Get("[]"));

            c.Value = "";

            c.AddVertex(smu.Get(@"MultiOperator\Expression"), "raz");

            IVertex dwa = c.AddVertex(smu.Get(@"MultiOperator\Expression"), "dwa");

            //dwa.AddVertex(smb.Get(@"Vertex\$Description"), "3 3 3");

            c.AddEdge(smu.Get(@"MultiOperator\Expression"), my);

            IVertex cztery = c.AddVertex(smu.Get(@"MultiOperator\Expression"), "cztery");

            //cztery.AddVertex(smb.Get(@"Vertex\$Description"), "cztery 1");

            //cztery.AddVertex(smb.Get(@"Vertex\$Description"), "cztery 2");


            // IVertex zzz = vx.AddVertex(null, "raz");

            //   IVertex yyy = vx.AddVertex(null, "dwa");

            //  IVertex wh = VertexOperations.AddInstance(vx, smu.Get(@"While"));


            // IVertex plus = VertexOperations.AddInstance(wh, smu.Get("-"), smu.Get(@"While\Test"));

            IVertex plus = VertexOperations.AddInstance(c, smu.Get("+"), smu.Get(@"MultiOperator\Expression"));

            //plus.AddVertex(smb.Get(@"Vertex\$Description"), "plus opis MAIN");

            //plus.AddVertex(null, "KUPA");

            //  plus.AddVertex(smu.Get(@"DoubleOperator\LeftExpression"), "10");

            // plus.AddVertex(smu.Get(@"DoubleOperator\RightExpression"), "30");

            plus.Value = "";

            // IVertex h = vx.AddVertex(null, "h");

            //  vx.AddEdge(zzz,plus);

            //  vx.AddVertex(zzz, "");

            // vx.AddEdge(yyy, plus);

            IVertex leftplus = VertexOperations.AddInstance(plus, smu.Get("-"), smu.Get(@"DoubleOperator\LeftExpression"));

            leftplus.Value = "";

            leftplus.AddVertex(smu.Get(@"DoubleOperator\LeftExpression"), "1");

            leftplus.AddVertex(smu.Get(@"DoubleOperator\RightExpression"), "2");

            IVertex rightplus = VertexOperations.AddInstance(plus, smu.Get("+"), smu.Get(@"DoubleOperator\RightExpression"));

            //rightplus.AddVertex(smb.Get(@"Vertex\$Description"), "plus opis tak");

            rightplus.Value = "";

            IVertex w3 = rightplus.AddVertex(smu.Get(@"DoubleOperator\LeftExpression"), "3");
            // w3.AddVertex(smb.Get(@"Vertex\$Description"), "3 3 3");


            IVertex v4 = rightplus.AddVertex(smu.Get(@"DoubleOperator\RightExpression"), "4");

            v4.AddVertex(smb.Get(@"Vertex\$Description"), "opis");



            //////////////////////////


            IVertex xXx = r.AddVertex(null, "XX");


            addf(xXx);


            //////////////////////////

            IVertex yv = r.AddVertex(null, "Y");
        }
Пример #20
0
        private bool EdgeExpressionEdgeCompare(IEdge testEdge, IEdge expressionEdge)
        {
            if (GeneralUtil.CompareStrings(expressionEdge.Meta.Value, ":"))
            {
                IList <IEdge> el = expressionEdge.To.OutEdges.ToList();

                bool firstTest = false;

                if (el.Count() > 1 &&
                    GeneralUtil.CompareStrings(el[0].Meta, "$Empty") &&
                    GeneralUtil.CompareStrings(el[1].Meta, "$Empty"))
                {
                    if (GeneralUtil.CompareStrings(testEdge.To.Value, el[1].To.Value)
                        //&& GeneralUtil.CompareStrings(testEdge.Meta.Value, el[0].To.Value))
                        && VertexOperations.InheritanceCompare(testEdge.Meta, (string)el[0].To.Value)) // Inheritance support
                    {
                        firstTest = true;
                    }
                    else
                    if (GeneralUtil.CompareStrings(el[0].To.Value, "$Is") && GeneralUtil.CompareStrings(testEdge.Meta, "$Is"))     // Inheritance support
                    {
                        firstTest = VertexOperations.InheritanceCompare(testEdge.To, (string)el[1].To.Value);
                    }
                }
                else
                //if (GeneralUtil.CompareStrings(testEdge.Meta, el[0].To.Value))
                if (VertexOperations.InheritanceCompare(testEdge.Meta, (string)el[0].To.Value))     // Inheritance support
                {
                    firstTest = true;
                }
                else
                if (GeneralUtil.CompareStrings(el[0].Meta, "$EmptyContainerTerminal"))         // is is for sure ok? 2014.11.21
                {
                    firstTest = true;
                }

                if (firstTest &&
                    el[0].To.Count() > 0)    // meta{xxx}:
                {
                    return(GetAll_Filter_nextTerminal(testEdge.Meta, el[0].To.FirstOrDefault()));
                }
                else
                {
                    return(firstTest);
                }
            }
            else
            {
                if (GeneralUtil.CompareStrings(expressionEdge.Meta.Value, "$Empty") &&
                    GeneralUtil.CompareStrings(testEdge.To.Value, expressionEdge.To.Value))
                {
                    return(true);
                }
                if (GeneralUtil.CompareStrings(expressionEdge.Meta.Value, "$EmptyContainerTerminal"))
                {
                    return(true);
                }
            }

            return(false);
        }