Exemple #1
0
        public override IEdge AddEdge(IVertex metaVertex, IVertex destVertex)
        {
            // LOG BEGIN

            /*
             * if(metaVertex==null)
             *  MinusZero.Instance.Log(3,"AddEdge", GeneralUtil.EmptyIfNull(this.Value) + " [NULL] " + GeneralUtil.EmptyIfNull(destVertex.Value));
             * else
             *  MinusZero.Instance.Log(3,"AddEdge", GeneralUtil.EmptyIfNull(this.Value) + " [" + GeneralUtil.EmptyIfNull(metaVertex.Value) + "] " + GeneralUtil.EmptyIfNull(destVertex.Value));
             */
            // LOG END

            if (destVertex == null)
            {
                throw new Exception("target vertex can not be null");
            }

            EdgeBase ne = new EasyEdge(this, metaVertex, destVertex);

            OutEdgesRaw.Add(ne);

            UsageCounter++;

            if (GeneralUtil.CompareStrings(ne.Meta.Value, "$Inherits"))
            {
                InheritanceCount++;

                HasInheritance = true;
            }

            FireChange(new VertexChangeEventArgs(VertexChangeType.EdgeAdded, ne));

            return(ne);
        }
Exemple #2
0
        public IEdge this[string meta]
        {
            get {
                IVertex r = this.GetAll(meta + ":");

                if (r.Count() > 0)
                {
                    return(r.First());
                }

                IVertex metavertexs = this.GetAll(@"$Is:\" + meta);

                if (metavertexs.Count() > 0)
                {
                    IEdge metavertex = metavertexs.First();

                    IEdge newedge = new EasyEdge(this, metavertex.To, null);

                    return(newedge);
                }
                else
                {
                    if (meta == "$EdgeTarget")
                    {
                        IEdge metavertex = m0.MinusZero.Instance.Root.GetAll(@"System\Meta\Base\Vertex\$EdgeTarget").FirstOrDefault();

                        IEdge newedge = new EasyEdge(this, metavertex.To, null);

                        return(newedge);
                    }
                }

                // inherits from Vertex. hiddenly
                // this is for Table Visualiser
                IEdge vertexMetaVertex = m0.MinusZero.Instance.Root.GetAll(@"System\Meta\Base\Vertex\" + meta).FirstOrDefault();

                if (vertexMetaVertex != null)
                {
                    return(new EasyEdge(this, vertexMetaVertex.To, null));
                }

                return(null);
            }
        }