示例#1
0
        /// <summary>
        ///     Pops a graph handle from stack, no checks performed.
        /// </summary>
        private void EndGraphInternal()
        {
            GraphHandle h = _subGraphs.Pop();

            h.MarkAsUsed();
            Line("}");
        }
示例#2
0
        public IGraphHandle StartGraph(GraphMode graphMode, bool strict)
        {
            _graphMode = graphMode;
            if (_subGraphs.Count != 0)
            {
                throw new InvalidOperationException();
            }

            string line = "";

            if (strict)
            {
                line += "strict ";
            }

            line += graphMode == GraphMode.Graph ? "graph" : "digraph";
            line += " \"\" {";

            Line(line);

            GraphHandle g = new GraphHandle(this);

            _subGraphs.Push(g);
            return(g);
        }
示例#3
0
        /// <summary>
        ///     Ends graph or subgraph when called by handle disposal.
        /// </summary>
        internal void EndGraphFromHandle(GraphHandle handle)
        {
            if (!ReferenceEquals(_subGraphs.Peek(), handle))
            {
                throw new InvalidOperationException();
            }

            EndGraphInternal();
        }
示例#4
0
        public IGraphHandle StartSubGraph()
        {
            if (_subGraphs.Count == 0)
            {
                throw new InvalidOperationException();
            }

            Line("subgraph {");

            GraphHandle g = new GraphHandle(this);

            _subGraphs.Push(g);
            return(g);
        }