コード例 #1
0
        private String GenerateEdgeViewHTML(IEdgeView aEdge)
        {
            StringBuilder Output = new StringBuilder();

            Output.Append("<table class=\"gql_table\"border=\"1\"> <!-- EdgeView -->");

            #region Edge Properties
            if (aEdge.GetCountOfProperties() > 0)
            {
                Output.Append("<tr><td style=\"width:250px\">properties</td><td style=\"width:400px\">");
                Output.Append("<table class=\"gql_table\"border=\"1\"><tr><td style=\"width:400px\"> <!-- EdgeViewProperties -->");

                foreach (var _property in aEdge.GetAllProperties())
                {
                    if (_property.Item2 == null)
                    {
                        Output.Append(EscapeForXMLandHTML(_property.Item1)).Append("</td><td style=\"width:400px\"></td></tr>");
                    }
                    else
                    if (_property.Item2 is Stream)
                    {
                        Output.Append(EscapeForXMLandHTML(_property.Item1)).Append("</td><td style=\"width:400px\">BinaryProperty</td></tr>");
                    }
                    else
                    {
                        Output.Append(EscapeForXMLandHTML(_property.Item1)).Append("</td><td style=\"width:400px\">").Append(EscapeForXMLandHTML(_property.Item2.ToString())).Append("</td></tr>");
                    }
                }

                Output.Append("</table></td></tr> <!-- EdgeViewProperties -->");
            }
            #endregion


            #region Target Vertices
            Output.Append("<tr><td style=\"width:250px\">targetvertices</td><td style=\"width:400px\">");
            Output.Append("<table class=\"gql_table\"border=\"1\"><tr><td style=\"width:400px\"> <!-- TargetVertices -->");

            foreach (IVertexView _vertex in aEdge.GetTargetVertices())
            {
                Output.Append("<table class=\"gql_table\" border=\"1\"> <!-- Vertices-2 -->");
                Output.Append(GenerateVertexViewHTML(_vertex));
                Output.Append("</table> <!-- Vertices-2 -->");
            }

            Output.Append("</td></table> <!-- TargetVertices -->");

            Output.Append("</table></td></tr> <!-- EdgesView -->");

            return(Output.ToString());

            #endregion
        }
コード例 #2
0
ファイル: QueryResultComparer.cs プロジェクト: alrehamy/sones
        public bool Equals(IEdgeView x, IEdgeView y)
        {
            if (x.GetCountOfProperties() != y.GetCountOfProperties())
            {
                return(false);
            }

            var xProperties = x.GetAllProperties().ToList();
            var yProperties = y.GetAllProperties().ToList();

            if (xProperties.Count != yProperties.Count)
            {
                return(false);
            }

            for (int i = 0; i <= xProperties.Count; i++)
            {
                if (xProperties[i].PropertyName != xProperties[i].PropertyName)
                {
                    return(false);
                }

                if (!xProperties[i].Property.Equals(xProperties[i].Property))
                {
                    return(false);
                }
            }

            var xTargetVertices = x.GetTargetVertices().ToList();
            var yTargetVertices = y.GetTargetVertices().ToList();

            if (xTargetVertices.Count != xTargetVertices.Count)
            {
                return(false);
            }


            for (int i = 0; i <= xTargetVertices.Count; i++)
            {
                if (!this.Equals(xTargetVertices[i], xTargetVertices[i]))
                {
                    return(false);
                }
            }


            return(true);
        }
コード例 #3
0
ファイル: TEXT_IO.cs プロジェクト: anukat2015/sones
        /// <summary>
        /// Generates an text edge view.
        /// </summary>
        /// <param name="aEdge">The edge.</param>
        /// <param name="Header">The header.</param>
        /// <returns>An string that contains the text edge view.</returns>       
        private String GenerateEdgeViewText(String Header, IEdgeView aEdge)
        {
            StringBuilder Output = new StringBuilder();

            #region Edge Properties

            Output.AppendLine(Header + "\t Edge");

            Output.AppendLine(Header + "\t Properties");

            if (aEdge.GetCountOfProperties() > 0)
            {
                foreach (var _property in aEdge.GetAllProperties())
                {
                    if (_property.Item2 == null)
                    {
                        Output.AppendLine(Header + "\t\t" + _property.Item1);
                    }
                    else
                    {
                        if (_property.Item2 is Stream)
                        {
                            Output.AppendLine(Header + "\t\t" + _property.Item1 + "\t BinaryProperty");
                        }
                        else
                        {
                            if (_property.Item2 is ICollectionWrapper)
                            {
                                var prefix = Header + "\t\t";
                                Output.AppendLine(prefix + _property.Item1 + "\t");

                                HandleListProperties((ICollectionWrapper)_property.Item2, prefix, ref Output);
                            }
                            else
                            {
                                Output.AppendLine(Header + "\t\t" + _property.Item1 + "\t " + _property.Item2.ToString());
                            }
                        }
                    }
                }
            }

            #endregion

            if (aEdge is IHyperEdgeView)
            {
                foreach (var singleEdge in ((IHyperEdgeView)aEdge).GetAllEdges())
                {
                    Output.AppendLine(Header + "\t SingleEdge");
                    Output.AppendLine(Header + "\t\t\tProperties");
                    foreach (var _property in singleEdge.GetAllProperties())
                    {
                        if (_property.Item2 == null)
                        {
                            Output.AppendLine(Header + "\t\t\t\t " + _property.Item1);
                        }
                        else
                        {
                            if (_property.Item2 is Stream)
                            {
                                Output.AppendLine(Header + "\t\t\t\t " + _property.Item1 + "\t\t\t BinaryProperty");
                            }
                            else
                            {
                                if (_property.Item2 is ICollectionWrapper)
                                {
                                    var prefix = Header + "\t\t";

                                    Output.AppendLine(Header + "\t\t\t\t " + _property.Item1);

                                    HandleListProperties((ICollectionWrapper)_property.Item2, prefix + "\t\t\t\t", ref Output);
                                }
                                else
                                {
                                    Output.AppendLine(Header + "\t\t\t\t " + _property.Item1 + "\t\t " + _property.Item2.ToString());
                                }
                            }
                        }
                    }

                    if (singleEdge.GetTargetVertex() != null)
                    {
                        Output.AppendLine(Header + "\t\t\tTargetVertex");
                        Output.Append(GenerateVertexViewText(Header + "\t\t\t", singleEdge.GetTargetVertex()));
                    }
                }
            }
            else
            {
                if (((ISingleEdgeView)aEdge).GetTargetVertex() != null)
                {
                    Output.AppendLine(Header + "\t\t\t\tTargetVertex");
                    Output.Append(GenerateVertexViewText(Header + "\t\t\t", ((ISingleEdgeView)aEdge).GetTargetVertex()));
                }

            }

            return Output.ToString();
        }
コード例 #4
0
        /// <summary>
        /// Generates an text edge view.
        /// </summary>
        /// <param name="aEdge">The edge.</param>
        /// <param name="Header">The header.</param>
        /// <returns>An string that contains the text edge view.</returns>
        private String GenerateEdgeViewText(String Header, IEdgeView aEdge)
        {
            StringBuilder Output = new StringBuilder();

            #region Edge Properties

            Output.AppendLine(Header + "\t Edge");

            Output.AppendLine(Header + "\t Properties");

            if (aEdge.GetCountOfProperties() > 0)
            {
                foreach (var _property in aEdge.GetAllProperties())
                {
                    if (_property.Property == null)
                    {
                        Output.AppendLine(Header + "\t\t" + _property.Property);
                    }
                    else
                    {
                        if (_property.Property is Stream)
                        {
                            Output.AppendLine(Header + "\t\t" + _property.Property + "\t BinaryProperty");
                        }
                        else
                        {
                            if (_property.Property is ICollectionWrapper)
                            {
                                var prefix = Header + "\t\t";
                                Output.AppendLine(prefix + _property.Property + "\t");

                                HandleListProperties((ICollectionWrapper)_property.Property, prefix, ref Output);
                            }
                            else
                            {
                                Output.AppendLine(Header + "\t\t" + _property.Property + "\t " + _property.Property.ToString());
                            }
                        }
                    }
                }
            }

            #endregion

            if (aEdge is IHyperEdgeView)
            {
                foreach (var singleEdge in ((IHyperEdgeView)aEdge).GetAllEdges())
                {
                    Output.AppendLine(Header + "\t SingleEdge");
                    Output.AppendLine(Header + "\t\t\tProperties");
                    foreach (var _property in singleEdge.GetAllProperties())
                    {
                        if (_property.Property == null)
                        {
                            Output.AppendLine(Header + "\t\t\t\t " + _property.PropertyName);
                        }
                        else
                        {
                            if (_property.Property is Stream)
                            {
                                Output.AppendLine(Header + "\t\t\t\t " + _property.PropertyName + "\t\t\t BinaryProperty");
                            }
                            else
                            {
                                if (_property.Property is ICollectionWrapper)
                                {
                                    var prefix = Header + "\t\t";

                                    Output.AppendLine(Header + "\t\t\t\t " + _property.PropertyName);

                                    HandleListProperties((ICollectionWrapper)_property.Property, prefix + "\t\t\t\t", ref Output);
                                }
                                else
                                {
                                    Output.AppendLine(Header + "\t\t\t\t " + _property.PropertyName + "\t\t " + _property.Property.ToString());
                                }
                            }
                        }
                    }

                    if (singleEdge.GetTargetVertex() != null)
                    {
                        Output.AppendLine(Header + "\t\t\tTargetVertex");
                        Output.Append(GenerateVertexViewText(Header + "\t\t\t", singleEdge.GetTargetVertex()));
                    }
                }
            }
            else
            {
                if (((ISingleEdgeView)aEdge).GetTargetVertex() != null)
                {
                    Output.AppendLine(Header + "\t\t\t\tTargetVertex");
                    Output.Append(GenerateVertexViewText(Header + "\t\t\t", ((ISingleEdgeView)aEdge).GetTargetVertex()));
                }
            }

            return(Output.ToString());
        }
コード例 #5
0
ファイル: HTML_IO.cs プロジェクト: ramz/sones
        private String GenerateEdgeViewHTML(IEdgeView aEdge)
        {
            StringBuilder Output = new StringBuilder();
            Output.Append("<table class=\"gql_table\"border=\"1\"> <!-- EdgeView -->");

            #region Edge Properties
            if (aEdge.GetCountOfProperties() > 0)
            {
                Output.Append("<tr><td style=\"width:250px\">properties</td><td style=\"width:400px\">");
                Output.Append("<table class=\"gql_table\"border=\"1\"><tr><td style=\"width:400px\"> <!-- EdgeViewProperties -->");

                foreach (var _property in aEdge.GetAllProperties())
                {
                    if (_property.Item2 == null)
                        Output.Append(EscapeForXMLandHTML(_property.Item1)).Append("</td><td style=\"width:400px\"></td></tr>");
                    else
                        if (_property.Item2 is Stream)
                        {
                            Output.Append(EscapeForXMLandHTML(_property.Item1)).Append("</td><td style=\"width:400px\">BinaryProperty</td></tr>");
                        }
                        else
                            Output.Append(EscapeForXMLandHTML(_property.Item1)).Append("</td><td style=\"width:400px\">").Append(EscapeForXMLandHTML(_property.Item2.ToString())).Append("</td></tr>");
                }

                Output.Append("</table></td></tr> <!-- EdgeViewProperties -->");
            }
            #endregion

            #region Target Vertices
            Output.Append("<tr><td style=\"width:250px\">targetvertices</td><td style=\"width:400px\">");
            Output.Append("<table class=\"gql_table\"border=\"1\"><tr><td style=\"width:400px\"> <!-- TargetVertices -->");

            foreach (IVertexView _vertex in aEdge.GetTargetVertices())
            {
                Output.Append("<table class=\"gql_table\" border=\"1\"> <!-- Vertices-2 -->");
                Output.Append(GenerateVertexViewHTML(_vertex));
                Output.Append("</table> <!-- Vertices-2 -->");
            }

            Output.Append("</td></table> <!-- TargetVertices -->");

            Output.Append("</table></td></tr> <!-- EdgesView -->");

            return Output.ToString();
            #endregion
        }